Check-in [36f4984f23]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:update libressl to version 3.6.1
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 36f4984f2316d42e060463b0d89da3fafb4f5090
User & Date: chw 2022-11-01 09:43:12.282
Context
2022-11-02
03:49
add backported tip#645 check-in: f0bca6f562 user: chw tags: trunk
2022-11-01
09:43
update libressl to version 3.6.1 check-in: 36f4984f23 user: chw tags: trunk
2022-10-31
19:14
support simple arrays in topcua mapstruct subcommand check-in: cd1b8bf43c user: chw tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to jni/libressl/Android.mk.
142
143
144
145
146
147
148

149
150
151
152
153
154
155
	crypto/pkcs12/p12_mutl.c \
	crypto/pkcs12/p12_decr.c \
	crypto/pkcs12/p12_asn.c \
	crypto/pkcs12/p12_add.c \
	crypto/pkcs12/p12_utl.c \
	crypto/pkcs12/p12_attr.c \
	crypto/pkcs12/pk12err.c \

	crypto/bf/bf_enc.c \
	crypto/bf/bf_skey.c \
	crypto/bf/bf_ecb.c \
	crypto/bf/bf_cfb64.c \
	crypto/bf/bf_ofb64.c \
	crypto/x509/x509_v3.c \
	crypto/x509/x509_cmp.c \







>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
	crypto/pkcs12/p12_mutl.c \
	crypto/pkcs12/p12_decr.c \
	crypto/pkcs12/p12_asn.c \
	crypto/pkcs12/p12_add.c \
	crypto/pkcs12/p12_utl.c \
	crypto/pkcs12/p12_attr.c \
	crypto/pkcs12/pk12err.c \
	crypto/pkcs12/p12_sbag.c \
	crypto/bf/bf_enc.c \
	crypto/bf/bf_skey.c \
	crypto/bf/bf_ecb.c \
	crypto/bf/bf_cfb64.c \
	crypto/bf/bf_ofb64.c \
	crypto/x509/x509_v3.c \
	crypto/x509/x509_cmp.c \
318
319
320
321
322
323
324


325
326
327
328
329
330
331
	crypto/bn/bn_sqrt.c \
	crypto/bn/bn_lib.c \
	crypto/bn/bn_gf2m.c \
	crypto/bn/bn_recp.c \
	crypto/bn/bn_sqr.c \
	crypto/bn/bn_gcd.c \
	crypto/bn/bn_word.c \


	crypto/chacha/chacha.c \
	crypto/ui/ui_openssl.c \
	crypto/ui/ui_util.c \
	crypto/ui/ui_err.c \
	crypto/ui/ui_lib.c \
	crypto/rsa/rsa_pk1.c \
	crypto/rsa/rsa_x931.c \







>
>







319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
	crypto/bn/bn_sqrt.c \
	crypto/bn/bn_lib.c \
	crypto/bn/bn_gf2m.c \
	crypto/bn/bn_recp.c \
	crypto/bn/bn_sqr.c \
	crypto/bn/bn_gcd.c \
	crypto/bn/bn_word.c \
	crypto/bn/bn_bpsw.c \
	crypto/bn/bn_isqrt.c \
	crypto/chacha/chacha.c \
	crypto/ui/ui_openssl.c \
	crypto/ui/ui_util.c \
	crypto/ui/ui_err.c \
	crypto/ui/ui_lib.c \
	crypto/rsa/rsa_pk1.c \
	crypto/rsa/rsa_x931.c \
591
592
593
594
595
596
597
598


599
600
601
602
603
604
605
	crypto/cms/cms_ess.c \
	crypto/cms/cms_io.c \
	crypto/cms/cms_kari.c \
	crypto/cms/cms_lib.c \
	crypto/cms/cms_pwri.c \
	crypto/cms/cms_sd.c \
	crypto/cms/cms_smime.c \
	crypto/compat/strtonum.c



LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \
	$(LOCAL_PATH)/include/compat \
	$(LOCAL_PATH)/crypto \
	$(LOCAL_PATH)/crypto/compat \
	$(LOCAL_PATH)/crypto/asn1 \
	$(LOCAL_PATH)/crypto/bn \







|
>
>







594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
	crypto/cms/cms_ess.c \
	crypto/cms/cms_io.c \
	crypto/cms/cms_kari.c \
	crypto/cms/cms_lib.c \
	crypto/cms/cms_pwri.c \
	crypto/cms/cms_sd.c \
	crypto/cms/cms_smime.c \
	crypto/compat/strtonum.c \
	crypto/kdf/hkdf_evp.c \
	crypto/kdf/kdf_err.c

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \
	$(LOCAL_PATH)/include/compat \
	$(LOCAL_PATH)/crypto \
	$(LOCAL_PATH)/crypto/compat \
	$(LOCAL_PATH)/crypto/asn1 \
	$(LOCAL_PATH)/crypto/bn \
674
675
676
677
678
679
680

681
682
683
684
685
686
687
688
689
690
691
692
693
694
695

696
697
698

699
700
701
702
703
704
705
	ssl/ssl_stat.c \
	ssl/ssl_txt.c \
	ssl/ssl_tlsext.c \
	ssl/ssl_transcript.c \
	ssl/ssl_versions.c \
	ssl/ssl_init.c \
	ssl/ssl_kex.c \

	ssl/t1_enc.c \
	ssl/t1_lib.c \
	ssl/tls12_key_schedule.c \
	ssl/tls12_record_layer.c \
	ssl/tls12_lib.c \
	ssl/tls13_client.c \
	ssl/tls13_handshake.c \
	ssl/tls13_handshake_msg.c \
	ssl/tls13_key_schedule.c \
	ssl/tls13_lib.c \
	ssl/tls13_record.c \
	ssl/tls13_record_layer.c \
	ssl/tls13_error.c \
	ssl/tls13_legacy.c \
	ssl/tls13_server.c \

	ssl/tls_content.c \
	ssl/tls_buffer.c \
	ssl/tls_key_share.c


LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \
	$(LOCAL_PATH)/include/compat \
	$(LOCAL_PATH)/ssl \
	$(LOCAL_PATH)/crypto/compat \
	$(LOCAL_PATH)/crypto/bio








>















>


|
>







679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
	ssl/ssl_stat.c \
	ssl/ssl_txt.c \
	ssl/ssl_tlsext.c \
	ssl/ssl_transcript.c \
	ssl/ssl_versions.c \
	ssl/ssl_init.c \
	ssl/ssl_kex.c \
	ssl/ssl_seclevel.c \
	ssl/t1_enc.c \
	ssl/t1_lib.c \
	ssl/tls12_key_schedule.c \
	ssl/tls12_record_layer.c \
	ssl/tls12_lib.c \
	ssl/tls13_client.c \
	ssl/tls13_handshake.c \
	ssl/tls13_handshake_msg.c \
	ssl/tls13_key_schedule.c \
	ssl/tls13_lib.c \
	ssl/tls13_record.c \
	ssl/tls13_record_layer.c \
	ssl/tls13_error.c \
	ssl/tls13_legacy.c \
	ssl/tls13_server.c \
	ssl/tls13_quic.c \
	ssl/tls_content.c \
	ssl/tls_buffer.c \
	ssl/tls_key_share.c \
	ssl/tls_lib.c

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \
	$(LOCAL_PATH)/include/compat \
	$(LOCAL_PATH)/ssl \
	$(LOCAL_PATH)/crypto/compat \
	$(LOCAL_PATH)/crypto/bio

Changes to jni/libressl/CMakeLists.txt.
286
287
288
289
290
291
292





293
294
295
296
297
298
299
	add_definitions(-DHAVE_MEMMEM)
endif()

check_include_files(endian.h HAVE_ENDIAN_H)
if(HAVE_ENDIAN_H)
	add_definitions(-DHAVE_ENDIAN_H)
endif()






check_include_files(err.h HAVE_ERR_H)
if(HAVE_ERR_H)
	add_definitions(-DHAVE_ERR_H)
endif()

check_include_files("sys/types.h;arpa/inet.h;netinet/ip.h" HAVE_NETINET_IP_H)







>
>
>
>
>







286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
	add_definitions(-DHAVE_MEMMEM)
endif()

check_include_files(endian.h HAVE_ENDIAN_H)
if(HAVE_ENDIAN_H)
	add_definitions(-DHAVE_ENDIAN_H)
endif()

check_include_files(machine/endian.h HAVE_MACHINE_ENDIAN_H)
if(HAVE_MACHINE_ENDIAN_H)
	add_definitions(-DHAVE_MACHINE_ENDIAN_H)
endif()

check_include_files(err.h HAVE_ERR_H)
if(HAVE_ERR_H)
	add_definitions(-DHAVE_ERR_H)
endif()

check_include_files("sys/types.h;arpa/inet.h;netinet/ip.h" HAVE_NETINET_IP_H)
Changes to jni/libressl/ChangeLog.
23
24
25
26
27
28
29



















































































































































30
31
32
33
34
35
36

The portable bits of the project are largely maintained out-of-tree, and their
history is also available from Git.

	https://github.com/libressl-portable/portable

LibreSSL Portable Release Notes:




















































































































































3.5.3 - Reliability fix

	* Fix d2i_ASN1_OBJECT(). A confusion of two CBS resulted in advancing
	  the passed *der_in pointer incorrectly. Thanks to Aram Sargsyan for
	  reporting the issue and testing the fix.








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183

The portable bits of the project are largely maintained out-of-tree, and their
history is also available from Git.

	https://github.com/libressl-portable/portable

LibreSSL Portable Release Notes:

3.6.1 - Stable release

	* Bug fixes
	  - Custom verification callbacks could cause the X.509 verifier to
	    fail to store errors resulting from leaf certificate verification.
	    Reported by Ilya Shipitsin.
	  - Unbreak ASN.1 indefinite length encoding.
	    Reported by Niklas Hallqvist.

3.6.0 - Development release

	* Internal improvements
	  - Avoid expensive RFC 3779 checks during cert verification.
	  - The templated ASN.1 decoder has been cleaned up, refactored,
	    modernized with parts rewritten using CBB and CBS.
	  - The ASN.1 time parser has been rewritten.
	  - Rewrite and fix ASN1_STRING_to_UTF8().
	  - Use asn1_abs_set_unused_bits() rather than inlining it.
	  - Simplify ec_asn1_group2curve().
	  - First pass at a clean up of ASN1_item_sign_ctx()
	  - ssl_txt.c was cleaned up.
	  - Internal function arguments and struct member have been changed
	    to size_t.
	  - Lots of missing error checks of EVP API were added.
	  - Clean up and clarify BN_kronecker().
	  - Simplify ASN1_INTEGER_cmp()
	  - Rewrite ASN1_INTEGER_{get,set}() using CBS and CBB and reuse
	    the ASN1_INTEGER functions for ASN1_ENUMERATED.
	  - Use ASN1_INTEGER to parse and build {Z,}LONG_it
	  - Refactored and cleaned up group (elliptic curve) handling in
	    t1_lib.c.
	  - Simplify certificate list handling code in the legacy server.
	  - Make CBB_finish() fail if *out_data is not NULL.
	  - Remove tls_buffer_set_data() and remove/revise callers.
	  - Rewrite SSL{_CTX,}_set_alpn_protos() using CBS.
	  - Simplify tlsext_supported_groups_server_parse().
	  - Remove redundant length checks in tlsext parse functions.
	  - Simplify tls13_server_encrypted_extensions_recv().
	  - Add read and write support to tls_buffer.
	  - Convert TLS transcript from BUF_MEM to tls_buffer.
	  - Clear key on exit in PKCS12_gen_mac().
	  - Minor fixes in PKCS12_parse().
	  - Provide and use a primitive clear function for BIGNUM_it.
	  - Use ASN1_INTEGER to encode/decode BIGNUM_it.
	  - Add stack frames to AES-NI x86_64 assembly.
	  - Use named initialisers for BIGNUMs.
	  - Tidy up some of BN_nist_mod_*.
	  - Expand BLOCK_CIPHER_* and related macros.
	  - Avoid shadowing the cbs function parameter in
	    tlsext_alpn_server_parse()
	  - Deduplicate peer certificate chain processing code.
	  - Make it possible to signal an error from an i2c_* function.
	  - Rewrite i2c_ASN1_INTEGER() using CBB/CBS.
	  - Remove UINT32_MAX limitation on ChaCha() and CRYPTO_chacha_20().
	  - Remove bogus length checks from EVP_aead_chacha20_poly1305().
	  - Reworked DSA_size() and ECDSA_size().
	  - Stop using CBIGNUM_it internal to libcrypto.
	  - Provide c2i_ASN1_ENUMERATED_cbs() and call it from
	    asn1_c2i_primitive().
	  - Ensure ASN.1 types are appropriately encoded.
	  - Avoid recycling ASN1_STRINGs when decoding ASN.1.
	  - Tidy up asn1_c2i_primitive() slightly.
	  - Mechanically expand IMPLEMENT_BLOCK_CIPHER, IMPLEMENT_CFBR,
	    BLOCK_CIPHER and the looney M_do_cipher macros.
	  - Use correct length for EVP CFB mode ciphers.
	  - Provide a version of ssl_msg_callback() that takes a CBS.
	  - Use CBS to parse TLS alerts in the legacy stack.
	  - Increment the input and output position for EVP AES CFB1.
	  - Ensure there is no trailing data for a CCS received by the
	    TLSv1.3 stack.
	  - Use CBS when procesing a CCS message in the legacy stack.
	  - Be stricter with middlebox compatibility mode in the TLSv1.3
	    server.
	* Compatibility changes
	  - The ASN.1 time parser has been refactored and rewritten using CBS.
	    It has been made stricter in that it now enforces the rules from
	    RFC 5280.
	  - ASN1_AFLG_BROKEN was removed.
	  - Error check tls_session_secret_cb() like OpenSSL.
	  - Added ASN1_INTEGER_{get,set}_{u,}int64()
	  - Move leaf certificate checks to the last thing after chain
	    validation.
	  - Added -s option to openssl(1) ciphers that only shows the ciphers
	    supported by the specified protocol.
	  - Use TLS_client_method() instead of TLSv1_client_method() in
	    the openssl(1) ciphers command.
	  - Validate the protocols in SSL{_CTX,}_set_alpn_protos().
	  - Made TS and PKCS12 opaque.
	  - Per RFC 7292, safeContentsBag is a SEQUENCE OF, not a SET OF.
	  - Align PKCS12_key_gen_uni() with OpenSSL
	  - Various PKCS12 and TS accessors were added. In particular, the
	    TS_RESP_CTX_set_time_cb() function was added back.
	  - Allow a NULL header in PEM_write{,_bio}()
	  - Allow empty attribute sets in CSRs.
	  - Adjust signatures of BIO_ctrl functions.
	  - Provide additional defines for EVP AEAD.
	  - Provide OPENSSL_cleanup().
	  - Make BIO_info_cb() identical to bio_info_cb().
	* Bug fixes
	  - Avoid use of uninitialized in BN_mod_exp_recp().
	  - Fix X509_get_extension_flags() by ensuring that EXFLAG_INVALID is
	    set on X509_get_purpose() failure.
	  - Fix HMAC() with NULL key.
	  - Add ERR_load_{COMP,CT,KDF}_strings() to ERR_load_crypto_strings().
	  - Avoid strict aliasing violations in BN_nist_mod_*().
	  - Do not return X509_V_ERR_UNSPECIFIED from X509_check_ca().
	    No return value of X509_check_ca() indicates failure. Application
	    code should therefore issue a checked call to X509_check_purpose()
	    before calling X509_check_ca().
	  - Rewrite and fix X509v3_asid_subset() to avoid segfaults on some
	    valid input.
	  - Call the ASN1_OP_D2I_PRE callback after ASN1_item_ex_new().
	  - Fix d2i_ASN1_OBJECT to advance the *der_in pointer correctly.
	  - Avoid use of uninitialized in ASN1_STRING_to_UTF8().
	  - Do not pass uninitialized pointer to ASN1_STRING_to_UTF8().
	  - Do not refuse valid IPv6 addresses in nc(1)'s HTTP CONNECT proxy.
	  - Do not reject primes in trial divisions.
	  - Error out on negative shifts in BN_{r,l}shift() instead of
	    accessing arrays out of bounds.
	  - Fix URI name constraints, allow for URI's with no host part.
	  - Fix the legacy verifier callback behaviour for untrusted certs.
	  - Correct serfver-side handling of TLSv1.3 key updates.
	  - Plug leak in PKCS12_setup_mac().
	  - Plug leak in X509V3_add1_i2d().
	  - Only print X.509 versions we know about.
	  - Avoid signed integer overflow due to unary negation
	  - Initialize readbytes in BIO_gets().
	  - Plug memory leak in CMS_add_simple_smimecap().
	  - Plug memory leak in X509_REQ_print_ex().
	  - Check HMAC() return value to avoid a later use of uninitialized.
	  - Avoid potential NULL dereference in ssl_set_pkey().
	  - Check return values in ssl_print_tmp_key().
	  - Switch loop bounds from size_t to int in check_hosts().
	  - Avoid division by zero if no connection was made in s_time.c.
	  - Check sk_SSL_CIPHER_push() return value
	  - Avoid out-of-bounds read in ssl_cipher_process_rulestr().
	  - Use LONG_MAX as the limit for ciphers with long based APIs.
	* New features
	  - EVP API for HKDF ported from OpenSSL and subsequently cleaned up.
	  - The security level API (SSL_{,CTX}_{get,set}_security_level()) is
	    now available. Callbacks and ex_data are not supported. Sane
	    software will not be using this.
	  - Experimental support for the BoringSSL QUIC API.
	  - Add initial support for TS ESSCertIDv2 verification.
	  - LibreSSL now uses the Baillie-PSW primality test instead of
	    Miller-Rabin .

3.5.3 - Reliability fix

	* Fix d2i_ASN1_OBJECT(). A confusion of two CBS resulted in advancing
	  the passed *der_in pointer incorrectly. Thanks to Aram Sargsyan for
	  reporting the issue and testing the fix.

Changes to jni/libressl/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = crypto ssl tls include apps man tests
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libcrypto.pc.in \
	$(srcdir)/libssl.pc.in $(srcdir)/libtls.pc.in \
	$(srcdir)/openssl.pc.in COPYING ChangeLog INSTALL compile \
	config.guess config.sub depcomp install-sh ltmain.sh missing \
	tap-driver.sh
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
  if test -d "$(distdir)"; then \
    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
      && rm -rf "$(distdir)" \







<
<
<



|
|
|







187
188
189
190
191
192
193



194
195
196
197
198
199
200
201
202
203
204
205
206
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`



DIST_SUBDIRS = crypto ssl tls include apps man tests
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libcrypto.pc.in \
	$(srcdir)/libssl.pc.in $(srcdir)/libtls.pc.in \
	$(srcdir)/openssl.pc.in COPYING ChangeLog INSTALL README.md \
	compile config.guess config.sub depcomp install-sh ltmain.sh \
	missing tap-driver.sh
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
  if test -d "$(distdir)"; then \
    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
      && rm -rf "$(distdir)" \
256
257
258
259
260
261
262


263
264
265
266
267
268
269
270
271
272

273
274
275
276
277
278
279
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







>
>










>







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	$(am__remove_distdir)
	test -d "$(distdir)" || mkdir "$(distdir)"
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \







<







552
553
554
555
556
557
558

559
560
561
562
563
564
565
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	$(am__remove_distdir)
	test -d "$(distdir)" || mkdir "$(distdir)"
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
Changes to jni/libressl/VERSION.
1
2
3.5.3

|

1
2
3.6.1

Changes to jni/libressl/aclocal.m4.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# generated automatically by aclocal 1.16.3 -*- Autoconf -*-

# Copyright (C) 1996-2020 Free Software Foundation, Inc.

# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf.  It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])

# Copyright (C) 2002-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version.  Point them to the right macro.
m4_if([$1], [1.16.3], [],
      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])

# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too.  Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])

# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.3])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])

# Figure out how to run the assembler.                      -*- Autoconf -*-

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_PROG_AS
# ----------
AC_DEFUN([AM_PROG_AS],
[# By default we simply use the C compiler to build assembly code.
AC_REQUIRE([AC_PROG_CC])
test "${CCAS+set}" = set || CCAS=$CC
test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
])

# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
|

|



















|














|















|






|



















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-

# Copyright (C) 1996-2021 Free Software Foundation, Inc.

# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf.  It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])

# Copyright (C) 2002-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version.  Point them to the right macro.
m4_if([$1], [1.16.5], [],
      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])

# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too.  Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])

# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.5])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])

# Figure out how to run the assembler.                      -*- Autoconf -*-

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_PROG_AS
# ----------
AC_DEFUN([AM_PROG_AS],
[# By default we simply use the C compiler to build assembly code.
AC_REQUIRE([AC_PROG_CC])
test "${CCAS+set}" = set || CCAS=$CC
test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
])

# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])

# AM_CONDITIONAL                                            -*- Autoconf -*-

# Copyright (C) 1997-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------







|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])

# AM_CONDITIONAL                                            -*- Autoconf -*-

# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
  AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])

# Copyright (C) 1999-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.


# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be







|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
  AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])

# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.


# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])

# Generate code to set up dependency tracking.              -*- Autoconf -*-

# Copyright (C) 1999-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------







|







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])

# Generate code to set up dependency tracking.              -*- Autoconf -*-

# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])

# Do all the work for Automake.                             -*- Autoconf -*-

# Copyright (C) 1996-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This macro actually does too much.  Some checks are only needed if
# your package does certain things.  But this isn't really a big deal.







|







416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])

# Do all the work for Automake.                             -*- Autoconf -*-

# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This macro actually does too much.  Some checks are only needed if
# your package does certain things.  But this isn't really a big deal.
444
445
446
447
448
449
450




451
452
453
454
455
456
457
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition.  After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl




dnl Autoconf wants to disallow AM_ names.  We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output







>
>
>
>







444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition.  After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
m4_ifdef([_$0_ALREADY_INIT],
  [m4_fatal([$0 expanded multiple times
]m4_defn([_$0_ALREADY_INIT]))],
  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
dnl Autoconf wants to disallow AM_ names.  We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
             [$0: two- and three-arguments forms are deprecated.])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
 AC_SUBST([PACKAGE], [$1])dnl
 AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
  [ok:ok],,
  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl

_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])







|







484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
             [$0: two- and three-arguments forms are deprecated.])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
 AC_SUBST([PACKAGE], [$1])dnl
 AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
  [ok:ok],,
  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl

_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
532
533
534
535
536
537
538














539
540
541
542
543
544
545
		  [m4_define([AC_PROG_OBJC],
			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
		  [_AM_DEPENDENCIES([OBJCXX])],
		  [m4_define([AC_PROG_OBJCXX],
			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])














AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl







>
>
>
>
>
>
>
>
>
>
>
>
>
>







536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
		  [m4_define([AC_PROG_OBJC],
			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
		  [_AM_DEPENDENCIES([OBJCXX])],
		  [m4_define([AC_PROG_OBJCXX],
			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
# Variables for tags utilities; see am/tags.am
if test -z "$CTAGS"; then
  CTAGS=ctags
fi
AC_SUBST([CTAGS])
if test -z "$ETAGS"; then
  ETAGS=etags
fi
AC_SUBST([ETAGS])
if test -z "$CSCOPE"; then
  CSCOPE=cscope
fi
AC_SUBST([CSCOPE])

AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
      break ;;
    * )
      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
  esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh+set}" != xset; then
  case $am_aux_dir in
  *\ * | *\	*)
    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
  *)
    install_sh="\${SHELL} $am_aux_dir/install-sh"
  esac
fi
AC_SUBST([install_sh])])

# Copyright (C) 2003-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# Check whether the underlying file-system supports filenames
# with a leading dot.  For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
  am__leading_dot=.
else
  am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])

# Check to see how 'make' treats includes.	            -*- Autoconf -*-

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_MAKE_INCLUDE()
# -----------------







|




















|




















|







631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
      break ;;
    * )
      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
  esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh+set}" != xset; then
  case $am_aux_dir in
  *\ * | *\	*)
    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
  *)
    install_sh="\${SHELL} $am_aux_dir/install-sh"
  esac
fi
AC_SUBST([install_sh])])

# Copyright (C) 2003-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# Check whether the underlying file-system supports filenames
# with a leading dot.  For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
  am__leading_dot=.
else
  am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])

# Check to see how 'make' treats includes.	            -*- Autoconf -*-

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_MAKE_INCLUDE()
# -----------------
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
rm -f confinc.* confmf.*
AC_MSG_RESULT([${_am_result}])
AC_SUBST([am__include])])
AC_SUBST([am__quote])])

# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-

# Copyright (C) 1997-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------







|







716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
rm -f confinc.* confmf.*
AC_MSG_RESULT([${_am_result}])
AC_SUBST([am__include])])
AC_SUBST([am__quote])])

# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-

# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
  am_missing_run=
  AC_MSG_WARN(['missing' script is too old or missing])
fi
])

# Helper functions for option handling.                     -*- Autoconf -*-

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_MANGLE_OPTION(NAME)
# -----------------------







|







750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
  am_missing_run=
  AC_MSG_WARN(['missing' script is too old or missing])
fi
])

# Helper functions for option handling.                     -*- Autoconf -*-

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_MANGLE_OPTION(NAME)
# -----------------------
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775

# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])

# Copyright (C) 1999-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_PROG_CC_C_O
# ---------------







|







779
780
781
782
783
784
785
786
787
788
789
790
791
792
793

# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])

# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_PROG_CC_C_O
# ---------------
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
   CC="$am_aux_dir/compile $CC"
fi
AC_LANG_POP([C])])

# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
AC_DEFUN([AM_RUN_LOG],
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
   (exit $ac_status); }])

# Check to make sure that the build environment is sane.    -*- Autoconf -*-

# Copyright (C) 1996-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_SANITY_CHECK
# ---------------







|


















|







826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
   CC="$am_aux_dir/compile $CC"
fi
AC_LANG_POP([C])])

# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
AC_DEFUN([AM_RUN_LOG],
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
   (exit $ac_status); }])

# Check to make sure that the build environment is sane.    -*- Autoconf -*-

# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_SANITY_CHECK
# ---------------
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
     # Hide warnings about reused PIDs.
     wait $am_sleep_pid 2>/dev/null
   fi
   AC_MSG_RESULT([done])])
rm -f conftest.file
])

# Copyright (C) 2009-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_SILENT_RULES([DEFAULT])
# --------------------------







|







926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
     # Hide warnings about reused PIDs.
     wait $am_sleep_pid 2>/dev/null
   fi
   AC_MSG_RESULT([done])])
rm -f conftest.file
])

# Copyright (C) 2009-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_SILENT_RULES([DEFAULT])
# --------------------------
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_PROG_INSTALL_STRIP
# ---------------------







|







986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_PROG_INSTALL_STRIP
# ---------------------
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
  AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])

# Copyright (C) 2006-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])

# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])

# Check how to create a tarball.                            -*- Autoconf -*-

# Copyright (C) 2004-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_PROG_TAR(FORMAT)
# --------------------







|


















|







1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
  AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])

# Copyright (C) 2006-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])

# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])

# Check how to create a tarball.                            -*- Autoconf -*-

# Copyright (C) 2004-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# _AM_PROG_TAR(FORMAT)
# --------------------
Changes to jni/libressl/apps/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
  dir0=`pwd`; \
  sed_first='s,^\([^/]*\)/.*$$,\1,'; \







<
<







152
153
154
155
156
157
158


159
160
161
162
163
164
165
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
  dir0=`pwd`; \
  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
199
200
201
202
203
204
205


206
207
208
209
210
211
212
213
214
215

216
217
218
219
220
221
222
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







>
>










>







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







452
453
454
455
456
457
458

459
460
461
462
463
464
465
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
Changes to jni/libressl/apps/nc/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252


253
254
255
256
257
258
259
260
261
262

263
264
265
266
267
268
269
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







<
<



















>
>










>







225
226
227
228
229
230
231


232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







625
626
627
628
629
630
631

632
633
634
635
636
637
638
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
Changes to jni/libressl/apps/nc/nc.1.
1
2
3
4
5
6
7
8
.\"     $OpenBSD: nc.1,v 1.96 2021/03/31 20:41:35 jmc Exp $
.\"
.\" Copyright (c) 1996 David Sacerdote
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
|







1
2
3
4
5
6
7
8
.\"     $OpenBSD: nc.1,v 1.97 2022/09/11 09:58:06 schwarze Exp $
.\"
.\" Copyright (c) 1996 David Sacerdote
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 31 2021 $
.Dt NC 1
.Os
.Sh NAME
.Nm nc
.Nd arbitrary TCP and UDP connections and listens
.Sh SYNOPSIS
.Nm nc







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 11 2022 $
.Dt NC 1
.Os
.Sh NAME
.Nm nc
.Nd arbitrary TCP and UDP connections and listens
.Sh SYNOPSIS
.Nm nc
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
to the other end, and input and output can be easily captured in order to
emulate file transfer.
.Pp
Start by using
.Nm
to listen on a specific port, with output captured into a file:
.Pp
.Dl $ nc -l 1234 \*(Gt filename.out
.Pp
Using a second machine, connect to the listening
.Nm
process, feeding it the file which is to be transferred:
.Pp
.Dl $ nc -N host.example.com 1234 \*(Lt filename.in
.Pp
After the file has been transferred, the connection will close automatically.
.Sh TALKING TO SERVERS
It is sometimes useful to talk to servers
.Dq by hand
rather than through a user interface.
It can aid in troubleshooting,







|





|







438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
to the other end, and input and output can be easily captured in order to
emulate file transfer.
.Pp
Start by using
.Nm
to listen on a specific port, with output captured into a file:
.Pp
.Dl $ nc -l 1234 > filename.out
.Pp
Using a second machine, connect to the listening
.Nm
process, feeding it the file which is to be transferred:
.Pp
.Dl $ nc -N host.example.com 1234 < filename.in
.Pp
After the file has been transferred, the connection will close automatically.
.Sh TALKING TO SERVERS
It is sometimes useful to talk to servers
.Dq by hand
rather than through a user interface.
It can aid in troubleshooting,
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
.Xr sed 1 ,
if necessary.
.Pp
More complicated examples can be built up when the user knows the format
of requests required by the server.
As another example, an email may be submitted to an SMTP server using:
.Bd -literal -offset indent
$ nc localhost 25 \*(Lt\*(Lt EOF
HELO host.example.com
MAIL FROM:\*(Ltuser@host.example.com\*(Gt
RCPT TO:\*(Ltuser2@host.example.com\*(Gt
DATA
Body of email.
\&.
QUIT
EOF
.Ed
.Sh PORT SCANNING







|

|
|







468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
.Xr sed 1 ,
if necessary.
.Pp
More complicated examples can be built up when the user knows the format
of requests required by the server.
As another example, an email may be submitted to an SMTP server using:
.Bd -literal -offset indent
$ nc localhost 25 << EOF
HELO host.example.com
MAIL FROM:<user@host.example.com>
RCPT TO:<user2@host.example.com>
DATA
Body of email.
\&.
QUIT
EOF
.Ed
.Sh PORT SCANNING
Changes to jni/libressl/apps/nc/netcat.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: netcat.c,v 1.218 2021/07/12 15:09:20 beck Exp $ */
/*
 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
 * Copyright (c) 2015 Bob Beck.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
|







1
2
3
4
5
6
7
8
/* $OpenBSD: netcat.c,v 1.219 2022/06/08 20:07:31 tb Exp $ */
/*
 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
 * Copyright (c) 2015 Bob Beck.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
			warn("%s", host);
			ret = 1;
		}

		if (uflag)
			unlink(unix_dg_tmp_socket);
		return ret;

	} else {
		int i = 0;

		/* Construct the portlist[] array. */
		build_ports(uport);

		/* Cycle through portlist, connecting to each port. */







<







674
675
676
677
678
679
680

681
682
683
684
685
686
687
			warn("%s", host);
			ret = 1;
		}

		if (uflag)
			unlink(unix_dg_tmp_socket);
		return ret;

	} else {
		int i = 0;

		/* Construct the portlist[] array. */
		build_ports(uport);

		/* Cycle through portlist, connecting to each port. */
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746

				fprintf(stderr, "Connection to %s", host);

				/*
				 * if we aren't connecting thru a proxy and
				 * there is something to report, print IP
				 */
				if (!nflag && !xflag
				    && (strcmp(host, ipaddr) != 0))
					fprintf(stderr, " (%s)", ipaddr);

				fprintf(stderr, " %s port [%s/%s] succeeded!\n",
				    portlist[i], uflag ? "udp" : "tcp",
				    sv ? sv->s_name : "*");
			}
			if (Fflag)







|
|







730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745

				fprintf(stderr, "Connection to %s", host);

				/*
				 * if we aren't connecting thru a proxy and
				 * there is something to report, print IP
				 */
				if (!nflag && !xflag &&
				    strcmp(host, ipaddr) != 0)
					fprintf(stderr, " (%s)", ipaddr);

				fprintf(stderr, " %s port [%s/%s] succeeded!\n",
				    portlist[i], uflag ? "udp" : "tcp",
				    sv ? sv->s_name : "*");
			}
			if (Fflag)
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844

void
tls_setup_client(struct tls *tls_ctx, int s, char *host)
{
	const char *errstr;

	if (tls_connect_socket(tls_ctx, s,
		tls_expectname ? tls_expectname : host) == -1) {
		errx(1, "tls connection failed (%s)",
		    tls_error(tls_ctx));
	}
	if (timeout_tls(s, tls_ctx, tls_handshake) == -1) {
		if ((errstr = tls_error(tls_ctx)) == NULL)
			errstr = strerror(errno);
		errx(1, "tls handshake failed (%s)", errstr);







|







829
830
831
832
833
834
835
836
837
838
839
840
841
842
843

void
tls_setup_client(struct tls *tls_ctx, int s, char *host)
{
	const char *errstr;

	if (tls_connect_socket(tls_ctx, s,
	    tls_expectname ? tls_expectname : host) == -1) {
		errx(1, "tls connection failed (%s)",
		    tls_error(tls_ctx));
	}
	if (timeout_tls(s, tls_ctx, tls_handshake) == -1) {
		if ((errstr = tls_error(tls_ctx)) == NULL)
			errstr = strerror(errno);
		errx(1, "tls handshake failed (%s)", errstr);
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
	if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
		save_errno = errno;
		close(s);
		errno = save_errno;
		return -1;
	}
	return s;

}

/*
 * unix_listen()
 * Create a unix domain socket, and listen on it.
 */
int







<







918
919
920
921
922
923
924

925
926
927
928
929
930
931
	if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
		save_errno = errno;
		close(s);
		errno = save_errno;
		return -1;
	}
	return s;

}

/*
 * unix_listen()
 * Create a unix domain socket, and listen on it.
 */
int
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
		p++;
		obuf[2] = *p;
		if (atomicio(vwrite, nfd, obuf, 3) != 3)
			warn("Write Error!");
	}
}


int
strtoport(char *portstr, int udp)
{
	struct servent *entry;
	const char *errstr;
	char *proto;
	int port = -1;







<







1463
1464
1465
1466
1467
1468
1469

1470
1471
1472
1473
1474
1475
1476
		p++;
		obuf[2] = *p;
		if (atomicio(vwrite, nfd, obuf, 3) != 3)
			warn("Write Error!");
	}
}


int
strtoport(char *portstr, int udp)
{
	struct servent *entry;
	const char *errstr;
	char *proto;
	int port = -1;
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
set_common_sockopts(int s, int af)
{
	int x = 1;

#ifdef TCP_MD5SIG
	if (Sflag) {
		if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
			&x, sizeof(x)) == -1)
			err(1, NULL);
	}
#endif
	if (Dflag) {
		if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
			&x, sizeof(x)) == -1)
			err(1, NULL);
	}
	if (Tflag != -1) {
		if (af == AF_INET && setsockopt(s, IPPROTO_IP,
		    IP_TOS, &Tflag, sizeof(Tflag)) == -1)
			err(1, "set IP ToS");








|





|







1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
set_common_sockopts(int s, int af)
{
	int x = 1;

#ifdef TCP_MD5SIG
	if (Sflag) {
		if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
		    &x, sizeof(x)) == -1)
			err(1, NULL);
	}
#endif
	if (Dflag) {
		if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
		    &x, sizeof(x)) == -1)
			err(1, NULL);
	}
	if (Tflag != -1) {
		if (af == AF_INET && setsockopt(s, IPPROTO_IP,
		    IP_TOS, &Tflag, sizeof(Tflag)) == -1)
			err(1, "set IP ToS");

1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
	if (fprintf(fp, "%.*s", (int)plen, pem) < 0)
		err(1, "unable to save peer cert");
	if (fflush(fp) != 0)
		err(1, "unable to flush peer cert");
}

void
report_tls(struct tls * tls_ctx, char * host)
{
	time_t t;
	const char *ocsp_url;

	fprintf(stderr, "TLS handshake negotiated %s/%s with host %s\n",
	    tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host);
	fprintf(stderr, "Peer name: %s\n",







|







1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
	if (fprintf(fp, "%.*s", (int)plen, pem) < 0)
		err(1, "unable to save peer cert");
	if (fflush(fp) != 0)
		err(1, "unable to flush peer cert");
}

void
report_tls(struct tls *tls_ctx, char *host)
{
	time_t t;
	const char *ocsp_url;

	fprintf(stderr, "TLS handshake negotiated %s/%s with host %s\n",
	    tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host);
	fprintf(stderr, "Peer name: %s\n",
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787

1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
		    tls_peer_cert_hash(tls_ctx));
	ocsp_url = tls_peer_ocsp_url(tls_ctx);
	if (ocsp_url != NULL)
		fprintf(stderr, "OCSP URL: %s\n", ocsp_url);
	switch (tls_peer_ocsp_response_status(tls_ctx)) {
	case TLS_OCSP_RESPONSE_SUCCESSFUL:
		fprintf(stderr, "OCSP Stapling: %s\n",
		    tls_peer_ocsp_result(tls_ctx) == NULL ?  "" :
		    tls_peer_ocsp_result(tls_ctx));
		fprintf(stderr,
		    "  response_status=%d cert_status=%d crl_reason=%d\n",
		    tls_peer_ocsp_response_status(tls_ctx),
		    tls_peer_ocsp_cert_status(tls_ctx),
		    tls_peer_ocsp_crl_reason(tls_ctx));
		t = tls_peer_ocsp_this_update(tls_ctx);
		fprintf(stderr, "  this update: %s",
		    t != -1 ? ctime(&t) : "\n");
		t =  tls_peer_ocsp_next_update(tls_ctx);
		fprintf(stderr, "  next update: %s",
		    t != -1 ? ctime(&t) : "\n");
		t =  tls_peer_ocsp_revocation_time(tls_ctx);
		fprintf(stderr, "  revocation: %s",
		    t != -1 ? ctime(&t) : "\n");
		break;
	case -1:
		break;
	default:

		fprintf(stderr, "OCSP Stapling:  failure - response_status %d (%s)\n",
		    tls_peer_ocsp_response_status(tls_ctx),
		    tls_peer_ocsp_result(tls_ctx) == NULL ?  "" :
		    tls_peer_ocsp_result(tls_ctx));
		break;

	}
}

void
report_sock(const char *msg, const struct sockaddr *sa, socklen_t salen,
    char *path)
{







|









|


|






>
|

|


<







1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790

1791
1792
1793
1794
1795
1796
1797
		    tls_peer_cert_hash(tls_ctx));
	ocsp_url = tls_peer_ocsp_url(tls_ctx);
	if (ocsp_url != NULL)
		fprintf(stderr, "OCSP URL: %s\n", ocsp_url);
	switch (tls_peer_ocsp_response_status(tls_ctx)) {
	case TLS_OCSP_RESPONSE_SUCCESSFUL:
		fprintf(stderr, "OCSP Stapling: %s\n",
		    tls_peer_ocsp_result(tls_ctx) == NULL ? "" :
		    tls_peer_ocsp_result(tls_ctx));
		fprintf(stderr,
		    "  response_status=%d cert_status=%d crl_reason=%d\n",
		    tls_peer_ocsp_response_status(tls_ctx),
		    tls_peer_ocsp_cert_status(tls_ctx),
		    tls_peer_ocsp_crl_reason(tls_ctx));
		t = tls_peer_ocsp_this_update(tls_ctx);
		fprintf(stderr, "  this update: %s",
		    t != -1 ? ctime(&t) : "\n");
		t = tls_peer_ocsp_next_update(tls_ctx);
		fprintf(stderr, "  next update: %s",
		    t != -1 ? ctime(&t) : "\n");
		t = tls_peer_ocsp_revocation_time(tls_ctx);
		fprintf(stderr, "  revocation: %s",
		    t != -1 ? ctime(&t) : "\n");
		break;
	case -1:
		break;
	default:
		fprintf(stderr,
		    "OCSP Stapling:  failure - response_status %d (%s)\n",
		    tls_peer_ocsp_response_status(tls_ctx),
		    tls_peer_ocsp_result(tls_ctx) == NULL ? "" :
		    tls_peer_ocsp_result(tls_ctx));
		break;

	}
}

void
report_sock(const char *msg, const struct sockaddr *sa, socklen_t salen,
    char *path)
{
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828

	if (nflag)
		flags |= NI_NUMERICHOST;

	herr = getnameinfo(sa, salen, host, sizeof(host), port, sizeof(port),
	    flags);
	switch (herr) {
		case 0:
			break;
		case EAI_SYSTEM:
			err(1, "getnameinfo");
		default:
			errx(1, "getnameinfo: %s", gai_strerror(herr));
	}

	fprintf(stderr, "%s on %s %s\n", msg, host, port);
}

void
help(void)







|
|
|
|
|
|







1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825

	if (nflag)
		flags |= NI_NUMERICHOST;

	herr = getnameinfo(sa, salen, host, sizeof(host), port, sizeof(port),
	    flags);
	switch (herr) {
	case 0:
		break;
	case EAI_SYSTEM:
		err(1, "getnameinfo");
	default:
		errx(1, "getnameinfo: %s", gai_strerror(herr));
	}

	fprintf(stderr, "%s on %s %s\n", msg, host, port);
}

void
help(void)
Changes to jni/libressl/apps/nc/socks.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: socks.c,v 1.30 2019/11/04 17:33:28 millert Exp $	*/

/*
 * Copyright (c) 1999 Niklas Hallqvist.  All rights reserved.
 * Copyright (c) 2004, 2005 Damien Miller.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: socks.c,v 1.31 2022/06/08 20:20:26 djm Exp $	*/

/*
 * Copyright (c) 1999 Niklas Hallqvist.  All rights reserved.
 * Copyright (c) 2004, 2005 Damien Miller.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
			errx(1, "connection failed, SOCKSv4 error: %s",
			    socks4_strerror(buf[1]));
		}
	} else if (socksv == -1) {
		/* HTTP proxy CONNECT */

		/* Disallow bad chars in hostname */
		if (strcspn(host, "\r\n\t []:") != strlen(host))
			errx(1, "Invalid hostname");

		/* Try to be sane about numeric IPv6 addresses */
		if (strchr(host, ':') != NULL) {
			r = snprintf(buf, sizeof(buf),
			    "CONNECT [%s]:%d HTTP/1.0\r\n",
			    host, ntohs(serverport));







|







317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
			errx(1, "connection failed, SOCKSv4 error: %s",
			    socks4_strerror(buf[1]));
		}
	} else if (socksv == -1) {
		/* HTTP proxy CONNECT */

		/* Disallow bad chars in hostname */
		if (strcspn(host, "\r\n\t []") != strlen(host))
			errx(1, "Invalid hostname");

		/* Try to be sane about numeric IPv6 addresses */
		if (strchr(host, ':') != NULL) {
			r = snprintf(buf, sizeof(buf),
			    "CONNECT [%s]:%d HTTP/1.0\r\n",
			    host, ntohs(serverport));
Changes to jni/libressl/apps/ocspcheck/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241


242
243
244
245
246
247
248
249
250
251

252
253
254
255
256
257
258
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







<
<



















>
>










>







214
215
216
217
218
219
220


221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







602
603
604
605
606
607
608

609
610
611
612
613
614
615
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
Changes to jni/libressl/apps/openssl/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296


297
298
299
300
301
302
303
304
305
306

307
308
309
310
311
312
313
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







<
<



















>
>










>







269
270
271
272
273
274
275


276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







718
719
720
721
722
723
724

725
726
727
728
729
730
731
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
Changes to jni/libressl/apps/openssl/ciphers.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ciphers.c,v 1.10 2019/07/14 03:30:45 guenther Exp $ */
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ciphers.c,v 1.15 2022/07/19 20:15:19 tb Exp $ */
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
22
23
24
25
26
27
28

29

30
31
32
33
34
35
36
37
38
39
40
41
42
43






44
45
46























47
48
49
50
51
52
53
#include <openssl/ssl.h>

#include "apps.h"
#include "progs.h"

struct {
	int usage;

	int verbose;

} ciphers_config;

static const struct option ciphers_options[] = {
	{
		.name = "h",
		.type = OPTION_FLAG,
		.opt.flag = &ciphers_config.usage,
	},
	{
		.name = "?",
		.type = OPTION_FLAG,
		.opt.flag = &ciphers_config.usage,
	},
	{






		.name = "tls1",
		.desc = "This option is deprecated since it is the default",
		.type = OPTION_DISCARD,























	},
	{
		.name = "v",
		.desc = "Provide cipher listing",
		.type = OPTION_VALUE,
		.opt.value = &ciphers_config.verbose,
		.value = 1,







>

>














>
>
>
>
>
>

|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <openssl/ssl.h>

#include "apps.h"
#include "progs.h"

struct {
	int usage;
	int use_supported;
	int verbose;
	int version;
} ciphers_config;

static const struct option ciphers_options[] = {
	{
		.name = "h",
		.type = OPTION_FLAG,
		.opt.flag = &ciphers_config.usage,
	},
	{
		.name = "?",
		.type = OPTION_FLAG,
		.opt.flag = &ciphers_config.usage,
	},
	{
		.name = "s",
		.desc = "Only list ciphers that are supported by the TLS method",
		.type = OPTION_FLAG,
		.opt.flag = &ciphers_config.use_supported,
	},
	{
		.name = "tls1",
		.desc = "Use TLS protocol version 1",
		.type = OPTION_VALUE,
		.opt.value = &ciphers_config.version,
		.value = TLS1_VERSION,
	},
	{
		.name = "tls1_1",
		.desc = "Use TLS protocol version 1.1",
		.type = OPTION_VALUE,
		.opt.value = &ciphers_config.version,
		.value = TLS1_1_VERSION,
	},
	{
		.name = "tls1_2",
		.desc = "Use TLS protocol version 1.2",
		.type = OPTION_VALUE,
		.opt.value = &ciphers_config.version,
		.value = TLS1_2_VERSION,
	},
	{
		.name = "tls1_3",
		.desc = "Use TLS protocol version 1.3",
		.type = OPTION_VALUE,
		.opt.value = &ciphers_config.version,
		.value = TLS1_3_VERSION,
	},
	{
		.name = "v",
		.desc = "Provide cipher listing",
		.type = OPTION_VALUE,
		.opt.value = &ciphers_config.verbose,
		.value = 1,
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
	},
	{ NULL },
};

static void
ciphers_usage(void)
{
	fprintf(stderr, "usage: ciphers [-hVv] [-tls1] [cipherlist]\n");

	options_usage(ciphers_options);
}

int
ciphers_main(int argc, char **argv)
{
	char *cipherlist = NULL;
	STACK_OF(SSL_CIPHER) *ciphers;

	const SSL_CIPHER *cipher;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	uint16_t value;
	int i, rv = 0;
	char *desc;








|
>








>







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
	},
	{ NULL },
};

static void
ciphers_usage(void)
{
	fprintf(stderr, "usage: ciphers [-hsVv] [-tls1] [-tls1_1] [-tls1_2] "
	    "[-tls1_3] [cipherlist]\n");
	options_usage(ciphers_options);
}

int
ciphers_main(int argc, char **argv)
{
	char *cipherlist = NULL;
	STACK_OF(SSL_CIPHER) *ciphers;
	STACK_OF(SSL_CIPHER) *supported_ciphers = NULL;
	const SSL_CIPHER *cipher;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	uint16_t value;
	int i, rv = 0;
	char *desc;

97
98
99
100
101
102
103
104
105









106
107
108
109
110
111
112
113
114






115
116

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

148
149
150
151
152
	}

	if (ciphers_config.usage) {
		ciphers_usage();
		return (1);
	}

	if ((ssl_ctx = SSL_CTX_new(TLSv1_client_method())) == NULL)
		goto err;










	if (cipherlist != NULL) {
		if (SSL_CTX_set_cipher_list(ssl_ctx, cipherlist) == 0)
			goto err;
	}

	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		goto err;







	if ((ciphers = SSL_get_ciphers(ssl)) == NULL)
		goto err;


	for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
		cipher = sk_SSL_CIPHER_value(ciphers, i);
		if (ciphers_config.verbose == 0) {
			fprintf(stdout, "%s%s", (i ? ":" : ""),
			    SSL_CIPHER_get_name(cipher));
			continue;
		}
		if (ciphers_config.verbose > 1) {
			value = SSL_CIPHER_get_value(cipher);
			fprintf(stdout, "%-*s0x%02X,0x%02X - ", 10, "",
				((value >> 8) & 0xff), (value & 0xff));
		}
		desc = SSL_CIPHER_description(cipher, NULL, 0);
		if (strcmp(desc, "OPENSSL_malloc Error") == 0) {
			fprintf(stderr, "out of memory\n");
			goto err;
		}
		fprintf(stdout, "%s", desc);
		free(desc);
	}
	if (ciphers_config.verbose == 0)
		fprintf(stdout, "\n");

	goto done;

 err:
	ERR_print_errors_fp(stderr);
	rv = 1;

 done:

	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);

	return (rv);
}







|

>
>
>
>
>
>
>
>
>









>
>
>
>
>
>
|
|
>











|



















>





130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
	}

	if (ciphers_config.usage) {
		ciphers_usage();
		return (1);
	}

	if ((ssl_ctx = SSL_CTX_new(TLS_method())) == NULL)
		goto err;

	if (ciphers_config.version != 0) {
		if (!SSL_CTX_set_min_proto_version(ssl_ctx,
		    ciphers_config.version))
			goto err;
		if (!SSL_CTX_set_max_proto_version(ssl_ctx,
		    ciphers_config.version))
			goto err;
	}

	if (cipherlist != NULL) {
		if (SSL_CTX_set_cipher_list(ssl_ctx, cipherlist) == 0)
			goto err;
	}

	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		goto err;

	if (ciphers_config.use_supported) {
		if ((supported_ciphers =
		    SSL_get1_supported_ciphers(ssl)) == NULL)
			goto err;
		ciphers = supported_ciphers;
	} else {
		if ((ciphers = SSL_get_ciphers(ssl)) == NULL)
			goto err;
	}

	for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
		cipher = sk_SSL_CIPHER_value(ciphers, i);
		if (ciphers_config.verbose == 0) {
			fprintf(stdout, "%s%s", (i ? ":" : ""),
			    SSL_CIPHER_get_name(cipher));
			continue;
		}
		if (ciphers_config.verbose > 1) {
			value = SSL_CIPHER_get_value(cipher);
			fprintf(stdout, "%-*s0x%02X,0x%02X - ", 10, "",
			    ((value >> 8) & 0xff), (value & 0xff));
		}
		desc = SSL_CIPHER_description(cipher, NULL, 0);
		if (strcmp(desc, "OPENSSL_malloc Error") == 0) {
			fprintf(stderr, "out of memory\n");
			goto err;
		}
		fprintf(stdout, "%s", desc);
		free(desc);
	}
	if (ciphers_config.verbose == 0)
		fprintf(stdout, "\n");

	goto done;

 err:
	ERR_print_errors_fp(stderr);
	rv = 1;

 done:
	sk_SSL_CIPHER_free(supported_ciphers);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);

	return (rv);
}
Changes to jni/libressl/apps/openssl/openssl.1.
1
2
3
4
5
6
7
8
.\" $OpenBSD: openssl.1,v 1.137 2022/03/31 17:27:26 naddy Exp $
.\" ====================================================================
.\" Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: openssl.1,v 1.139 2022/07/19 16:08:09 tb Exp $
.\" ====================================================================
.\" Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.\" SUCH DAMAGE.
.\"
.\" The licence and distribution terms for any publically available version or
.\" derivative of this code cannot be changed.  i.e. this code cannot simply be
.\" copied and put under another distribution licence
.\" [including the GNU Public Licence.]
.\"
.Dd $Mdocdate: March 31 2022 $
.Dt OPENSSL 1
.Os
.Sh NAME
.Nm openssl
.Nd OpenSSL command line tool
.Sh SYNOPSIS
.Nm







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.\" SUCH DAMAGE.
.\"
.\" The licence and distribution terms for any publically available version or
.\" derivative of this code cannot be changed.  i.e. this code cannot simply be
.\" copied and put under another distribution licence
.\" [including the GNU Public Licence.]
.\"
.Dd $Mdocdate: July 19 2022 $
.Dt OPENSSL 1
.Os
.Sh NAME
.Nm openssl
.Nd OpenSSL command line tool
.Sh SYNOPSIS
.Nm
906
907
908
909
910
911
912


913


914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932







933
934
935
936
937
938
939
Print extra details about the processing.
.It Ar dir ...
Specify the directories to process.
.El
.Tg ciphers
.Sh CIPHERS
.Nm openssl ciphers


.Op Fl hVv


.Op Ar control
.Pp
The
.Nm ciphers
command converts the
.Ar control
string from the format documented in
.Xr SSL_CTX_set_cipher_list 3
into an ordered SSL cipher suite preference list.
If no
.Ar control
string is specified, the
.Cm DEFAULT
list is printed.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl h , \&?
Print a brief usage message.







.It Fl V
Verbose.
List ciphers with cipher suite code in hex format,
cipher name, and a complete description of protocol version,
key exchange, authentication, encryption, and mac algorithms.
.It Fl v
Like







>
>
|
>
>



















>
>
>
>
>
>
>







906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
Print extra details about the processing.
.It Ar dir ...
Specify the directories to process.
.El
.Tg ciphers
.Sh CIPHERS
.Nm openssl ciphers
.Op Fl hsVv
.Op Fl tls1
.Op Fl tls1_1
.Op Fl tls1_2
.Op Fl tls1_3
.Op Ar control
.Pp
The
.Nm ciphers
command converts the
.Ar control
string from the format documented in
.Xr SSL_CTX_set_cipher_list 3
into an ordered SSL cipher suite preference list.
If no
.Ar control
string is specified, the
.Cm DEFAULT
list is printed.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl h , \&?
Print a brief usage message.
.It Fl s
Only list ciphers that are supported by the TLS method.
.It Fl tls1 | tls1_1 | tls1_2 | tls1_3
In combination with the
.Fl s
option, list the ciphers which could be used
if the specified protocol version were negotiated.
.It Fl V
Verbose.
List ciphers with cipher suite code in hex format,
cipher name, and a complete description of protocol version,
key exchange, authentication, encryption, and mac algorithms.
.It Fl v
Like
Changes to jni/libressl/apps/openssl/pkcs12.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs12.c,v 1.18 2022/03/28 11:02:49 inoguchi Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs12.c,v 1.23 2022/09/14 16:31:36 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#define CLCERTS		0x8
#define CACERTS		0x10

static int get_cert_chain(X509 *cert, X509_STORE *store,
    STACK_OF(X509) **chain);
static int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen,
    int options, char *pempass);
static int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags,
    char *pass, int passlen, int options, char *pempass);
static int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass,
    int passlen, int options, char *pempass);
static int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst,
    const char *name);
static void hex_prin(BIO *out, unsigned char *buf, int len);
static int alg_print(BIO *x, const X509_ALGOR *alg);







|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#define CLCERTS		0x8
#define CACERTS		0x10

static int get_cert_chain(X509 *cert, X509_STORE *store,
    STACK_OF(X509) **chain);
static int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen,
    int options, char *pempass);
static int dump_certs_pkeys_bags(BIO *out, const STACK_OF(PKCS12_SAFEBAG) *bags,
    char *pass, int passlen, int options, char *pempass);
static int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass,
    int passlen, int options, char *pempass);
static int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst,
    const char *name);
static void hex_prin(BIO *out, unsigned char *buf, int len);
static int alg_print(BIO *x, const X509_ALGOR *alg);
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
	pkcs12_config.macver = 1;

	if (options_parse(argc, argv, pkcs12_options, NULL, NULL) != 0) {
		pkcs12_usage();
		goto end;
	}

	if (pkcs12_config.passarg) {
		if (pkcs12_config.export_cert)
			pkcs12_config.passargout = pkcs12_config.passarg;
		else
			pkcs12_config.passargin = pkcs12_config.passarg;
	}
	if (!app_passwd(bio_err, pkcs12_config.passargin,
	    pkcs12_config.passargout, &passin, &passout)) {
		BIO_printf(bio_err, "Error getting passwords\n");
		goto end;
	}
	if (!cpass) {
		if (pkcs12_config.export_cert)
			cpass = passout;
		else
			cpass = passin;
	}
	if (cpass) {
		mpass = cpass;
		pkcs12_config.noprompt = 1;
	} else {
		cpass = pass;
		mpass = macpass;
	}

	if (!pkcs12_config.infile)
		in = BIO_new_fp(stdin, BIO_NOCLOSE);
	else
		in = BIO_new_file(pkcs12_config.infile, "rb");
	if (!in) {
		BIO_printf(bio_err, "Error opening input file %s\n",
		    pkcs12_config.infile ? pkcs12_config.infile : "<stdin>");
		perror(pkcs12_config.infile);
		goto end;
	}

	if (!pkcs12_config.outfile) {
		out = BIO_new_fp(stdout, BIO_NOCLOSE);
	} else
		out = BIO_new_file(pkcs12_config.outfile, "wb");
	if (!out) {
		BIO_printf(bio_err, "Error opening output file %s\n",
		    pkcs12_config.outfile ? pkcs12_config.outfile : "<stdout>");
		perror(pkcs12_config.outfile);
		goto end;
	}
	if (pkcs12_config.twopass) {
		if (EVP_read_pw_string(macpass, sizeof macpass,







|










|





|







|



|






|



|







552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
	pkcs12_config.macver = 1;

	if (options_parse(argc, argv, pkcs12_options, NULL, NULL) != 0) {
		pkcs12_usage();
		goto end;
	}

	if (pkcs12_config.passarg != NULL) {
		if (pkcs12_config.export_cert)
			pkcs12_config.passargout = pkcs12_config.passarg;
		else
			pkcs12_config.passargin = pkcs12_config.passarg;
	}
	if (!app_passwd(bio_err, pkcs12_config.passargin,
	    pkcs12_config.passargout, &passin, &passout)) {
		BIO_printf(bio_err, "Error getting passwords\n");
		goto end;
	}
	if (cpass == NULL) {
		if (pkcs12_config.export_cert)
			cpass = passout;
		else
			cpass = passin;
	}
	if (cpass != NULL) {
		mpass = cpass;
		pkcs12_config.noprompt = 1;
	} else {
		cpass = pass;
		mpass = macpass;
	}

	if (pkcs12_config.infile == NULL)
		in = BIO_new_fp(stdin, BIO_NOCLOSE);
	else
		in = BIO_new_file(pkcs12_config.infile, "rb");
	if (in == NULL) {
		BIO_printf(bio_err, "Error opening input file %s\n",
		    pkcs12_config.infile ? pkcs12_config.infile : "<stdin>");
		perror(pkcs12_config.infile);
		goto end;
	}

	if (pkcs12_config.outfile == NULL) {
		out = BIO_new_fp(stdout, BIO_NOCLOSE);
	} else
		out = BIO_new_file(pkcs12_config.outfile, "wb");
	if (out == NULL) {
		BIO_printf(bio_err, "Error opening output file %s\n",
		    pkcs12_config.outfile ? pkcs12_config.outfile : "<stdout>");
		perror(pkcs12_config.outfile);
		goto end;
	}
	if (pkcs12_config.twopass) {
		if (EVP_read_pw_string(macpass, sizeof macpass,
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
				goto export_end;
		}

		/* Load in all certs in input file */
		if (!(pkcs12_config.options & NOCERTS)) {
			certs = load_certs(bio_err, pkcs12_config.infile,
			    FORMAT_PEM, NULL, "certificates");
			if (!certs)
				goto export_end;

			if (key) {
				/* Look for matching private key */
				for (i = 0; i < sk_X509_num(certs); i++) {
					x = sk_X509_value(certs, i);
					if (X509_check_private_key(x, key)) {
						ucert = x;
						/* Zero keyid and alias */
						X509_keyid_set1(ucert, NULL, 0);
						X509_alias_set1(ucert, NULL, 0);
						/* Remove from list */
						(void) sk_X509_delete(certs, i);
						break;
					}
				}
				if (!ucert) {
					BIO_printf(bio_err,
					    "No certificate matches private key\n");
					goto export_end;
				}
			}
		}

		/* Add any more certificates asked for */
		if (pkcs12_config.certfile) {
			STACK_OF(X509) *morecerts = NULL;
			if (!(morecerts = load_certs(bio_err,
			    pkcs12_config.certfile, FORMAT_PEM, NULL,
			    "certificates from certfile")))
				goto export_end;
			while (sk_X509_num(morecerts) > 0)
				sk_X509_push(certs, sk_X509_shift(morecerts));
			sk_X509_free(morecerts);
		}


		/* If chaining get chain from user cert */
		if (pkcs12_config.chain) {
			int vret;
			STACK_OF(X509) *chain2;
			X509_STORE *store = X509_STORE_new();
			if (!store) {
				BIO_printf(bio_err,
				    "Memory allocation error\n");
				goto export_end;
			}
			if (!X509_STORE_load_locations(store,
			    pkcs12_config.CAfile, pkcs12_config.CApath))
				X509_STORE_set_default_paths(store);







|


|













|








|

|

|












|







633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
				goto export_end;
		}

		/* Load in all certs in input file */
		if (!(pkcs12_config.options & NOCERTS)) {
			certs = load_certs(bio_err, pkcs12_config.infile,
			    FORMAT_PEM, NULL, "certificates");
			if (certs == NULL)
				goto export_end;

			if (key != NULL) {
				/* Look for matching private key */
				for (i = 0; i < sk_X509_num(certs); i++) {
					x = sk_X509_value(certs, i);
					if (X509_check_private_key(x, key)) {
						ucert = x;
						/* Zero keyid and alias */
						X509_keyid_set1(ucert, NULL, 0);
						X509_alias_set1(ucert, NULL, 0);
						/* Remove from list */
						(void) sk_X509_delete(certs, i);
						break;
					}
				}
				if (ucert == NULL) {
					BIO_printf(bio_err,
					    "No certificate matches private key\n");
					goto export_end;
				}
			}
		}

		/* Add any more certificates asked for */
		if (pkcs12_config.certfile != NULL) {
			STACK_OF(X509) *morecerts = NULL;
			if ((morecerts = load_certs(bio_err,
			    pkcs12_config.certfile, FORMAT_PEM, NULL,
			    "certificates from certfile")) == NULL)
				goto export_end;
			while (sk_X509_num(morecerts) > 0)
				sk_X509_push(certs, sk_X509_shift(morecerts));
			sk_X509_free(morecerts);
		}


		/* If chaining get chain from user cert */
		if (pkcs12_config.chain) {
			int vret;
			STACK_OF(X509) *chain2;
			X509_STORE *store = X509_STORE_new();
			if (store == NULL) {
				BIO_printf(bio_err,
				    "Memory allocation error\n");
				goto export_end;
			}
			if (!X509_STORE_load_locations(store,
			    pkcs12_config.CAfile, pkcs12_config.CApath))
				X509_STORE_set_default_paths(store);
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
		for (i = 0; i < sk_OPENSSL_STRING_num(pkcs12_config.canames);
		    i++) {
			catmp = (unsigned char *) sk_OPENSSL_STRING_value(
			    pkcs12_config.canames, i);
			X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
		}

		if (pkcs12_config.csp_name && key)
			EVP_PKEY_add1_attr_by_NID(key, NID_ms_csp_name,
			    MBSTRING_ASC,
			    (unsigned char *) pkcs12_config.csp_name, -1);

		if (pkcs12_config.add_lmk && key)
			EVP_PKEY_add1_attr_by_NID(key, NID_LocalKeySet, 0, NULL,
			    -1);

		if (!pkcs12_config.noprompt &&
		    EVP_read_pw_string(pass, sizeof pass,
		    "Enter Export Password:", 1)) {
			BIO_printf(bio_err, "Can't read Password\n");
			goto export_end;
		}
		if (!pkcs12_config.twopass)
			strlcpy(macpass, pass, sizeof macpass);


		p12 = PKCS12_create(cpass, pkcs12_config.name, key, ucert,
		    certs, pkcs12_config.key_pbe, pkcs12_config.cert_pbe,
		    pkcs12_config.iter, -1, pkcs12_config.keytype);

		if (!p12) {
			ERR_print_errors(bio_err);
			goto export_end;
		}
		if (pkcs12_config.macalg) {
			macmd = EVP_get_digestbyname(pkcs12_config.macalg);
			if (!macmd) {
				BIO_printf(bio_err,
				    "Unknown digest algorithm %s\n",
				    pkcs12_config.macalg);
			}
		}
		if (pkcs12_config.maciter != -1)
			PKCS12_set_mac(p12, mpass, -1, NULL, 0,







|




|

















|



|

|







716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
		for (i = 0; i < sk_OPENSSL_STRING_num(pkcs12_config.canames);
		    i++) {
			catmp = (unsigned char *) sk_OPENSSL_STRING_value(
			    pkcs12_config.canames, i);
			X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
		}

		if (pkcs12_config.csp_name != NULL && key != NULL)
			EVP_PKEY_add1_attr_by_NID(key, NID_ms_csp_name,
			    MBSTRING_ASC,
			    (unsigned char *) pkcs12_config.csp_name, -1);

		if (pkcs12_config.add_lmk && key != NULL)
			EVP_PKEY_add1_attr_by_NID(key, NID_LocalKeySet, 0, NULL,
			    -1);

		if (!pkcs12_config.noprompt &&
		    EVP_read_pw_string(pass, sizeof pass,
		    "Enter Export Password:", 1)) {
			BIO_printf(bio_err, "Can't read Password\n");
			goto export_end;
		}
		if (!pkcs12_config.twopass)
			strlcpy(macpass, pass, sizeof macpass);


		p12 = PKCS12_create(cpass, pkcs12_config.name, key, ucert,
		    certs, pkcs12_config.key_pbe, pkcs12_config.cert_pbe,
		    pkcs12_config.iter, -1, pkcs12_config.keytype);

		if (p12 == NULL) {
			ERR_print_errors(bio_err);
			goto export_end;
		}
		if (pkcs12_config.macalg != NULL) {
			macmd = EVP_get_digestbyname(pkcs12_config.macalg);
			if (macmd == NULL) {
				BIO_printf(bio_err,
				    "Unknown digest algorithm %s\n",
				    pkcs12_config.macalg);
			}
		}
		if (pkcs12_config.maciter != -1)
			PKCS12_set_mac(p12, mpass, -1, NULL, 0,
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787



788
789

790
791
792
793
794
795
796
		EVP_PKEY_free(key);
		sk_X509_pop_free(certs, X509_free);
		X509_free(ucert);

		goto end;

	}
	if (!(p12 = d2i_PKCS12_bio(in, NULL))) {
		ERR_print_errors(bio_err);
		goto end;
	}
	if (!pkcs12_config.noprompt && EVP_read_pw_string(pass, sizeof pass,
	    "Enter Import Password:", 0)) {
		BIO_printf(bio_err, "Can't read Password\n");
		goto end;
	}

	if (!pkcs12_config.twopass)
		strlcpy(macpass, pass, sizeof macpass);

	if ((pkcs12_config.options & INFO) && p12->mac)



		BIO_printf(bio_err, "MAC Iteration %ld\n",
		    p12->mac->iter ? ASN1_INTEGER_get(p12->mac->iter) : 1);

	if (pkcs12_config.macver) {
		/* If we enter empty password try no password first */
		if (!mpass[0] && PKCS12_verify_mac(p12, NULL, 0)) {
			/* If mac and crypto pass the same set it to NULL too */
			if (!pkcs12_config.twopass)
				cpass = NULL;
		} else if (!PKCS12_verify_mac(p12, mpass, -1)) {







|












|
>
>
>

|
>







767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
		EVP_PKEY_free(key);
		sk_X509_pop_free(certs, X509_free);
		X509_free(ucert);

		goto end;

	}
	if ((p12 = d2i_PKCS12_bio(in, NULL)) == NULL) {
		ERR_print_errors(bio_err);
		goto end;
	}
	if (!pkcs12_config.noprompt && EVP_read_pw_string(pass, sizeof pass,
	    "Enter Import Password:", 0)) {
		BIO_printf(bio_err, "Can't read Password\n");
		goto end;
	}

	if (!pkcs12_config.twopass)
		strlcpy(macpass, pass, sizeof macpass);

	if ((pkcs12_config.options & INFO) != 0 && PKCS12_mac_present(p12)) {
		const ASN1_INTEGER *iter;

		PKCS12_get0_mac(NULL, NULL, NULL, &iter, p12);
		BIO_printf(bio_err, "MAC Iteration %ld\n",
		    iter != NULL ? ASN1_INTEGER_get(iter) : 1);
	}
	if (pkcs12_config.macver) {
		/* If we enter empty password try no password first */
		if (!mpass[0] && PKCS12_verify_mac(p12, NULL, 0)) {
			/* If mac and crypto pass the same set it to NULL too */
			if (!pkcs12_config.twopass)
				cpass = NULL;
		} else if (!PKCS12_verify_mac(p12, mpass, -1)) {
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890

891

892



893
894
895
896
897
898

899
900
901
902
903
904
905
906

907



908

909
910
911


912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929

930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
{
	STACK_OF(PKCS7) *asafes = NULL;
	STACK_OF(PKCS12_SAFEBAG) *bags;
	int i, bagnid;
	int ret = 0;
	PKCS7 *p7;

	if (!(asafes = PKCS12_unpack_authsafes(p12)))
		return 0;
	for (i = 0; i < sk_PKCS7_num(asafes); i++) {
		p7 = sk_PKCS7_value(asafes, i);
		bagnid = OBJ_obj2nid(p7->type);
		if (bagnid == NID_pkcs7_data) {
			bags = PKCS12_unpack_p7data(p7);
			if (options & INFO)
				BIO_printf(bio_err, "PKCS7 Data\n");
		} else if (bagnid == NID_pkcs7_encrypted) {
			if (options & INFO) {
				BIO_printf(bio_err, "PKCS7 Encrypted data: ");
				alg_print(bio_err,
				    p7->d.encrypted->enc_data->algorithm);
			}
			bags = PKCS12_unpack_p7encdata(p7, pass, passlen);
		} else
			continue;
		if (!bags)
			goto err;
		if (!dump_certs_pkeys_bags(out, bags, pass, passlen,
			options, pempass)) {
			sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
			goto err;
		}
		sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
		bags = NULL;
	}
	ret = 1;

 err:
	sk_PKCS7_pop_free(asafes, PKCS7_free);
	return ret;
}

static int
dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, char *pass,
    int passlen, int options, char *pempass)
{
	int i;

	for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) {
		if (!dump_certs_pkeys_bag(out,
			sk_PKCS12_SAFEBAG_value(bags, i),
			pass, passlen,
			options, pempass))
			return 0;
	}
	return 1;
}

static int
dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass, int passlen,
    int options, char *pempass)
{
	EVP_PKEY *pkey;
	PKCS8_PRIV_KEY_INFO *p8;
	X509 *x509;


	switch (OBJ_obj2nid(bag->type)) {

	case NID_keyBag:



		if (options & INFO)
			BIO_printf(bio_err, "Key bag\n");
		if (options & NOKEYS)
			return 1;
		print_attribs(out, bag->attrib, "Bag Attributes");
		p8 = bag->value.keybag;

		if ((pkey = EVP_PKCS82PKEY(p8)) == NULL)
			return 0;
		print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
		PEM_write_bio_PrivateKey(out, pkey, pkcs12_config.enc, NULL, 0,
		    NULL, pempass);
		EVP_PKEY_free(pkey);
		break;


	case NID_pkcs8ShroudedKeyBag:



		if (options & INFO) {

			const X509_ALGOR *tp8alg;

			BIO_printf(bio_err, "Shrouded Keybag: ");


			X509_SIG_get0(bag->value.shkeybag, &tp8alg, NULL);
			alg_print(bio_err, tp8alg);
		}
		if (options & NOKEYS)
			return 1;
		print_attribs(out, bag->attrib, "Bag Attributes");
		if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen)))
			return 0;
		if (!(pkey = EVP_PKCS82PKEY(p8))) {
			PKCS8_PRIV_KEY_INFO_free(p8);
			return 0;
		}
		print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
		PKCS8_PRIV_KEY_INFO_free(p8);
		PEM_write_bio_PrivateKey(out, pkey, pkcs12_config.enc, NULL, 0,
		    NULL, pempass);
		EVP_PKEY_free(pkey);
		break;


	case NID_certBag:
		if (options & INFO)
			BIO_printf(bio_err, "Certificate bag\n");
		if (options & NOCERTS)
			return 1;
		if (PKCS12_get_attr(bag, NID_localKeyID)) {
			if (options & CACERTS)
				return 1;
		} else if (options & CLCERTS)
			return 1;
		print_attribs(out, bag->attrib, "Bag Attributes");
		if (OBJ_obj2nid(bag->value.bag->type) != NID_x509Certificate)
			return 1;
		if (!(x509 = PKCS12_certbag2x509(bag)))
			return 0;
		dump_cert_text(out, x509);
		PEM_write_bio_X509(out, x509);
		X509_free(x509);
		break;

	case NID_safeContentsBag:
		if (options & INFO)
			BIO_printf(bio_err, "Safe Contents bag\n");
		print_attribs(out, bag->attrib, "Bag Attributes");
		return dump_certs_pkeys_bags(out, bag->value.safes, pass,
		    passlen, options, pempass);

	default:
		BIO_printf(bio_err, "Warning unsupported bag type: ");
		i2a_ASN1_OBJECT(bio_err, bag->type);
		BIO_printf(bio_err, "\n");
		return 1;
		break;
	}
	return 1;
}








|

















|

















|
|


















|


>
|
>

>
>
>




|
|
>







|
>

>
>
>

>



>
>
|




|
|

|









>






|




|
|

|









|
|
|



|







829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
{
	STACK_OF(PKCS7) *asafes = NULL;
	STACK_OF(PKCS12_SAFEBAG) *bags;
	int i, bagnid;
	int ret = 0;
	PKCS7 *p7;

	if ((asafes = PKCS12_unpack_authsafes(p12)) == NULL)
		return 0;
	for (i = 0; i < sk_PKCS7_num(asafes); i++) {
		p7 = sk_PKCS7_value(asafes, i);
		bagnid = OBJ_obj2nid(p7->type);
		if (bagnid == NID_pkcs7_data) {
			bags = PKCS12_unpack_p7data(p7);
			if (options & INFO)
				BIO_printf(bio_err, "PKCS7 Data\n");
		} else if (bagnid == NID_pkcs7_encrypted) {
			if (options & INFO) {
				BIO_printf(bio_err, "PKCS7 Encrypted data: ");
				alg_print(bio_err,
				    p7->d.encrypted->enc_data->algorithm);
			}
			bags = PKCS12_unpack_p7encdata(p7, pass, passlen);
		} else
			continue;
		if (bags == NULL)
			goto err;
		if (!dump_certs_pkeys_bags(out, bags, pass, passlen,
			options, pempass)) {
			sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
			goto err;
		}
		sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
		bags = NULL;
	}
	ret = 1;

 err:
	sk_PKCS7_pop_free(asafes, PKCS7_free);
	return ret;
}

static int
dump_certs_pkeys_bags(BIO *out, const STACK_OF(PKCS12_SAFEBAG) *bags,
    char *pass, int passlen, int options, char *pempass)
{
	int i;

	for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) {
		if (!dump_certs_pkeys_bag(out,
			sk_PKCS12_SAFEBAG_value(bags, i),
			pass, passlen,
			options, pempass))
			return 0;
	}
	return 1;
}

static int
dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass, int passlen,
    int options, char *pempass)
{
	EVP_PKEY *pkey;
	const STACK_OF(X509_ATTRIBUTE) *attrs;
	X509 *x509;

	attrs = PKCS12_SAFEBAG_get0_attrs(bag);

	switch (PKCS12_SAFEBAG_get_nid(bag)) {
	case NID_keyBag:
	    {
		const PKCS8_PRIV_KEY_INFO *p8;

		if (options & INFO)
			BIO_printf(bio_err, "Key bag\n");
		if (options & NOKEYS)
			return 1;
		print_attribs(out, attrs, "Bag Attributes");
		if ((p8 = PKCS12_SAFEBAG_get0_p8inf(bag)) == NULL)
			return 0;
		if ((pkey = EVP_PKCS82PKEY(p8)) == NULL)
			return 0;
		print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
		PEM_write_bio_PrivateKey(out, pkey, pkcs12_config.enc, NULL, 0,
		    NULL, pempass);
		EVP_PKEY_free(pkey);
		break;
	    }

	case NID_pkcs8ShroudedKeyBag:
	    {
		PKCS8_PRIV_KEY_INFO *p8;

		if (options & INFO) {
			const X509_SIG *tp8;
			const X509_ALGOR *tp8alg;

			BIO_printf(bio_err, "Shrouded Keybag: ");
			if ((tp8 = PKCS12_SAFEBAG_get0_pkcs8(bag)) == NULL)
				return 0;
			X509_SIG_get0(tp8, &tp8alg, NULL);
			alg_print(bio_err, tp8alg);
		}
		if (options & NOKEYS)
			return 1;
		print_attribs(out, attrs, "Bag Attributes");
		if ((p8 = PKCS12_decrypt_skey(bag, pass, passlen)) == NULL)
			return 0;
		if ((pkey = EVP_PKCS82PKEY(p8)) == NULL) {
			PKCS8_PRIV_KEY_INFO_free(p8);
			return 0;
		}
		print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
		PKCS8_PRIV_KEY_INFO_free(p8);
		PEM_write_bio_PrivateKey(out, pkey, pkcs12_config.enc, NULL, 0,
		    NULL, pempass);
		EVP_PKEY_free(pkey);
		break;
	    }

	case NID_certBag:
		if (options & INFO)
			BIO_printf(bio_err, "Certificate bag\n");
		if (options & NOCERTS)
			return 1;
		if (PKCS12_SAFEBAG_get0_attr(bag, NID_localKeyID) != NULL) {
			if (options & CACERTS)
				return 1;
		} else if (options & CLCERTS)
			return 1;
		print_attribs(out, attrs, "Bag Attributes");
		if (PKCS12_SAFEBAG_get_bag_nid(bag) != NID_x509Certificate)
			return 1;
		if ((x509 = PKCS12_certbag2x509(bag)) == NULL)
			return 0;
		dump_cert_text(out, x509);
		PEM_write_bio_X509(out, x509);
		X509_free(x509);
		break;

	case NID_safeContentsBag:
		if (options & INFO)
			BIO_printf(bio_err, "Safe Contents bag\n");
		print_attribs(out, attrs, "Bag Attributes");
		return dump_certs_pkeys_bags(out, PKCS12_SAFEBAG_get0_safes(bag),
		    pass, passlen, options, pempass);

	default:
		BIO_printf(bio_err, "Warning unsupported bag type: ");
		i2a_ASN1_OBJECT(bio_err, PKCS12_SAFEBAG_get0_type(bag));
		BIO_printf(bio_err, "\n");
		return 1;
		break;
	}
	return 1;
}

995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
alg_print(BIO *x, const X509_ALGOR *alg)
{
	PBEPARAM *pbe;
	const unsigned char *p;

	p = alg->parameter->value.sequence->data;
	pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length);
	if (!pbe)
		return 1;
	BIO_printf(bio_err, "%s, Iteration %ld\n",
	    OBJ_nid2ln(OBJ_obj2nid(alg->algorithm)),
	    ASN1_INTEGER_get(pbe->iter));
	PBEPARAM_free(pbe);
	return 1;
}







|







1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
alg_print(BIO *x, const X509_ALGOR *alg)
{
	PBEPARAM *pbe;
	const unsigned char *p;

	p = alg->parameter->value.sequence->data;
	pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length);
	if (pbe == NULL)
		return 1;
	BIO_printf(bio_err, "%s, Iteration %ld\n",
	    OBJ_nid2ln(OBJ_obj2nid(alg->algorithm)),
	    ASN1_INTEGER_get(pbe->iter));
	PBEPARAM_free(pbe);
	return 1;
}
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst,
    const char *name)
{
	X509_ATTRIBUTE *attr;
	ASN1_TYPE *av;
	int i, j, attr_nid;

	if (!attrlst) {
		BIO_printf(out, "%s: <No Attributes>\n", name);
		return 1;
	}
	if (!sk_X509_ATTRIBUTE_num(attrlst)) {
		BIO_printf(out, "%s: <Empty Attributes>\n", name);
		return 1;
	}







|







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst,
    const char *name)
{
	X509_ATTRIBUTE *attr;
	ASN1_TYPE *av;
	int i, j, attr_nid;

	if (attrlst == NULL) {
		BIO_printf(out, "%s: <No Attributes>\n", name);
		return 1;
	}
	if (!sk_X509_ATTRIBUTE_num(attrlst)) {
		BIO_printf(out, "%s: <Empty Attributes>\n", name);
		return 1;
	}
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
	for (i = 0; i < len; i++)
		BIO_printf(out, "%02X ", buf[i]);
}

static int
set_pbe(BIO *err, int *ppbe, const char *str)
{
	if (!str)
		return 0;
	if (!strcmp(str, "NONE")) {
		*ppbe = -1;
		return 1;
	}
	*ppbe = OBJ_txt2nid(str);
	if (*ppbe == NID_undef) {
		BIO_printf(bio_err, "Unknown PBE algorithm %s\n", str);
		return 0;
	}
	return 1;
}

#endif







|

|












1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
	for (i = 0; i < len; i++)
		BIO_printf(out, "%02X ", buf[i]);
}

static int
set_pbe(BIO *err, int *ppbe, const char *str)
{
	if (str == NULL)
		return 0;
	if (strcmp(str, "NONE") == 0) {
		*ppbe = -1;
		return 1;
	}
	*ppbe = OBJ_txt2nid(str);
	if (*ppbe == NID_undef) {
		BIO_printf(bio_err, "Unknown PBE algorithm %s\n", str);
		return 0;
	}
	return 1;
}

#endif
Changes to jni/libressl/apps/openssl/s_cb.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: s_cb.c,v 1.18 2022/02/03 18:40:34 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: s_cb.c,v 1.20 2022/08/31 07:12:30 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
260
261
262
263
264
265
266

267
268
269
270
271
272
273
274
275
276
277
278
279




280
281
282
283
284
285
286
287
288
289
290
291
292
293

294
295
296
297
298
299
300

int
ssl_print_tmp_key(BIO *out, SSL *s)
{
	const char *cname;
	EVP_PKEY *pkey;
	EC_KEY *ec;

	int nid;

	if (!SSL_get_server_tmp_key(s, &pkey))
		return 0;

	BIO_puts(out, "Server Temp Key: ");
	switch (EVP_PKEY_id(pkey)) {
	case EVP_PKEY_DH:
		BIO_printf(out, "DH, %d bits\n", EVP_PKEY_bits(pkey));
		break;

	case EVP_PKEY_EC:
		ec = EVP_PKEY_get1_EC_KEY(pkey);




		nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec));
		EC_KEY_free(ec);

		if ((cname = EC_curve_nid2nist(nid)) == NULL)
			cname = OBJ_nid2sn(nid);

		BIO_printf(out, "ECDH, %s, %d bits\n", cname, EVP_PKEY_bits(pkey));
		break;

	default:
		BIO_printf(out, "%s, %d bits\n", OBJ_nid2sn(EVP_PKEY_id(pkey)),
		    EVP_PKEY_bits(pkey));
	}


	EVP_PKEY_free(pkey);
	return 1;
}

long
bio_dump_callback(BIO * bio, int cmd, const char *argp,
    int argi, long argl, long ret)







>












|
>
>
>
>
|
<












>







260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285

286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305

int
ssl_print_tmp_key(BIO *out, SSL *s)
{
	const char *cname;
	EVP_PKEY *pkey;
	EC_KEY *ec;
	const EC_GROUP *group;
	int nid;

	if (!SSL_get_server_tmp_key(s, &pkey))
		return 0;

	BIO_puts(out, "Server Temp Key: ");
	switch (EVP_PKEY_id(pkey)) {
	case EVP_PKEY_DH:
		BIO_printf(out, "DH, %d bits\n", EVP_PKEY_bits(pkey));
		break;

	case EVP_PKEY_EC:
		if ((ec = EVP_PKEY_get0_EC_KEY(pkey)) == NULL)
			goto err;
		if ((group = EC_KEY_get0_group(ec)) == NULL)
			goto err;

		nid = EC_GROUP_get_curve_name(group);


		if ((cname = EC_curve_nid2nist(nid)) == NULL)
			cname = OBJ_nid2sn(nid);

		BIO_printf(out, "ECDH, %s, %d bits\n", cname, EVP_PKEY_bits(pkey));
		break;

	default:
		BIO_printf(out, "%s, %d bits\n", OBJ_nid2sn(EVP_PKEY_id(pkey)),
		    EVP_PKEY_bits(pkey));
	}

 err:
	EVP_PKEY_free(pkey);
	return 1;
}

long
bio_dump_callback(BIO * bio, int cmd, const char *argp,
    int argi, long argl, long ret)
910
911
912
913
914
915
916
917
918




919
920
921
922
923
924
925
926
		break;
	default:
		OPENSSL_assert(0);
		break;
	}

	/* Calculate HMAC of buffer using the secret */
	HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
	    buffer, length, result, &resultlength);




	free(buffer);

	if (cookie_len == resultlength &&
	    memcmp(result, cookie, resultlength) == 0)
		return 1;

	return 0;
}







|
|
>
>
>
>








915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
		break;
	default:
		OPENSSL_assert(0);
		break;
	}

	/* Calculate HMAC of buffer using the secret */
	if (HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
	    buffer, length, result, &resultlength) == NULL) {
		free(buffer);
		return 0;
	}

	free(buffer);

	if (cookie_len == resultlength &&
	    memcmp(result, cookie, resultlength) == 0)
		return 1;

	return 0;
}
Changes to jni/libressl/apps/openssl/s_time.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: s_time.c,v 1.34 2019/07/14 03:30:46 guenther Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: s_time.c,v 1.35 2022/08/31 12:29:08 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
		}
	}
	totalTime = app_timer_user(TM_GET);

	printf("\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n",
	    nConn, totalTime, ((double) nConn / totalTime), bytes_read);
	printf("%d connections in %.0f real seconds, %ld bytes read per connection\n",
	    nConn,
	    elapsed,
	    bytes_read / nConn);

	ret = 0;
 end:
	SSL_free(scon);
	return ret;
}







<
<
|






454
455
456
457
458
459
460


461
462
463
464
465
466
467
		}
	}
	totalTime = app_timer_user(TM_GET);

	printf("\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n",
	    nConn, totalTime, ((double) nConn / totalTime), bytes_read);
	printf("%d connections in %.0f real seconds, %ld bytes read per connection\n",


	    nConn, elapsed, nConn > 0 ? bytes_read / nConn : 0);

	ret = 0;
 end:
	SSL_free(scon);
	return ret;
}
Changes to jni/libressl/apps/openssl/ts.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts.c,v 1.23 2022/03/27 00:37:10 inoguchi Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts.c,v 1.24 2022/09/11 18:08:17 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
	/* Creating response object. */
	if ((resp = TS_RESP_new()) == NULL)
		goto end;

	/* Create granted status info. */
	if ((si = TS_STATUS_INFO_new()) == NULL)
		goto end;
	if (!(ASN1_INTEGER_set(si->status, TS_STATUS_GRANTED)))
		goto end;
	if (!TS_RESP_set_status_info(resp, si))
		goto end;

	/* Setting encapsulated token. */
	TS_RESP_set_tst_info(resp, token, tst_info);
	token = NULL;		/* Ownership is lost. */







|







866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
	/* Creating response object. */
	if ((resp = TS_RESP_new()) == NULL)
		goto end;

	/* Create granted status info. */
	if ((si = TS_STATUS_INFO_new()) == NULL)
		goto end;
	if (!TS_STATUS_INFO_set_status(si, TS_STATUS_GRANTED))
		goto end;
	if (!TS_RESP_set_status_info(resp, si))
		goto end;

	/* Setting encapsulated token. */
	TS_RESP_set_tst_info(resp, token, tst_info);
	token = NULL;		/* Ownership is lost. */
1114
1115
1116
1117
1118
1119
1120


1121
1122
1123
1124
1125
1126
1127


1128
1129
1130

1131

1132

1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160

1161
1162
1163
1164
1165


1166
1167
1168
1169
1170
1171
1172
static TS_VERIFY_CTX *
create_verify_ctx(char *data, char *digest, char *queryfile, char *ca_path,
    char *ca_file, char *untrusted)
{
	TS_VERIFY_CTX *ctx = NULL;
	BIO *input = NULL;
	TS_REQ *request = NULL;


	int ret = 0;

	if (data != NULL || digest != NULL) {
		if ((ctx = TS_VERIFY_CTX_new()) == NULL)
			goto err;
		ctx->flags = TS_VFY_VERSION | TS_VFY_SIGNER;
		if (data != NULL) {


			ctx->flags |= TS_VFY_DATA;
			if ((ctx->data = BIO_new_file(data, "rb")) == NULL)
				goto err;

		} else if (digest != NULL) {

			long imprint_len;

			ctx->flags |= TS_VFY_IMPRINT;
			if ((ctx->imprint = string_to_hex(digest,
				    &imprint_len)) == NULL) {
				BIO_printf(bio_err, "invalid digest string\n");
				goto err;
			}
			ctx->imprint_len = imprint_len;
		}
	} else if (queryfile != NULL) {
		/*
		 * The request has just to be read, decoded and converted to
		 * a verify context object.
		 */
		if ((input = BIO_new_file(queryfile, "rb")) == NULL)
			goto err;
		if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL)
			goto err;
		if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL)
			goto err;
	} else
		return NULL;

	/* Add the signature verification flag and arguments. */
	ctx->flags |= TS_VFY_SIGNATURE;

	/* Initialising the X509_STORE object. */
	if ((ctx->store = create_cert_store(ca_path, ca_file)) == NULL)
		goto err;


	/* Loading untrusted certificates. */
	if (untrusted != NULL &&
	    (ctx->certs = TS_CONF_load_certs(untrusted)) == NULL)
		goto err;



	ret = 1;
 err:
	if (!ret) {
		TS_VERIFY_CTX_free(ctx);
		ctx = NULL;
	}







>
>





|

>
>
|
|

>

>

>
|
|
|



|
















|


|

>


|
|
|
>
>







1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
static TS_VERIFY_CTX *
create_verify_ctx(char *data, char *digest, char *queryfile, char *ca_path,
    char *ca_file, char *untrusted)
{
	TS_VERIFY_CTX *ctx = NULL;
	BIO *input = NULL;
	TS_REQ *request = NULL;
	X509_STORE *store;
	STACK_OF(X509) *certs;
	int ret = 0;

	if (data != NULL || digest != NULL) {
		if ((ctx = TS_VERIFY_CTX_new()) == NULL)
			goto err;
		TS_VERIFY_CTX_set_flags(ctx, TS_VFY_VERSION | TS_VFY_SIGNER);
		if (data != NULL) {
			BIO *data_bio;

			TS_VERIFY_CTX_add_flags(ctx, TS_VFY_DATA);
			if ((data_bio = BIO_new_file(data, "rb")) == NULL)
				goto err;
			TS_VERIFY_CTX_set_data(ctx, data_bio);
		} else if (digest != NULL) {
			unsigned char *imprint;
			long imprint_len;

			TS_VERIFY_CTX_add_flags(ctx, TS_VFY_IMPRINT);
			if ((imprint = string_to_hex(digest,
			    &imprint_len)) == NULL) {
				BIO_printf(bio_err, "invalid digest string\n");
				goto err;
			}
			TS_VERIFY_CTX_set_imprint(ctx, imprint, imprint_len);
		}
	} else if (queryfile != NULL) {
		/*
		 * The request has just to be read, decoded and converted to
		 * a verify context object.
		 */
		if ((input = BIO_new_file(queryfile, "rb")) == NULL)
			goto err;
		if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL)
			goto err;
		if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL)
			goto err;
	} else
		return NULL;

	/* Add the signature verification flag and arguments. */
	TS_VERIFY_CTX_add_flags(ctx, TS_VFY_SIGNATURE);

	/* Initialising the X509_STORE object. */
	if ((store = create_cert_store(ca_path, ca_file)) == NULL)
		goto err;
	TS_VERIFY_CTX_set_store(ctx, store);

	/* Loading untrusted certificates. */
	if (untrusted != NULL) {
		if ((certs = TS_CONF_load_certs(untrusted)) == NULL)
			goto err;
		TS_VERIFY_CTX_set_certs(ctx, certs);
	}

	ret = 1;
 err:
	if (!ret) {
		TS_VERIFY_CTX_free(ctx);
		ctx = NULL;
	}
Changes to jni/libressl/cert.pem.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20


21
22
23
24
25
26


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# $OpenBSD: cert.pem,v 1.24 2021/09/30 18:16:11 deraadt Exp $
### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068

=== /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 6047274297262753887 (0x53ec3beefbb2485f)
    Signature Algorithm: sha1WithRSAEncryption
        Validity
            Not Before: May 20 08:38:15 2009 GMT
            Not After : Dec 31 08:38:15 2030 GMT
        Subject: C=ES, CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE, pathlen:1
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Subject Key Identifier: 
                65:CD:EB:AB:35:1E:00:3E:7E:D5:74:C0:1C:B4:73:47:0E:1A:64:2F


            X509v3 Certificate Policies: 
                Policy: X509v3 Any Policy
                  CPS: http://www.firmaprofesional.com/cps
                  User Notice:
                    Explicit Text: 



SHA1 Fingerprint=AE:C5:FB:3F:C8:E1:BF:C4:E5:4F:03:07:5A:9A:E8:00:B7:F7:B6:FA
SHA256 Fingerprint=04:04:80:28:BF:1F:28:64:D4:8F:9A:D4:D8:32:94:36:6A:82:88:56:55:3F:3B:14:30:3F:90:14:7F:5D:40:EF
-----BEGIN CERTIFICATE-----
MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UE
BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h
cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEy
MzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg
Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi
MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9
thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM
cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG
L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i
NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h
X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b
m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy
Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja
EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T
KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF
6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh
OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD
VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNHDhpkLzCBpgYD

VR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBv
ACAAZABlACAAbABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBl
AGwAbwBuAGEAIAAwADgAMAAxADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF
661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx51tkljYyGOylMnfX40S2wBEqgLk9
am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qkR71kMrv2JYSiJ0L1
ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaPT481
PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS
3a/DTg4fJl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5k
SeTy36LssUzAKh3ntLFlosS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF
3dvd6qJ2gHN99ZwExEWN57kci57q13XRcrHedUTnQn3iV2t93Jm8PYMo6oCTjcVM
ZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoRsaS8I8nkvof/uZS2+F0g
StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz
Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB
jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
-----END CERTIFICATE-----

### ACCV

=== /CN=ACCVRAIZ1/OU=PKIACCV/O=ACCV/C=ES
Certificate:
    Data:
|






|
|

|
|


<
<
<
<


>
>






>
>
|
|

|

|
|












|
|
>
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14




15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# $OpenBSD: cert.pem,v 1.25 2022/07/11 09:05:16 sthen Exp $
### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068

=== /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1977337328857672817 (0x1b70e9d2ffae6c71)
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Sep 23 15:22:07 2014 GMT
            Not After : May  5 15:22:07 2036 GMT
        Subject: C=ES, CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
        X509v3 extensions:




            X509v3 Subject Key Identifier: 
                65:CD:EB:AB:35:1E:00:3E:7E:D5:74:C0:1C:B4:73:47:0E:1A:64:2F
            X509v3 Basic Constraints: critical
                CA:TRUE, pathlen:1
            X509v3 Certificate Policies: 
                Policy: X509v3 Any Policy
                  CPS: http://www.firmaprofesional.com/cps
                  User Notice:
                    Explicit Text: 

            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
SHA1 Fingerprint=0B:BE:C2:27:22:49:CB:39:AA:DB:35:5C:53:E3:8C:AE:78:FF:B6:FE
SHA256 Fingerprint=57:DE:05:83:EF:D2:B2:6E:03:61:DA:99:DA:9D:F4:64:8D:EF:7E:E8:44:1C:3B:72:8A:FA:9B:CD:E0:F9:B2:6A
-----BEGIN CERTIFICATE-----
MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UE
BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h
cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1
MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg
Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi
MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9
thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM
cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG
L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i
NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h
X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b
m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy
Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja
EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T
KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF
6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh
OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1UdDgQWBBRlzeurNR4APn7VdMAc
tHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4wgZswgZgGBFUd
IAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j
b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABC

AG8AbgBhAG4AbwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAw
ADEANzAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9m
iWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL4QjbEwj4KKE1soCzC1HA01aajTNF
Sa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDbLIpgD7dvlAceHabJ
hfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1ilI45P
Vf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZE
EAEeiGaPcjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV
1aUsIC+nmCjuRfzxuIgALI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2t
CsvMo2ebKHTEm9caPARYpoKdrcd7b/+Alun4jWq9GJAd/0kakFI3ky88Al2CdgtR
5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH9IBk9W6VULgRfhVwOEqw
f9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpfNIbnYrX9
ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNK
GbqEZycPvEJdvSRUDewdcAZfpLz6IHxV
-----END CERTIFICATE-----

### ACCV

=== /CN=ACCVRAIZ1/OU=PKIACCV/O=ACCV/C=ES
Certificate:
    Data:
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431


432
433
434
435
436
437
438
ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G
A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G
A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs
aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I
flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ==
-----END CERTIFICATE-----

### Agencia Catalana de Certificacio (NIF Q-0801176-I)

=== /C=ES/O=Agencia Catalana de Certificacio (NIF Q-0801176-I)/OU=Serveis Publics de Certificacio/OU=Vegeu https://www.catcert.net/verarrel (c)03/OU=Jerarquia Entitats de Certificacio Catalanes/CN=EC-ACC
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
             (Negative)11:d4:c2:14:2b:de:21:eb:57:9d:53:fb:0c:22:3b:ff
    Signature Algorithm: sha1WithRSAEncryption
        Validity
            Not Before: Jan  7 23:00:00 2003 GMT
            Not After : Jan  7 22:59:59 2031 GMT
        Subject: C=ES, O=Agencia Catalana de Certificacio (NIF Q-0801176-I), OU=Serveis Publics de Certificacio, OU=Vegeu https://www.catcert.net/verarrel (c)03, OU=Jerarquia Entitats de Certificacio Catalanes, CN=EC-ACC
        X509v3 extensions:
            X509v3 Subject Alternative Name: 
                email:ec_acc@catcert.net
            X509v3 Basic Constraints: critical
                CA:TRUE



            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Subject Key Identifier: 
                A0:C3:8B:44:AA:37:A5:45:BF:97:80:5A:D1:F1:78:A2:9B:E9:5D:8D
            X509v3 Certificate Policies: 
                Policy: 1.3.6.1.4.1.15096.1.3.1.10
                  CPS: https://www.catcert.net/verarrel
                  User Notice:
                    Explicit Text: Vegeu https://www.catcert.net/verarrel 

SHA1 Fingerprint=28:90:3A:63:5B:52:80:FA:E6:77:4C:0B:6D:A7:D6:BA:A6:4A:F2:E8
SHA256 Fingerprint=88:49:7F:01:60:2F:31:54:24:6A:E2:8C:4D:5A:EF:10:F1:D8:7E:BB:76:62:6F:4A:E0:B7:F9:5B:A7:96:87:99
-----BEGIN CERTIFICATE-----
MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB
8zELMAkGA1UEBhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2Vy
dGlmaWNhY2lvIChOSUYgUS0wODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1
YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYDVQQLEyxWZWdldSBodHRwczovL3d3
dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UECxMsSmVyYXJxdWlh
IEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMTBkVD
LUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQG
EwJFUzE7MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8g



KE5JRiBRLTA4MDExNzYtSSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBD
ZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZlZ2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQu
bmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJhcnF1aWEgRW50aXRhdHMg
ZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUNDMIIBIjAN
BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R
85iKw5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm
4CgPukLjbo73FCeTae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaV
HMf5NLWUhdWZXqBIoH7nF2W4onW4HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNd
QlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0aE9jD2z3Il3rucO2n5nzbcc8t
lGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw0JDnJwIDAQAB
o4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4
opvpXY0wfwYDVR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBo
dHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidW
ZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAwDQYJKoZIhvcN
AQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJlF7W2u++AVtd0x7Y
/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNaAl6k
SBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhy
Rp/7SNVel+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOS
Agu+TGbrIP65y7WZf+a2E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xl
nJ2lYJU6Un/10asIbvPuW/mIPX64b24D5EI=


-----END CERTIFICATE-----

### Amazon

=== /C=US/O=Amazon/CN=Amazon Root CA 1
Certificate:
    Data:







|

|




|
|

|
|
|

|
|


>
>
>


<
<
<
<
<
<
<
|
<
|

|
|
<
|
<
<
|
|
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>







365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394







395

396
397
398
399

400


401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G
A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G
A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs
aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I
flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ==
-----END CERTIFICATE-----

### Agence Nationale de Certification Electronique

=== /C=TN/O=Agence Nationale de Certification Electronique/CN=TunTrust Root CA
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            13:02:d5:e2:40:4c:92:46:86:16:67:5d:b4:bb:bb:b2:6b:3e:fc:13
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Apr 26 08:57:56 2019 GMT
            Not After : Apr 26 08:57:56 2044 GMT
        Subject: C=TN, O=Agence Nationale de Certification Electronique, CN=TunTrust Root CA
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                06:9A:9B:1F:53:7D:F1:F5:A4:C8:D3:86:3E:A1:73:59:B4:F7:44:21
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Authority Key Identifier: 
                keyid:06:9A:9B:1F:53:7D:F1:F5:A4:C8:D3:86:3E:A1:73:59:B4:F7:44:21

            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign







SHA1 Fingerprint=CF:E9:70:84:0F:E0:73:0F:9D:F6:0C:7F:2C:4B:EE:20:46:34:9C:BB

SHA256 Fingerprint=2E:44:10:2A:B5:8C:B8:54:19:45:1C:8E:19:D9:AC:F3:66:2C:AF:BC:61:4B:6A:53:96:0A:30:F7:D0:E2:EB:41
-----BEGIN CERTIFICATE-----
MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQEL
BQAwYTELMAkGA1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUg

Q2VydGlmaWNhdGlvbiBFbGVjdHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJv


b3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQwNDI2MDg1NzU2WjBhMQswCQYDVQQG
EwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBDZXJ0aWZpY2F0aW9u
IEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIwDQYJ
KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZ
n56eY+hz2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd
2JQDoOw05TDENX37Jk0bbjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgF
VwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZ
GoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAdgjH8KcwAWJeRTIAAHDOF
li/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViWVSHbhlnU
r8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2
eY8fTpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIb
MlEsPvLfe/ZdeikZjuXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISg
jwBUFfyRbVinljvrS5YnzWuioYasDXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB
7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwSVXAkPcvCFDVDXSdOvsC9qnyW
5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI04Y+oXNZtPdE
ITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0
90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+z
xiD2BkewhpMl0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYu
QEkHDVneixCwSQXi/5E/S7fdAo74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4
FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRYYdZ2vyJ/0Adqp2RT8JeNnYA/u8EH
22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJpadbGNjHh/PqAulxP
xOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65xxBzn
dFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5
Xc0yGYuPjCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7b
nV2UqL1g52KAdoGDDIzMMEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQ
CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH
u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj
d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o=
-----END CERTIFICATE-----

### Amazon

=== /C=US/O=Amazon/CN=Amazon Root CA 1
Certificate:
    Data:
585
586
587
588
589
590
591






















































































































































592
593
594
595
596
597
598
9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk
M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB
/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB
MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw
CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW
1KyLa2tJElMzrdfkviT8tQp21KW8EA==
-----END CERTIFICATE-----























































































































































### Atos

=== /CN=Atos TrustedRoot 2011/O=Atos/C=DE
Certificate:
    Data:
        Version: 3 (0x2)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk
M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB
/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB
MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw
CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW
1KyLa2tJElMzrdfkviT8tQp21KW8EA==
-----END CERTIFICATE-----

### ANF Autoridad de Certificacion

=== /serialNumber=G63287510/C=ES/O=ANF Autoridad de Certificacion/OU=ANF CA Raiz/CN=ANF Secure Server Root CA
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 996390341000653745 (0xdd3e3bc6cf96bb1)
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Sep  4 10:00:38 2019 GMT
            Not After : Aug 30 10:00:38 2039 GMT
        Subject: serialNumber=G63287510, C=ES, O=ANF Autoridad de Certificacion, OU=ANF CA Raiz, CN=ANF Secure Server Root CA
        X509v3 extensions:
            X509v3 Authority Key Identifier: 
                keyid:9C:5F:D0:6C:63:A3:5F:93:CA:93:98:08:AD:8C:87:A5:2C:5C:C1:37

            X509v3 Subject Key Identifier: 
                9C:5F:D0:6C:63:A3:5F:93:CA:93:98:08:AD:8C:87:A5:2C:5C:C1:37
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
SHA1 Fingerprint=5B:6E:68:D0:CC:15:B6:A0:5F:1E:C1:5F:AE:02:FC:6B:2F:5D:6F:74
SHA256 Fingerprint=FB:8F:EC:75:91:69:B9:10:6B:1E:51:16:44:C6:18:C5:13:04:37:3F:6C:06:43:08:8D:8B:EF:FD:1B:99:75:99
-----BEGIN CERTIFICATE-----
MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV
BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk
YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV
BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN
MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF
UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD
VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v
dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj
cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q
yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH
2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX
H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL
zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR
p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz
W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/
SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn
LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3
n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B
u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj
o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO
BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L
9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej
rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK
pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0
vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq
OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ
/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9
2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI
+PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2
MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo
tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw=
-----END CERTIFICATE-----

### Asseco Data Systems S.A.

=== /C=PL/O=Asseco Data Systems S.A./OU=Certum Certification Authority/CN=Certum EC-384 CA
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            78:8f:27:5c:81:12:52:20:a5:04:d0:2d:dd:ba:73:f4
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Mar 26 07:24:54 2018 GMT
            Not After : Mar 26 07:24:54 2043 GMT
        Subject: C=PL, O=Asseco Data Systems S.A., OU=Certum Certification Authority, CN=Certum EC-384 CA
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                8D:06:66:74:24:76:3A:F3:89:F7:BC:D6:BD:47:7D:2F:BC:10:5F:4B
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
SHA1 Fingerprint=F3:3E:78:3C:AC:DF:F4:A2:CC:AC:67:55:69:56:D7:E5:16:3C:E1:ED
SHA256 Fingerprint=6B:32:80:85:62:53:18:AA:50:D1:73:C9:8D:8B:DA:09:D5:7E:27:41:3D:11:4C:F7:87:A0:F5:D0:6C:03:0C:F6
-----BEGIN CERTIFICATE-----
MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw
CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw
JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT
EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0
WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT
LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX
BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE
KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm
Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj
QjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI0GZnQkdjrzife81r1HfS+8
EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjADVS2m5hjEfO/J
UG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0QoSZ/6vn
nvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k=
-----END CERTIFICATE-----
=== /C=PL/O=Asseco Data Systems S.A./OU=Certum Certification Authority/CN=Certum Trusted Root CA
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            1e:bf:59:50:b8:c9:80:37:4c:06:f7:eb:55:4f:b5:ed
    Signature Algorithm: sha512WithRSAEncryption
        Validity
            Not Before: Mar 16 12:10:13 2018 GMT
            Not After : Mar 16 12:10:13 2043 GMT
        Subject: C=PL, O=Asseco Data Systems S.A., OU=Certum Certification Authority, CN=Certum Trusted Root CA
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                8C:FB:1C:75:BC:02:D3:9F:4E:2E:48:D9:F9:60:54:AA:C4:B3:4F:FA
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
SHA1 Fingerprint=C8:83:44:C0:18:AE:9F:CC:F1:87:B7:8F:22:D1:C5:D7:45:84:BA:E5
SHA256 Fingerprint=FE:76:96:57:38:55:77:3E:37:A9:5E:7A:D4:D9:CC:96:C3:01:57:C1:5D:31:76:5B:A9:B1:57:04:E1:AE:78:FD
-----BEGIN CERTIFICATE-----
MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6
MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEu
MScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNV
BAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwHhcNMTgwMzE2MTIxMDEzWhcNNDMw
MzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEg
U3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRo
b3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqG
SIb3DQEBAQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZ
n0EGze2jusDbCSzBfN8pfktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/q
p1x4EaTByIVcJdPTsuclzxFUl6s1wB52HO8AU5853BSlLCIls3Jy/I2z5T4IHhQq
NwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2fJmItdUDmj0VDT06qKhF
8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGtg/BKEiJ3
HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGa
mqi4NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi
7VdNIuJGmj8PkTQkfVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSF
ytKAQd8FqKPVhJBPC/PgP5sZ0jeJP/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0P
qafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSYnjYJdmZm/Bo/6khUHL4wvYBQ
v3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHKHRzQ+8S1h9E6
Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1
vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQAD
ggIBAEii1QALLtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4
WxmB82M+w85bj/UvXgF2Ez8sALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvo
zMrnadyHncI013nR03e4qllY/p0m+jiGPp2Kh2RX5Rc64vmNueMzeMGQ2Ljdt4NR
5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8CYyqOhNf6DR5UMEQ
GfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA4kZf
5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq
0Uc9NneoWWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7D
P78v3DSk+yshzWePS/Tj6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTM
qJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmTOPQD8rv7gmsHINFSH5pkAnuYZttcTVoP
0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZckbxJF0WddCajJFdr60qZf
E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb
-----END CERTIFICATE-----

### Atos

=== /CN=Atos TrustedRoot 2011/O=Atos/C=DE
Certificate:
    Data:
        Version: 3 (0x2)
936
937
938
939
940
941
942



















































943
944
945
946
947
948
949
/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z
AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ
5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
-----END CERTIFICATE-----

### Chunghwa Telecom Co., Ltd.




















































=== /C=TW/O=Chunghwa Telecom Co., Ltd./OU=ePKI Root Certification Authority
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            15:c8:bd:65:47:5c:af:b8:97:00:5e:e4:06:d2:bc:9d
    Signature Algorithm: sha1WithRSAEncryption







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z
AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ
5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
-----END CERTIFICATE-----

### Chunghwa Telecom Co., Ltd.

=== /C=TW/O=Chunghwa Telecom Co., Ltd./CN=HiPKI Root CA - G1
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            2d:dd:ac:ce:62:97:94:a1:43:e8:b0:cd:76:6a:5e:60
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Feb 22 09:46:04 2019 GMT
            Not After : Dec 31 15:59:59 2037 GMT
        Subject: C=TW, O=Chunghwa Telecom Co., Ltd., CN=HiPKI Root CA - G1
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                F2:77:17:FA:5E:A8:FE:F6:3D:71:D5:68:BA:C9:46:0C:38:D8:AF:B0
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
SHA1 Fingerprint=6A:92:E4:A8:EE:1B:EC:96:45:37:E3:29:57:49:CD:96:E3:E5:D2:60
SHA256 Fingerprint=F0:15:CE:3C:C2:39:BF:EF:06:4B:E9:F1:D2:C4:17:E1:A0:26:4A:0A:94:BE:1F:0C:8D:12:18:64:EB:69:49:CC
-----BEGIN CERTIFICATE-----
MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBP
MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0
ZC4xGzAZBgNVBAMMEkhpUEtJIFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRa
Fw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3
YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kgUm9vdCBDQSAtIEcx
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0o9Qw
qNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twv
Vcg3Px+kwJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6
lZgRZq2XNdZ1AYDgr/SEYYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnz
Qs7ZngyzsHeXZJzA9KMuH5UHsBffMNsAGJZMoYFL3QRtU6M9/Aes1MU3guvklQgZ
KILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfdhSi8MEyr48KxRURHH+CK
FgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj1jOXTyFj
HluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDr
y+K49a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ
/W3c1pzAtH2lsN0/Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgM
a/aOEmem8rJY5AIJEzypuxC00jBF8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6
fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
HQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQDAgGGMA0GCSqG
SIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi
7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqc
SE5XCV0vrPSltJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6Fza
ZsT0pPBWGTMpWmWSBUdGSquEwx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9Tc
XzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07QJNBAsNB1CI69aO4I1258EHBGG3zg
iLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv5wiZqAxeJoBF1Pho
L5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+GpzjLrF
Ne85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wr
kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+
vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU
YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ==
-----END CERTIFICATE-----
=== /C=TW/O=Chunghwa Telecom Co., Ltd./OU=ePKI Root Certification Authority
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            15:c8:bd:65:47:5c:af:b8:97:00:5e:e4:06:d2:bc:9d
    Signature Algorithm: sha1WithRSAEncryption
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS
/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z
Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE
W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D
hNQ+IIX3Sj0rnP0qCglN6oH4EZw=
-----END CERTIFICATE-----

### Comodo CA Limited

=== /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1 (0x1)
    Signature Algorithm: sha1WithRSAEncryption
        Validity
            Not Before: Jan  1 00:00:00 2004 GMT
            Not After : Dec 31 23:59:59 2028 GMT
        Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://crl.comodoca.com/AAACertificateServices.crl

                Full Name:
                  URI:http://crl.comodo.net/AAACertificateServices.crl

SHA1 Fingerprint=D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49
SHA256 Fingerprint=D7:A7:A0:FB:5D:7E:27:31:D7:71:E9:48:4E:BC:DE:F7:1D:5F:0C:3E:0A:29:48:78:2B:C8:3E:E0:EA:69:9E:F4
-----BEGIN CERTIFICATE-----
MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb
MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow
GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj
YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL
MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM
GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua
BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe
3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4
YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR
rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm
ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU
oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v
QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t
b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF
AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q
GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2
G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi
l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3
smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
-----END CERTIFICATE-----

### COMODO CA Limited

=== /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO Certification Authority
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1189
1190
1191
1192
1193
1194
1195























































1196
1197
1198
1199
1200
1201
1202
o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS
/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z
Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE
W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D
hNQ+IIX3Sj0rnP0qCglN6oH4EZw=
-----END CERTIFICATE-----
























































### COMODO CA Limited

=== /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO Certification Authority
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209


1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220

1221
1222
1223
1224
1225
1226
1227
1228


1229

1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246

1247
1248
1249
1250




























































































1251
1252
1253
1254
1255
1256
1257
jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL
S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb
QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl
0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB
NVOFBkpdn627G190
-----END CERTIFICATE-----

### Cybertrust, Inc

=== /O=Cybertrust, Inc/CN=Cybertrust Global Root
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            04:00:00:00:00:01:0f:85:aa:2d:48
    Signature Algorithm: sha1WithRSAEncryption
        Validity
            Not Before: Dec 15 08:00:00 2006 GMT
            Not After : Dec 15 08:00:00 2021 GMT
        Subject: O=Cybertrust, Inc, CN=Cybertrust Global Root
        X509v3 extensions:


            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                B6:08:7B:0D:7A:CC:AC:20:4C:86:56:32:5E:CF:AB:6E:85:2D:70:57
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://www2.public-trust.com/crl/ct/ctroot.crl


            X509v3 Authority Key Identifier: 
                keyid:B6:08:7B:0D:7A:CC:AC:20:4C:86:56:32:5E:CF:AB:6E:85:2D:70:57

SHA1 Fingerprint=5F:43:E5:B1:BF:F8:78:8C:AC:1C:C7:CA:4A:9A:C6:22:2B:CC:34:C6
SHA256 Fingerprint=96:0A:DF:00:63:E9:63:56:75:0C:29:65:DD:0A:08:67:DA:0B:9C:BD:6E:77:71:4A:EA:FB:23:49:AB:39:3D:A3
-----BEGIN CERTIFICATE-----
MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYG
A1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2Jh


bCBSb290MB4XDTA2MTIxNTA4MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UE

ChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBS
b290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Mi8vRRQZhP/8NN5
7CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW0ozS
J8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2y
HLtgwEZLAfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iP
t3sMpTjr3kfb1V05/Iin89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNz
FtApD0mpSPCzqrdsxacwOUBdrsTiXSZT8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAY
XSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/
MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2MDSgMqAw
hi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3Js
MB8GA1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUA
A4IBAQBW7wojoFROlZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMj
Wqd8BfP9IjsO0QbE2zZMcwSO5bAi5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUx
XOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2hO0j9n0Hq0V+09+zv+mKts2o
omcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+TX3EJIrduPuoc
A06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
WL1WMRJOEcgh4LMRkWXbtKaIOM5V

-----END CERTIFICATE-----

### D-Trust GmbH





























































































=== /C=DE/O=D-Trust GmbH/CN=D-TRUST Root Class 3 CA 2 2009
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 623603 (0x983f3)
    Signature Algorithm: sha256WithRSAEncryption
        Validity







|

|



|
<


|
|
|

>
>




<
<



|

>
|
<

|
|

|
<
>
>
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345

1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357


1358
1359
1360
1361
1362
1363
1364

1365
1366
1367
1368
1369

1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL
S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb
QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl
0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB
NVOFBkpdn627G190
-----END CERTIFICATE-----

### Comodo CA Limited

=== /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1 (0x1)

    Signature Algorithm: sha1WithRSAEncryption
        Validity
            Not Before: Jan  1 00:00:00 2004 GMT
            Not After : Dec 31 23:59:59 2028 GMT
        Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE


            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://crl.comodoca.com/AAACertificateServices.crl

                Full Name:
                  URI:http://crl.comodo.net/AAACertificateServices.crl


SHA1 Fingerprint=D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49
SHA256 Fingerprint=D7:A7:A0:FB:5D:7E:27:31:D7:71:E9:48:4E:BC:DE:F7:1D:5F:0C:3E:0A:29:48:78:2B:C8:3E:E0:EA:69:9E:F4
-----BEGIN CERTIFICATE-----
MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb

MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow
GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj
YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL
MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM
GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua
BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe
3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4
YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR
rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm
ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU
oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v
QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t
b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF
AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q
GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2
G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi
l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3
smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
-----END CERTIFICATE-----

### D-Trust GmbH

=== /C=DE/O=D-Trust GmbH/CN=D-TRUST BR Root CA 1 2020
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            7c:c9:8f:2b:84:d7:df:ea:0f:c9:65:9a:d3:4b:4d:96
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Feb 11 09:45:00 2020 GMT
            Not After : Feb 11 09:44:59 2035 GMT
        Subject: C=DE, O=D-Trust GmbH, CN=D-TRUST BR Root CA 1 2020
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                73:91:10:AB:FF:55:B3:5A:7C:09:25:D5:B2:BA:08:A0:6B:AB:1F:6D
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://crl.d-trust.net/crl/d-trust_br_root_ca_1_2020.crl

                Full Name:
                  URI:ldap://directory.d-trust.net/CN=D-TRUST%20BR%20Root%20CA%201%202020,O=D-Trust%20GmbH,C=DE?certificaterevocationlist

SHA1 Fingerprint=1F:5B:98:F0:E3:B5:F7:74:3C:ED:E6:B0:36:7D:32:CD:F4:09:41:67
SHA256 Fingerprint=E5:9A:AA:81:60:09:C2:2B:FF:5B:25:BA:D3:7D:F3:06:F0:49:79:7C:1F:81:D8:5A:B0:89:E6:57:BD:8F:00:44
-----BEGIN CERTIFICATE-----
MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQsw
CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS
VVNUIEJSIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5
NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG
A1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB
BAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7dPYS
zuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0
QVK5buXuQqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/
VbNafAkl1bK6CKBrqx9tMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g
PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2JyX3Jvb3Rf
Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l
dC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1
c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO
PQQDAwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFW
wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV
dWNbFJWcHwHP2NVypw87
-----END CERTIFICATE-----
=== /C=DE/O=D-Trust GmbH/CN=D-TRUST EV Root CA 1 2020
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            5f:02:41:d7:7a:87:7c:4c:03:a3:ac:96:8d:fb:ff:d0
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Feb 11 10:00:00 2020 GMT
            Not After : Feb 11 09:59:59 2035 GMT
        Subject: C=DE, O=D-Trust GmbH, CN=D-TRUST EV Root CA 1 2020
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                7F:10:01:16:37:3A:A4:28:E4:50:F8:A4:F7:EC:6B:32:B6:FE:E9:8B
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://crl.d-trust.net/crl/d-trust_ev_root_ca_1_2020.crl

                Full Name:
                  URI:ldap://directory.d-trust.net/CN=D-TRUST%20EV%20Root%20CA%201%202020,O=D-Trust%20GmbH,C=DE?certificaterevocationlist

SHA1 Fingerprint=61:DB:8C:21:59:69:03:90:D8:7C:9C:12:86:54:CF:9D:3D:F4:DD:07
SHA256 Fingerprint=08:17:0D:1A:A3:64:53:90:1A:2F:95:92:45:E3:47:DB:0C:8D:37:AB:AA:BC:56:B8:1A:A1:00:DC:95:89:70:DB
-----BEGIN CERTIFICATE-----
MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw
CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS
VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5
NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG
A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB
BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC
/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD
wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3
OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g
PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf
Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l
dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1
c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO
PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA
y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb
gfM0agPnIjhQW+0ZT0MW
-----END CERTIFICATE-----
=== /C=DE/O=D-Trust GmbH/CN=D-TRUST Root Class 3 CA 2 2009
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 623603 (0x983f3)
    Signature Algorithm: sha256WithRSAEncryption
        Validity
1870
1871
1872
1873
1874
1875
1876


























































1877
1878
1879
1880
1881
1882
1883
TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i
nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3
gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr
G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os
zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x
L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL
-----END CERTIFICATE-----



























































### E-Tu\U011Fra EBG Bili\U015Fim Teknolojileri ve Hizmetleri A.\U015E.

=== /C=TR/L=Ankara/O=E-Tu\xC4\x9Fra EBG Bili\xC5\x9Fim Teknolojileri ve Hizmetleri A.\xC5\x9E./OU=E-Tugra Sertifikasyon Merkezi/CN=E-Tugra Certification Authority
Certificate:
    Data:
        Version: 3 (0x2)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i
nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3
gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr
G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os
zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x
L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL
-----END CERTIFICATE-----

### e-commerce monitoring GmbH

=== /C=AT/O=e-commerce monitoring GmbH/CN=GLOBALTRUST 2020
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            5a:4b:bd:5a:fb:4f:8a:5b:fa:65:e5
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Feb 10 00:00:00 2020 GMT
            Not After : Jun 10 00:00:00 2040 GMT
        Subject: C=AT, O=e-commerce monitoring GmbH, CN=GLOBALTRUST 2020
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Subject Key Identifier: 
                DC:2E:1F:D1:61:37:79:E4:AB:D5:D5:B3:12:71:68:3D:6A:68:9C:22
            X509v3 Authority Key Identifier: 
                keyid:DC:2E:1F:D1:61:37:79:E4:AB:D5:D5:B3:12:71:68:3D:6A:68:9C:22

SHA1 Fingerprint=D0:67:C1:13:51:01:0C:AA:D0:C7:6A:65:37:31:16:26:4F:53:71:A2
SHA256 Fingerprint=9A:29:6A:51:82:D1:D4:51:A2:E3:7F:43:9B:74:DA:AF:A2:67:52:33:29:F9:0F:9A:0D:20:07:C3:34:E2:3C:9A
-----BEGIN CERTIFICATE-----
MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkG
A1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkw
FwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYx
MDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9u
aXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMIICIjANBgkq
hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWiD59b
RatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9Z
YybNpyrOVPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3
QWPKzv9pj2gOlTblzLmMCcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPw
yJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCmfecqQjuCgGOlYx8ZzHyyZqjC0203b+J+
BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKAA1GqtH6qRNdDYfOiaxaJ
SaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9ORJitHHmkH
r96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj0
4KlGDfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9Me
dKZssCz3AwyIDMvUclOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIw
q7ejMZdnrY8XD2zHc+0klGvIg5rQmjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2
nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
AQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1UdIwQYMBaAFNwu
H9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA
VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJC
XtzoRlgHNQIw4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd
6IwPS3BD0IL/qMy/pJTAvoe9iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf
+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS8cE54+X1+NZK3TTN+2/BT+MAi1bi
kvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2HcqtbepBEX4tdJP7
wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxSvTOB
TI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6C
MUO+1918oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn
4rnvyOL2NSl6dPrFf4IFYqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+I
aFvowdlxfv1k7/9nR4hYJS8+hge9+6jlgqispdNpQ80xiEmEU5LAsTkbOYMBMMTy
qfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg==
-----END CERTIFICATE-----

### E-Tu\U011Fra EBG Bili\U015Fim Teknolojileri ve Hizmetleri A.\U015E.

=== /C=TR/L=Ankara/O=E-Tu\xC4\x9Fra EBG Bili\xC5\x9Fim Teknolojileri ve Hizmetleri A.\xC5\x9E./OU=E-Tugra Sertifikasyon Merkezi/CN=E-Tugra Certification Authority
Certificate:
    Data:
        Version: 3 (0x2)
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459

2460

2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
### GlobalSign

=== /OU=GlobalSign ECC Root CA - R4/O=GlobalSign/CN=GlobalSign
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            2a:38:a4:1c:96:0a:04:de:42:b2:28:a5:0b:e8:34:98:02
    Signature Algorithm: ecdsa-with-SHA256
        Validity
            Not Before: Nov 13 00:00:00 2012 GMT
            Not After : Jan 19 03:14:07 2038 GMT
        Subject: OU=GlobalSign ECC Root CA - R4, O=GlobalSign, CN=GlobalSign
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                54:B0:7B:AD:45:B8:E2:40:7F:FB:0A:6E:FB:BE:33:C9:3C:A3:84:D5
SHA1 Fingerprint=69:69:56:2E:40:80:F4:24:A1:E7:19:9F:14:BA:F3:EE:58:AB:6A:BB
SHA256 Fingerprint=BE:C9:49:11:C2:95:56:76:DB:6C:0A:55:09:86:D7:6E:3B:A0:05:66:7C:44:2C:97:62:B4:FB:B7:73:DE:22:8C
-----BEGIN CERTIFICATE-----
MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEk
MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpH
bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX
DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD

QSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu

MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprlOQcJ
FspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAw
DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61F
uOJAf/sKbvu+M8k8o4TVMAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGX
kPoUVy0D7O48027KqGx2vKLeuwIgJ6iFJzWbVsaj8kfSt24bAgAXqmemFZHe+pTs
ewv4n4Q=
-----END CERTIFICATE-----
=== /OU=GlobalSign ECC Root CA - R5/O=GlobalSign/CN=GlobalSign
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            60:59:49:e0:26:2e:bb:55:f9:0a:77:8a:71:f9:4a:d8:6c







|







|




|
|

|
<
|
<
>
|
>
|
|
|
|
|
<







2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751

2752

2753
2754
2755
2756
2757
2758
2759
2760

2761
2762
2763
2764
2765
2766
2767
### GlobalSign

=== /OU=GlobalSign ECC Root CA - R4/O=GlobalSign/CN=GlobalSign
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            02:03:e5:7e:f5:3f:93:fd:a5:09:21:b2:a6
    Signature Algorithm: ecdsa-with-SHA256
        Validity
            Not Before: Nov 13 00:00:00 2012 GMT
            Not After : Jan 19 03:14:07 2038 GMT
        Subject: OU=GlobalSign ECC Root CA - R4, O=GlobalSign, CN=GlobalSign
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                54:B0:7B:AD:45:B8:E2:40:7F:FB:0A:6E:FB:BE:33:C9:3C:A3:84:D5
SHA1 Fingerprint=6B:A0:B0:98:E1:71:EF:5A:AD:FE:48:15:80:77:10:F4:BD:6F:0B:28
SHA256 Fingerprint=B0:85:D7:0B:96:4F:19:1A:73:E4:AF:0D:54:AE:7A:0E:07:AA:FD:AF:9B:71:DD:08:62:13:8A:B7:32:5A:24:A2
-----BEGIN CERTIFICATE-----
MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYD

VQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2Jh

bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgw
MTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0g
UjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wWTAT
BgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkWymOx
uYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNV
HQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/
+wpu+74zyTyjhNUwCgYIKoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147
bmF0774BxL4YSFlhgjICICadVGNA3jdgUM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm

-----END CERTIFICATE-----
=== /OU=GlobalSign ECC Root CA - R5/O=GlobalSign/CN=GlobalSign
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            60:59:49:e0:26:2e:bb:55:f9:0a:77:8a:71:f9:4a:d8:6c
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke
hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI
KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg
515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO
xwy8p2Fp8fc74SrL+SvzZpA3
-----END CERTIFICATE-----
=== /OU=GlobalSign Root CA - R2/O=GlobalSign/CN=GlobalSign
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            04:00:00:00:00:01:0f:86:26:e6:0d
    Signature Algorithm: sha1WithRSAEncryption
        Validity
            Not Before: Dec 15 08:00:00 2006 GMT
            Not After : Dec 15 08:00:00 2021 GMT
        Subject: OU=GlobalSign Root CA - R2, O=GlobalSign, CN=GlobalSign
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://crl.globalsign.net/root-r2.crl

            X509v3 Authority Key Identifier: 
                keyid:9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E

SHA1 Fingerprint=75:E0:AB:B6:13:85:12:27:1C:04:F8:5F:DD:DE:38:E4:B7:24:2E:FE
SHA256 Fingerprint=CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E
-----BEGIN CERTIFICATE-----
MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G
A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp
Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1
MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG
A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL
v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8
eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq
tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd
C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa
zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB
mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH
V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n
bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG
3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs
J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO
291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS
ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd
AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
-----END CERTIFICATE-----
=== /OU=GlobalSign Root CA - R3/O=GlobalSign/CN=GlobalSign
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            04:00:00:00:00:01:21:58:53:08:a2
    Signature Algorithm: sha256WithRSAEncryption







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







2789
2790
2791
2792
2793
2794
2795


















































2796
2797
2798
2799
2800
2801
2802
8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke
hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI
KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg
515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO
xwy8p2Fp8fc74SrL+SvzZpA3
-----END CERTIFICATE-----


















































=== /OU=GlobalSign Root CA - R3/O=GlobalSign/CN=GlobalSign
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            04:00:00:00:00:01:21:58:53:08:a2
    Signature Algorithm: sha256WithRSAEncryption
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
### Google Trust Services LLC

=== /C=US/O=Google Trust Services LLC/CN=GTS Root R1
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            6e:47:a9:c5:4b:47:0c:0d:ec:33:d0:89:b9:1c:f4:e1
    Signature Algorithm: sha384WithRSAEncryption
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R1
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                E4:AF:2B:26:71:1A:2B:48:27:85:2F:52:66:2C:EF:F0:89:13:71:3E
SHA1 Fingerprint=E1:C9:50:E6:EF:22:F8:4C:56:45:72:8B:92:20:60:D7:D5:A7:A3:E8
SHA256 Fingerprint=2A:57:54:71:E3:13:40:BC:21:58:1C:BD:2C:F1:3E:15:84:63:20:3E:CE:94:BC:F9:D3:CC:19:6B:F0:9A:54:72
-----BEGIN CERTIFICATE-----
MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBH
MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM
QzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIy
MDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNl
cnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaM
f/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vX
mX7wCl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7
zUjwTcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0P
fyblqAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtc
vfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4
Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUsp
zBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOO
Rc92wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYW
k70paDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+
DVrNVjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgF
lQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
HQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBADiW
Cu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6Z
XPYfcX3v73svfuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZR
gyFmxhE+885H7pwoHyXa/6xmld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3
d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9bgsiG1eGZbYwE8na6SfZu6W0eX6Dv
J4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq4BjFbkerQUIpm/Zg
DdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWErtXvM
+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyy
F62ARPBopY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9
SQ98POyDGCBDTtWTurQ0sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdws
E3PYJ/HQcu51OyLemGhmW/HGY0dVHLqlCFF1pkgl
-----END CERTIFICATE-----
=== /C=US/O=Google Trust Services LLC/CN=GTS Root R2
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            6e:47:a9:c6:5a:b3:e7:20:c5:30:9a:3f:68:52:f2:6f
    Signature Algorithm: sha384WithRSAEncryption
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R2
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                BB:FF:CA:8E:23:9F:4F:99:CA:DB:E2:68:A6:A5:15:27:17:1E:D9:0E
SHA1 Fingerprint=D2:73:96:2A:2A:5E:39:9F:73:3F:E1:C7:1E:64:3F:03:38:34:FC:4D
SHA256 Fingerprint=C4:5D:7B:B0:8E:6D:67:E6:2E:42:35:11:0B:56:4E:5F:78:FD:92:EF:05:8C:84:0A:EA:4E:64:55:D7:58:5C:60
-----BEGIN CERTIFICATE-----
MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBH
MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM
QzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIy
MDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNl
cnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3Lv
CvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3Kg
GjSY6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9Bu
XvAuMC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOd
re7kRXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXu
PuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1
mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K
8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqj
x5RWIr9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsR
nTKaG73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0
kzCqgc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9Ok
twIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
HQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBALZp
8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiT
z9D2PGcDFWEJ+YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiA
pJiS4wGWAqoC7o87xdFtCjMwc3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvb
pxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3DaWsYDQvTtN6LwG1BUSw7YhN4ZKJmB
R64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5rn/WkhLx3+WuXrD5R
RaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56GtmwfuNmsk
0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC
5AwiWVIQ7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiF
izoHCBy69Y9Vmhh1fuXsgWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLn
yOd/xCxgXS/Dr55FBcOEArf9LAhST4Ldo/DUhgkC
-----END CERTIFICATE-----
=== /C=US/O=Google Trust Services LLC/CN=GTS Root R3
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            6e:47:a9:c7:6c:a9:73:24:40:89:0f:03:55:dd:8d:1d
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R3
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                C1:F1:26:BA:A0:2D:AE:85:81:CF:D3:F1:2A:12:BD:B8:0A:67:FD:BC
SHA1 Fingerprint=30:D4:24:6F:07:FF:DB:91:89:8A:0B:E9:49:66:11:EB:8C:5E:46:E5
SHA256 Fingerprint=15:D5:B8:77:46:19:EA:7D:54:CE:1C:A6:D0:B0:C4:03:E0:37:A9:17:F1:31:E8:A0:4E:1E:6B:7A:71:BA:BC:E5
-----BEGIN CERTIFICATE-----
MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQsw
CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU
MBIGA1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw
MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp
Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQA
IgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout
736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2A
DDL24CejQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud
DgQWBBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFuk
fCPAlaUs3L6JbyO5o91lAFJekazInXJ0glMLfalAvWhgxeG4VDvBNhcl2MG9AjEA
njWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOaKaqW04MjyaR7YbPMAuhd
-----END CERTIFICATE-----
=== /C=US/O=Google Trust Services LLC/CN=GTS Root R4
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            6e:47:a9:c8:8b:94:b6:e8:bb:3b:2a:d8:a2:b2:c1:99
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R4
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                80:4C:D6:EB:74:FF:49:36:A3:D5:D8:FC:B5:3E:C5:6A:F0:94:1D:8C
SHA1 Fingerprint=2A:1D:60:27:D9:4A:B1:0A:1C:4D:91:5C:CD:33:A0:CB:3E:2D:54:CB
SHA256 Fingerprint=71:CC:A5:39:1F:9E:79:4B:04:80:25:30:B3:63:E1:21:DA:8A:30:43:BB:26:66:2F:EA:4D:CA:7F:C9:51:A4:BD
-----BEGIN CERTIFICATE-----
MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQsw
CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU
MBIGA1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw
MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp
Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQA
IgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzu
hXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/l
xKvRHYqjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud
DgQWBBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0
CMRw3J5QdCHojXohw0+WbhXRIjVhLfoIN+4Zba3bssx9BzT1YBkstTTZbyACMANx
sbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11xzPKwTdb+mciUqXWi4w==
-----END CERTIFICATE-----

### GUANG DONG CERTIFICATE AUTHORITY CO.,LTD.

=== /C=CN/O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD./CN=GDCA TrustAUTH R5 ROOT
Certificate:
    Data:







|







|




|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|






|







|




|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|






|







|




|
|

|
|
|
|
|
|
|
|
|
|
|






|







|




|
|

|
|
|
|
|
|
|
|
|
|
|







3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
### Google Trust Services LLC

=== /C=US/O=Google Trust Services LLC/CN=GTS Root R1
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            02:03:e5:93:6f:31:b0:13:49:88:6b:a2:17
    Signature Algorithm: sha384WithRSAEncryption
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R1
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                E4:AF:2B:26:71:1A:2B:48:27:85:2F:52:66:2C:EF:F0:89:13:71:3E
SHA1 Fingerprint=E5:8C:1C:C4:91:3B:38:63:4B:E9:10:6E:E3:AD:8E:6B:9D:D9:81:4A
SHA256 Fingerprint=D9:47:43:2A:BD:E7:B7:FA:90:FC:2E:6B:59:10:1B:12:80:E0:E1:C7:E4:E4:0F:A3:C6:88:7F:FF:57:A7:F4:CF
-----BEGIN CERTIFICATE-----
MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw
CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU
MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw
MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp
Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA
A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo
27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w
Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw
TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl
qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH
szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8
Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk
MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p
aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN
VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID
AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb
C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe
QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy
h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4
7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J
ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef
MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/
Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT
6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ
0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm
2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb
bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c
-----END CERTIFICATE-----
=== /C=US/O=Google Trust Services LLC/CN=GTS Root R2
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            02:03:e5:ae:c5:8d:04:25:1a:ab:11:25:aa
    Signature Algorithm: sha384WithRSAEncryption
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R2
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                BB:FF:CA:8E:23:9F:4F:99:CA:DB:E2:68:A6:A5:15:27:17:1E:D9:0E
SHA1 Fingerprint=9A:44:49:76:32:DB:DE:FA:D0:BC:FB:5A:7B:17:BD:9E:56:09:24:94
SHA256 Fingerprint=8D:25:CD:97:22:9D:BF:70:35:6B:DA:4E:B3:CC:73:40:31:E2:4C:F0:0F:AF:CF:D3:2D:C7:6E:B5:84:1C:7E:A8
-----BEGIN CERTIFICATE-----
MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw
CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU
MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw
MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp
Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA
A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt
nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY
6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu
MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k
RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg
f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV
+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo
dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa
G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq
gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID
AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H
vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8
0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC
B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u
NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg
yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev
HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6
xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR
TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg
JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV
7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl
6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL
-----END CERTIFICATE-----
=== /C=US/O=Google Trust Services LLC/CN=GTS Root R3
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            02:03:e5:b8:82:eb:20:f8:25:27:6d:3d:66
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R3
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                C1:F1:26:BA:A0:2D:AE:85:81:CF:D3:F1:2A:12:BD:B8:0A:67:FD:BC
SHA1 Fingerprint=ED:E5:71:80:2B:C8:92:B9:5B:83:3C:D2:32:68:3F:09:CD:A0:1E:46
SHA256 Fingerprint=34:D8:A7:3E:E2:08:D9:BC:DB:0D:95:65:20:93:4B:4E:40:E6:94:82:59:6E:8B:6F:73:C8:42:6B:01:0A:6F:48
-----BEGIN CERTIFICATE-----
MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYD
VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG
A1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw
WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz
IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
AAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout736G
jOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL2
4CejQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
BBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7
VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azTL818+FsuVbu/3ZL3pAzcMeGiAjEA/Jdm
ZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV11RZt+cRLInUue4X
-----END CERTIFICATE-----
=== /C=US/O=Google Trust Services LLC/CN=GTS Root R4
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            02:03:e5:c0:68:ef:63:1a:9c:72:90:50:52
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Jun 22 00:00:00 2016 GMT
            Not After : Jun 22 00:00:00 2036 GMT
        Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R4
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                80:4C:D6:EB:74:FF:49:36:A3:D5:D8:FC:B5:3E:C5:6A:F0:94:1D:8C
SHA1 Fingerprint=77:D3:03:67:B5:E0:0C:15:F6:0C:38:61:DF:7C:E1:3B:92:46:4D:47
SHA256 Fingerprint=34:9D:FA:40:58:C5:E2:63:12:3B:39:8A:E7:95:57:3C:4E:13:13:C8:3F:E6:8F:93:55:6C:D5:E8:03:1B:3C:7D
-----BEGIN CERTIFICATE-----
MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD
VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG
A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw
WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz
IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi
QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR
HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D
9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8
p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD
-----END CERTIFICATE-----

### GUANG DONG CERTIFICATE AUTHORITY CO.,LTD.

=== /C=CN/O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD./CN=GDCA TrustAUTH R5 ROOT
Certificate:
    Data:
3039
3040
3041
3042
3043
3044
3045



























































































3046
3047
3048
3049
3050
3051
3052
IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io
2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV
09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ
XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq
T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe
MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
-----END CERTIFICATE-----




























































































### Hellenic Academic and Research Institutions Cert. Authority

=== /C=GR/L=Athens/O=Hellenic Academic and Research Institutions Cert. Authority/CN=Hellenic Academic and Research Institutions ECC RootCA 2015
Certificate:
    Data:
        Version: 3 (0x2)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io
2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV
09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ
XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq
T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe
MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
-----END CERTIFICATE-----

### Hellenic Academic and Research Institutions CA

=== /C=GR/O=Hellenic Academic and Research Institutions CA/CN=HARICA TLS ECC Root CA 2021
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            67:74:9d:8d:77:d8:3b:6a:db:22:f4:ff:59:e2:bf:ce
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Feb 19 11:01:10 2021 GMT
            Not After : Feb 13 11:01:09 2045 GMT
        Subject: C=GR, O=Hellenic Academic and Research Institutions CA, CN=HARICA TLS ECC Root CA 2021
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                C9:1B:53:81:12:FE:04:D5:16:D1:AA:BC:9A:6F:B7:A0:95:19:6E:CA
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
SHA1 Fingerprint=BC:B0:C1:9D:E9:98:92:70:19:38:57:E9:8D:A7:B4:5D:6E:EE:01:48
SHA256 Fingerprint=3F:99:CC:47:4A:CF:CE:4D:FE:D5:87:94:66:5E:47:8D:15:47:73:9F:2E:78:0F:1B:B4:CA:9B:13:30:97:D4:01
-----BEGIN CERTIFICATE-----
MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQsw
CQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2Vh
cmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9v
dCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoXDTQ1MDIxMzExMDEwOVowbDELMAkG
A1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
aCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJvb3Qg
Q0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7
KKrxcm1lAEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9Y
STHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw
AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQD
AgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNw
SaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygN
nxS2PFOiTAZpffpskcYqSUXm7LcT4Tps
-----END CERTIFICATE-----
=== /C=GR/O=Hellenic Academic and Research Institutions CA/CN=HARICA TLS RSA Root CA 2021
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            39:ca:93:1c:ef:43:f3:c6:8e:93:c7:f4:64:89:38:7e
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Feb 19 10:55:38 2021 GMT
            Not After : Feb 13 10:55:37 2045 GMT
        Subject: C=GR, O=Hellenic Academic and Research Institutions CA, CN=HARICA TLS RSA Root CA 2021
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                0A:48:23:A6:60:A4:92:0A:33:EA:93:5B:C5:57:EA:25:4D:BD:12:EE
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
SHA1 Fingerprint=02:2D:05:82:FA:88:CE:14:0C:06:79:DE:7F:14:10:E9:45:D7:A5:6D
SHA256 Fingerprint=D9:5D:0E:8E:DA:79:52:5B:F9:BE:B1:1B:14:D2:10:0D:32:94:98:5F:0C:62:D9:FA:BD:9C:D9:99:EC:CB:7B:1D
-----BEGIN CERTIFICATE-----
MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBs
MQswCQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl
c2VhcmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0Eg
Um9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUzOFoXDTQ1MDIxMzEwNTUzN1owbDEL
MAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
YXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNBIFJv
b3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569l
mwVnlskNJLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE
4VGC/6zStGndLuwRo0Xua2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uv
a9of08WRiFukiZLRgeaMOVig1mlDqa2YUlhu2wr7a89o+uOkXjpFc5gH6l8Cct4M
pbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K5FrZx40d/JiZ+yykgmvw
Kh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEvdmn8kN3b
LW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcY
AuUR0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqB
AGMUuTNe3QvboEUHGjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYq
E613TBoYm5EPWNgGVMWX+Ko/IIqmhaZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHr
W2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQCPxrvrNQKlr9qEgYRtaQQJKQ
CoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8GA1UdEwEB/wQF
MAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE
AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAU
X15QvWiWkKQUEapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3
f5Z2EMVGpdAgS1D0NTsY9FVqQRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxaja
H6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxDQpSbIPDRzbLrLFPCU3hKTwSUQZqP
JzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcRj88YxeMn/ibvBZ3P
zzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5vZSt
jBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0
/L5H9MG0qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pT
BGIBnfHAT+7hOtSLIBD6Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79
aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW
xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU
63ZTGI0RmLo=
-----END CERTIFICATE-----

### Hellenic Academic and Research Institutions Cert. Authority

=== /C=GR/L=Athens/O=Hellenic Academic and Research Institutions Cert. Authority/CN=Hellenic Academic and Research Institutions ECC RootCA 2015
Certificate:
    Data:
        Version: 3 (0x2)
3442
3443
3444
3445
3446
3447
3448


























































































































3449
3450
3451
3452
3453
3454
3455
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=


























































































































-----END CERTIFICATE-----

### IZENPE S.A.

=== /C=ES/O=IZENPE S.A./CN=Izenpe.com
Certificate:
    Data:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
=== /C=US/O=Internet Security Research Group/CN=ISRG Root X2
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            41:d2:9d:d1:72:ea:ee:a7:80:c1:2c:6c:e9:2f:87:52
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Sep  4 00:00:00 2020 GMT
            Not After : Sep 17 16:00:00 2040 GMT
        Subject: C=US, O=Internet Security Research Group, CN=ISRG Root X2
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier: 
                7C:42:96:AE:DE:4B:48:3B:FA:92:F8:9E:8C:CF:6D:8B:A9:72:37:95
SHA1 Fingerprint=BD:B1:B9:3C:D5:97:8D:45:C6:26:14:55:F8:DB:95:C7:5A:D1:53:AF
SHA256 Fingerprint=69:72:9B:8E:15:A8:6E:FC:17:7A:57:AF:B7:17:1D:FC:64:AD:D2:8C:2F:CA:8C:F1:50:7E:34:45:3C:CB:14:70
-----BEGIN CERTIFICATE-----
MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw
CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg
R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00
MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT
ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw
EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW
+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9
ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T
AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI
zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW
tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1
/q4AaOeMSQ+2b1tbFfLn
-----END CERTIFICATE-----

### iTrusChina Co.,Ltd.

=== /C=CN/O=iTrusChina Co.,Ltd./CN=vTrus ECC Root CA
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            6e:6a:bc:59:aa:53:be:98:39:67:a2:d2:6b:a4:3b:e6:6d:1c:d6:da
    Signature Algorithm: ecdsa-with-SHA384
        Validity
            Not Before: Jul 31 07:26:44 2018 GMT
            Not After : Jul 31 07:26:44 2043 GMT
        Subject: C=CN, O=iTrusChina Co.,Ltd., CN=vTrus ECC Root CA
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                98:39:CD:BE:D8:B2:8C:F7:B2:AB:E1:AD:24:AF:7B:7C:A1:DB:1F:CF
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
SHA1 Fingerprint=F6:9C:DB:B0:FC:F6:02:13:B6:52:32:A6:A3:91:3F:16:70:DA:C3:E1
SHA256 Fingerprint=30:FB:BA:2C:32:23:8E:2A:98:54:7A:F9:79:31:E5:50:42:8B:9B:3F:1C:8E:EB:66:33:DC:FA:86:C5:B2:7D:D3
-----BEGIN CERTIFICATE-----
MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMw
RzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAY
BgNVBAMTEXZUcnVzIEVDQyBSb290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDcz
MTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28u
LEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYwEAYHKoZIzj0CAQYF
K4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+cToL0
v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUd
e4BdS49nTPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYD
VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIw
V53dVvHH4+m4SVBrm2nDb+zDfSXkV5UTQJtS0zvzQBm8JsctBp61ezaf9SXUY2sA
AjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQLYgmRWAD5Tfs0aNoJrSEG
GJTO
-----END CERTIFICATE-----
=== /C=CN/O=iTrusChina Co.,Ltd./CN=vTrus Root CA
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            43:e3:71:13:d8:b3:59:14:5d:b7:ce:8c:fd:35:fd:6f:bc:05:8d:45
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Jul 31 07:24:05 2018 GMT
            Not After : Jul 31 07:24:05 2043 GMT
        Subject: C=CN, O=iTrusChina Co.,Ltd., CN=vTrus Root CA
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                54:62:70:63:F1:75:84:43:58:8E:D1:16:20:B1:C6:AC:1A:BC:F6:89
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
SHA1 Fingerprint=84:1A:69:FB:F5:CD:1A:25:34:13:3D:E3:F8:FC:B8:99:D0:C9:14:B7
SHA256 Fingerprint=8A:71:DE:65:59:33:6F:42:6C:26:E5:38:80:D0:0D:88:A1:8D:A4:C6:A9:1F:0D:CB:61:94:E2:06:C5:C9:63:87
-----BEGIN CERTIFICATE-----
MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL
BQAwQzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4x
FjAUBgNVBAMTDXZUcnVzIFJvb3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMx
MDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoGA1UEChMTaVRydXNDaGluYSBDby4s
THRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQAD
ggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZotsSKYc
IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU
AyyNJJrIZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+
GrPSbcKvdmaVayqwlHeFXgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z9
8Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KAYPxMvDVTAWqXcoKv8R1w6Jz1717CbMdH
flqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70kLJrxLT5ZOrpGgrIDajt
J8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2AXPKBlim
0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZN
pGvu/9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQ
UqqzApVg+QxMaPnu1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHW
OXSuTEGC2/KmSNGzm/MzqvOmwMVO9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMB
AAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYgscasGrz2iTAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAKbqSSaet
8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd
nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1j
bhd47F18iMjrjld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvM
Kar5CKXiNxTKsbhm7xqC5PD48acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIiv
TDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJnxDHO2zTlJQNgJXtxmOTAGytfdELS
S8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554WgicEFOwE30z9J4nfr
I8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4sEb9
b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNB
UvupLnKWnyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1P
Ti07NEPhmg4NpGaXutIcSkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929ven
sBxXVsFy6K2ir40zSbofitzmdHxghm+Hl3s=
-----END CERTIFICATE-----

### IZENPE S.A.

=== /C=ES/O=IZENPE S.A./CN=Izenpe.com
Certificate:
    Data:
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3
6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/
3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm
D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS
CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
-----END CERTIFICATE-----

### Sonera


### SSL Corporation

=== /C=US/ST=Texas/L=Houston/O=SSL Corporation/CN=SSL.com EV Root Certification Authority ECC
Certificate:
    Data:
        Version: 3 (0x2)







<
<
<







4855
4856
4857
4858
4859
4860
4861



4862
4863
4864
4865
4866
4867
4868
NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3
6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/
3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm
D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS
CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
-----END CERTIFICATE-----




### SSL Corporation

=== /C=US/ST=Texas/L=Houston/O=SSL Corporation/CN=SSL.com EV Root Certification Authority ECC
Certificate:
    Data:
        Version: 3 (0x2)
5081
5082
5083
5084
5085
5086
5087


























































5088
5089
5090
5091
5092
5093
5094
MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls
XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D
lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn
aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ
YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
-----END CERTIFICATE-----



























































### TeliaSonera

=== /O=TeliaSonera/CN=TeliaSonera Root CA v1
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls
XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D
lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn
aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ
YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
-----END CERTIFICATE-----

### Telia Finland Oyj

=== /C=FI/O=Telia Finland Oyj/CN=Telia Root CA v2
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            01:67:5f:27:d6:fe:7a:e3:e4:ac:be:09:5b:05:9e
    Signature Algorithm: sha256WithRSAEncryption
        Validity
            Not Before: Nov 29 11:55:54 2018 GMT
            Not After : Nov 29 11:55:54 2043 GMT
        Subject: C=FI, O=Telia Finland Oyj, CN=Telia Root CA v2
        X509v3 extensions:
            X509v3 Authority Key Identifier: 
                keyid:72:AC:E4:33:79:AA:45:87:F6:FD:AC:1D:9E:D6:C7:2F:86:D8:24:39

            X509v3 Subject Key Identifier: 
                72:AC:E4:33:79:AA:45:87:F6:FD:AC:1D:9E:D6:C7:2F:86:D8:24:39
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
SHA1 Fingerprint=B9:99:CD:D1:73:50:8A:C4:47:05:08:9C:8C:88:FB:BE:A0:2B:40:CD
SHA256 Fingerprint=24:2B:69:74:2F:CB:1E:5B:2A:BF:98:89:8B:94:57:21:87:54:4E:5B:4D:99:11:78:65:73:62:1F:6A:74:B8:2C
-----BEGIN CERTIFICATE-----
MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQx
CzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UE
AwwQVGVsaWEgUm9vdCBDQSB2MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1
NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZ
MBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZIhvcNAQEBBQADggIP
ADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ76zBq
AMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9
vVYiQJ3q9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9
lRdU2HhE8Qx3FZLgmEKnpNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTOD
n3WhUidhOPFZPY5Q4L15POdslv5e2QJltI5c0BE0312/UqeBAMN/mUWZFdUXyApT
7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW5olWK8jjfN7j/4nlNW4o
6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNrRBH0pUPC
TEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6
WT0EBXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63R
DolUK5X6wK0dmBR4M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZI
pEYslOqodmJHixBTB0hXbOKSTbauBcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGj
YzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7Wxy+G2CQ5MB0GA1UdDgQWBBRy
rOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ
8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi
0f6X+J8wfBj5tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMM
A8iZGok1GTzTyVR8qPAs5m4HeW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBS
SRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+Cy748fdHif64W1lZYudogsYMVoe+K
TTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygCQMez2P2ccGrGKMOF
6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15h2Er
3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMt
Ty3EHD70sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pT
VmBds9hCG1xLEooc6+t9xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAW
ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA
rBPuUBQemMc=
-----END CERTIFICATE-----

### TeliaSonera

=== /O=TeliaSonera/CN=TeliaSonera Root CA v1
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
ZH9bDTMJBzN7Bj8RpFxwPIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW
2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dvDDqPys/cA8GiCcjl/YBeyGBCARsaU1q7
N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYURpFHmygk71dSTlxCnKr3
Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANExdqtvArB
As8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp
5KeXRKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu
1uwJ
-----END CERTIFICATE-----

### Trustis Limited

=== /C=GB/O=Trustis Limited/OU=Trustis FPS Root CA
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            1b:1f:ad:b6:20:f9:24:d3:36:6b:f7:c7:f1:8c:a0:59
    Signature Algorithm: sha1WithRSAEncryption
        Validity
            Not Before: Dec 23 12:14:06 2003 GMT
            Not After : Jan 21 11:36:54 2024 GMT
        Subject: C=GB, O=Trustis Limited, OU=Trustis FPS Root CA
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Authority Key Identifier: 
                keyid:BA:FA:71:25:79:8B:57:41:25:21:86:0B:71:EB:B2:64:0E:8B:21:67

            X509v3 Subject Key Identifier: 
                BA:FA:71:25:79:8B:57:41:25:21:86:0B:71:EB:B2:64:0E:8B:21:67
SHA1 Fingerprint=3B:C0:38:0B:33:C3:F6:A6:0C:86:15:22:93:D9:DF:F5:4B:81:C0:04
SHA256 Fingerprint=C1:B4:82:99:AB:A5:20:8F:E9:63:0A:CE:55:CA:68:A0:3E:DA:5A:51:9C:88:02:A0:D3:A6:73:BE:8F:8E:55:7D
-----BEGIN CERTIFICATE-----
MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBF
MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQL
ExNUcnVzdGlzIEZQUyBSb290IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTEx
MzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNVBAoTD1RydXN0aXMgTGltaXRlZDEc
MBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQRUN+
AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihH
iTHcDnlkH5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjj
vSkCqPoc4Vu5g6hBSLwacY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA
0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zto3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlB
OrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEAAaNTMFEwDwYDVR0TAQH/
BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAdBgNVHQ4E
FgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01
GX2cGE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmW
zaD+vkAMXBJV+JOCyinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP4
1BIy+Q7DsdwyhEQsb8tGD+pmQQ9P8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZE
f1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHVl/9D7S3B2l0pKoU/rGXuhg8F
jZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYliB6XzCGcKQEN
ZetX2fNXlrtIzYE=
-----END CERTIFICATE-----

### Trustwave Holdings, Inc.

=== /C=US/ST=Illinois/L=Chicago/O=Trustwave Holdings, Inc./CN=Trustwave Global Certification Authority
Certificate:
    Data:







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







5943
5944
5945
5946
5947
5948
5949













































5950
5951
5952
5953
5954
5955
5956
ZH9bDTMJBzN7Bj8RpFxwPIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW
2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dvDDqPys/cA8GiCcjl/YBeyGBCARsaU1q7
N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYURpFHmygk71dSTlxCnKr3
Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANExdqtvArB
As8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp
5KeXRKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu
1uwJ













































-----END CERTIFICATE-----

### Trustwave Holdings, Inc.

=== /C=US/ST=Illinois/L=Chicago/O=Trustwave Holdings, Inc./CN=Trustwave Global Certification Authority
Certificate:
    Data:
Changes to jni/libressl/compile.
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2020 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#





|







1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
Changes to jni/libressl/configure.
1
2
3
4
5
6
7
8
9
10
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libressl 3.5.3.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.


|







1
2
3
4
5
6
7
8
9
10
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libressl 3.6.1.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
subdirs=
MFLAGS=
MAKEFLAGS=

# Identity of this package.
PACKAGE_NAME='libressl'
PACKAGE_TARNAME='libressl'
PACKAGE_VERSION='3.5.3'
PACKAGE_STRING='libressl 3.5.3'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H







|
|







583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
subdirs=
MFLAGS=
MAKEFLAGS=

# Identity of this package.
PACKAGE_NAME='libressl'
PACKAGE_TARNAME='libressl'
PACKAGE_VERSION='3.6.1'
PACKAGE_STRING='libressl 3.6.1'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
792
793
794
795
796
797
798



799
800
801
802
803
804
805
LDFLAGS
CFLAGS
CC
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
AM_V



am__untar
am__tar
AMTAR
am__leading_dot
SET_MAKE
AWK
mkdir_p







>
>
>







792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
LDFLAGS
CFLAGS
CC
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
AM_V
CSCOPE
ETAGS
CTAGS
am__untar
am__tar
AMTAR
am__leading_dot
SET_MAKE
AWK
mkdir_p
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures libressl 3.5.3 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.







|







1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures libressl 3.6.1 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of libressl 3.5.3:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]







|







1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of libressl 3.6.1:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
libressl configure 3.5.3
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit







|







1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
libressl configure 3.6.1
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
  as_fn_set_status $ac_retval

} # ac_fn_c_compute_int
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by libressl $as_me 3.5.3, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{







|







2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
  as_fn_set_status $ac_retval

} # ac_fn_c_compute_int
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by libressl $as_me 3.6.1, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu


LIBCRYPTO_VERSION=49:0:0

LIBSSL_VERSION=52:0:0

LIBTLS_VERSION=25:0:0


ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
  if test -f "$ac_dir/install-sh"; then
    ac_aux_dir=$ac_dir
    ac_install_sh="$ac_aux_dir/install-sh -c"







|

|

|







2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu


LIBCRYPTO_VERSION=50:0:0

LIBSSL_VERSION=53:0:0

LIBTLS_VERSION=26:0:0


ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
  if test -f "$ac_dir/install-sh"; then
    ac_aux_dir=$ac_dir
    ac_install_sh="$ac_aux_dir/install-sh -c"
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
    CYGPATH_W=echo
  fi
fi


# Define the identity of the package.
 PACKAGE='libressl'
 VERSION='3.5.3'


cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
_ACEOF









|







3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
    CYGPATH_W=echo
  fi
fi


# Define the identity of the package.
 PACKAGE='libressl'
 VERSION='3.6.1'


cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
_ACEOF


3170
3171
3172
3173
3174
3175
3176














3177
3178
3179
3180
3181
3182
3183
_am_tools='gnutar  pax cpio none'

am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'




















# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes.  So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.







>
>
>
>
>
>
>
>
>
>
>
>
>
>







3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
_am_tools='gnutar  pax cpio none'

am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'





# Variables for tags utilities; see am/tags.am
if test -z "$CTAGS"; then
  CTAGS=ctags
fi

if test -z "$ETAGS"; then
  ETAGS=etags
fi

if test -z "$CSCOPE"; then
  CSCOPE=cscope
fi



# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes.  So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
if test "x$ac_cv_func_funopen" = xyes; then :

fi



# Check for libc headers
for ac_header in endian.h err.h readpassphrase.h
do :
  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF







|







12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
if test "x$ac_cv_func_funopen" = xyes; then :

fi



# Check for libc headers
for ac_header in endian.h machine/endian.h err.h readpassphrase.h
do :
  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libressl $as_me 3.5.3, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@







|







14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libressl $as_me 3.6.1, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751

Report bugs to the package provider."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libressl config.status 3.5.3
configured by $0, generated by GNU Autoconf 2.69,
  with options \\"\$ac_cs_config\\"

Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."








|







14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768

Report bugs to the package provider."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libressl config.status 3.6.1
configured by $0, generated by GNU Autoconf 2.69,
  with options \\"\$ac_cs_config\\"

Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."

Changes to jni/libressl/crypto/CMakeLists.txt.
329
330
331
332
333
334
335

336
337
338
339
340
341
342
343
344

345
346
347
348
349
350
351
	bio/bss_file.c
	bio/bss_mem.c
	bio/bss_null.c
	bio/bss_sock.c
	bn/bn_add.c
	bn/bn_asm.c
	bn/bn_blind.c

	bn/bn_const.c
	bn/bn_ctx.c
	bn/bn_depr.c
	bn/bn_div.c
	bn/bn_err.c
	bn/bn_exp.c
	bn/bn_exp2.c
	bn/bn_gcd.c
	bn/bn_gf2m.c

	bn/bn_kron.c
	bn/bn_lib.c
	bn/bn_mod.c
	bn/bn_mont.c
	bn/bn_mpi.c
	bn/bn_mul.c
	bn/bn_nist.c







>









>







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
	bio/bss_file.c
	bio/bss_mem.c
	bio/bss_null.c
	bio/bss_sock.c
	bn/bn_add.c
	bn/bn_asm.c
	bn/bn_blind.c
	bn/bn_bpsw.c
	bn/bn_const.c
	bn/bn_ctx.c
	bn/bn_depr.c
	bn/bn_div.c
	bn/bn_err.c
	bn/bn_exp.c
	bn/bn_exp2.c
	bn/bn_gcd.c
	bn/bn_gf2m.c
	bn/bn_isqrt.c
	bn/bn_kron.c
	bn/bn_lib.c
	bn/bn_mod.c
	bn/bn_mont.c
	bn/bn_mpi.c
	bn/bn_mul.c
	bn/bn_nist.c
598
599
600
601
602
603
604


605
606
607
608
609
610
611
	hmac/hm_pmeth.c
	hmac/hmac.c
	idea/i_cbc.c
	idea/i_cfb64.c
	idea/i_ecb.c
	idea/i_ofb64.c
	idea/i_skey.c


	lhash/lh_stats.c
	lhash/lhash.c
	md4/md4_dgst.c
	md4/md4_one.c
	md5/md5_dgst.c
	md5/md5_one.c
	modes/cbc128.c







>
>







600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
	hmac/hm_pmeth.c
	hmac/hmac.c
	idea/i_cbc.c
	idea/i_cfb64.c
	idea/i_ecb.c
	idea/i_ofb64.c
	idea/i_skey.c
	kdf/hkdf_evp.c
	kdf/kdf_err.c
	lhash/lh_stats.c
	lhash/lhash.c
	md4/md4_dgst.c
	md4/md4_one.c
	md5/md5_dgst.c
	md5/md5_one.c
	modes/cbc128.c
650
651
652
653
654
655
656

657
658
659
660
661
662
663
	pkcs12/p12_init.c
	pkcs12/p12_key.c
	pkcs12/p12_kiss.c
	pkcs12/p12_mutl.c
	pkcs12/p12_npas.c
	pkcs12/p12_p8d.c
	pkcs12/p12_p8e.c

	pkcs12/p12_utl.c
	pkcs12/pk12err.c
	pkcs7/bio_pk7.c
	pkcs7/pk7_asn1.c
	pkcs7/pk7_attr.c
	pkcs7/pk7_doit.c
	pkcs7/pk7_lib.c







>







654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
	pkcs12/p12_init.c
	pkcs12/p12_key.c
	pkcs12/p12_kiss.c
	pkcs12/p12_mutl.c
	pkcs12/p12_npas.c
	pkcs12/p12_p8d.c
	pkcs12/p12_p8e.c
	pkcs12/p12_sbag.c
	pkcs12/p12_utl.c
	pkcs12/pk12err.c
	pkcs7/bio_pk7.c
	pkcs7/pk7_asn1.c
	pkcs7/pk7_attr.c
	pkcs7/pk7_doit.c
	pkcs7/pk7_lib.c
990
991
992
993
994
995
996

997
998
999
1000
1001
1002
1003
		ec
		ecdh
		ecdsa
		evp
		hmac
		modes
		ocsp

		rsa
		x509
		../include/compat
	PUBLIC
		../include)

add_library(crypto $<TARGET_OBJECTS:crypto_obj>)







>







995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
		ec
		ecdh
		ecdsa
		evp
		hmac
		modes
		ocsp
		pkcs12
		rsa
		x509
		../include/compat
	PUBLIC
		../include)

add_library(crypto $<TARGET_OBJECTS:crypto_obj>)
Changes to jni/libressl/crypto/Makefile.am.
11
12
13
14
15
16
17

18
19
20
21
22
23
24
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ec
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ecdh
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ecdsa
AM_CPPFLAGS += -I$(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I$(top_srcdir)/crypto/hmac
AM_CPPFLAGS += -I$(top_srcdir)/crypto/modes
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ocsp

AM_CPPFLAGS += -I$(top_srcdir)/crypto/rsa
AM_CPPFLAGS += -I$(top_srcdir)/crypto/x509
AM_CPPFLAGS += -I$(top_srcdir)/crypto

noinst_LTLIBRARIES = libcompat.la

if ENABLE_LIBTLS_ONLY







>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ec
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ecdh
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ecdsa
AM_CPPFLAGS += -I$(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I$(top_srcdir)/crypto/hmac
AM_CPPFLAGS += -I$(top_srcdir)/crypto/modes
AM_CPPFLAGS += -I$(top_srcdir)/crypto/ocsp
AM_CPPFLAGS += -I$(top_srcdir)/crypto/pkcs12
AM_CPPFLAGS += -I$(top_srcdir)/crypto/rsa
AM_CPPFLAGS += -I$(top_srcdir)/crypto/x509
AM_CPPFLAGS += -I$(top_srcdir)/crypto

noinst_LTLIBRARIES = libcompat.la

if ENABLE_LIBTLS_ONLY
409
410
411
412
413
414
415

416
417
418
419
420
421
422
423
424

425
426
427
428
429
430
431
libcrypto_la_SOURCES += bio/bss_sock.c
noinst_HEADERS += bio/bio_local.h

# bn
libcrypto_la_SOURCES += bn/bn_add.c
libcrypto_la_SOURCES += bn/bn_asm.c
libcrypto_la_SOURCES += bn/bn_blind.c

libcrypto_la_SOURCES += bn/bn_const.c
libcrypto_la_SOURCES += bn/bn_ctx.c
libcrypto_la_SOURCES += bn/bn_depr.c
libcrypto_la_SOURCES += bn/bn_div.c
libcrypto_la_SOURCES += bn/bn_err.c
libcrypto_la_SOURCES += bn/bn_exp.c
libcrypto_la_SOURCES += bn/bn_exp2.c
libcrypto_la_SOURCES += bn/bn_gcd.c
libcrypto_la_SOURCES += bn/bn_gf2m.c

libcrypto_la_SOURCES += bn/bn_kron.c
libcrypto_la_SOURCES += bn/bn_lib.c
libcrypto_la_SOURCES += bn/bn_mod.c
libcrypto_la_SOURCES += bn/bn_mont.c
libcrypto_la_SOURCES += bn/bn_mpi.c
libcrypto_la_SOURCES += bn/bn_mul.c
libcrypto_la_SOURCES += bn/bn_nist.c







>









>







410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
libcrypto_la_SOURCES += bio/bss_sock.c
noinst_HEADERS += bio/bio_local.h

# bn
libcrypto_la_SOURCES += bn/bn_add.c
libcrypto_la_SOURCES += bn/bn_asm.c
libcrypto_la_SOURCES += bn/bn_blind.c
libcrypto_la_SOURCES += bn/bn_bpsw.c
libcrypto_la_SOURCES += bn/bn_const.c
libcrypto_la_SOURCES += bn/bn_ctx.c
libcrypto_la_SOURCES += bn/bn_depr.c
libcrypto_la_SOURCES += bn/bn_div.c
libcrypto_la_SOURCES += bn/bn_err.c
libcrypto_la_SOURCES += bn/bn_exp.c
libcrypto_la_SOURCES += bn/bn_exp2.c
libcrypto_la_SOURCES += bn/bn_gcd.c
libcrypto_la_SOURCES += bn/bn_gf2m.c
libcrypto_la_SOURCES += bn/bn_isqrt.c
libcrypto_la_SOURCES += bn/bn_kron.c
libcrypto_la_SOURCES += bn/bn_lib.c
libcrypto_la_SOURCES += bn/bn_mod.c
libcrypto_la_SOURCES += bn/bn_mont.c
libcrypto_la_SOURCES += bn/bn_mpi.c
libcrypto_la_SOURCES += bn/bn_mul.c
libcrypto_la_SOURCES += bn/bn_nist.c
757
758
759
760
761
762
763




764
765
766
767
768
769
770
libcrypto_la_SOURCES += idea/i_cbc.c
libcrypto_la_SOURCES += idea/i_cfb64.c
libcrypto_la_SOURCES += idea/i_ecb.c
libcrypto_la_SOURCES += idea/i_ofb64.c
libcrypto_la_SOURCES += idea/i_skey.c
noinst_HEADERS += idea/idea_lcl.h





# lhash
libcrypto_la_SOURCES += lhash/lh_stats.c
libcrypto_la_SOURCES += lhash/lhash.c

# md4
libcrypto_la_SOURCES += md4/md4_dgst.c
libcrypto_la_SOURCES += md4/md4_one.c







>
>
>
>







760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
libcrypto_la_SOURCES += idea/i_cbc.c
libcrypto_la_SOURCES += idea/i_cfb64.c
libcrypto_la_SOURCES += idea/i_ecb.c
libcrypto_la_SOURCES += idea/i_ofb64.c
libcrypto_la_SOURCES += idea/i_skey.c
noinst_HEADERS += idea/idea_lcl.h

# kdf
libcrypto_la_SOURCES += kdf/hkdf_evp.c
libcrypto_la_SOURCES += kdf/kdf_err.c

# lhash
libcrypto_la_SOURCES += lhash/lh_stats.c
libcrypto_la_SOURCES += lhash/lhash.c

# md4
libcrypto_la_SOURCES += md4/md4_dgst.c
libcrypto_la_SOURCES += md4/md4_one.c
830
831
832
833
834
835
836

837
838

839
840
841
842
843
844
845
libcrypto_la_SOURCES += pkcs12/p12_init.c
libcrypto_la_SOURCES += pkcs12/p12_key.c
libcrypto_la_SOURCES += pkcs12/p12_kiss.c
libcrypto_la_SOURCES += pkcs12/p12_mutl.c
libcrypto_la_SOURCES += pkcs12/p12_npas.c
libcrypto_la_SOURCES += pkcs12/p12_p8d.c
libcrypto_la_SOURCES += pkcs12/p12_p8e.c

libcrypto_la_SOURCES += pkcs12/p12_utl.c
libcrypto_la_SOURCES += pkcs12/pk12err.c


# pkcs7
libcrypto_la_SOURCES += pkcs7/bio_pk7.c
libcrypto_la_SOURCES += pkcs7/pk7_asn1.c
libcrypto_la_SOURCES += pkcs7/pk7_attr.c
libcrypto_la_SOURCES += pkcs7/pk7_doit.c
libcrypto_la_SOURCES += pkcs7/pk7_lib.c







>


>







837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
libcrypto_la_SOURCES += pkcs12/p12_init.c
libcrypto_la_SOURCES += pkcs12/p12_key.c
libcrypto_la_SOURCES += pkcs12/p12_kiss.c
libcrypto_la_SOURCES += pkcs12/p12_mutl.c
libcrypto_la_SOURCES += pkcs12/p12_npas.c
libcrypto_la_SOURCES += pkcs12/p12_p8d.c
libcrypto_la_SOURCES += pkcs12/p12_p8e.c
libcrypto_la_SOURCES += pkcs12/p12_sbag.c
libcrypto_la_SOURCES += pkcs12/p12_utl.c
libcrypto_la_SOURCES += pkcs12/pk12err.c
noinst_HEADERS += pkcs12/pkcs12_local.h

# pkcs7
libcrypto_la_SOURCES += pkcs7/bio_pk7.c
libcrypto_la_SOURCES += pkcs7/pk7_asn1.c
libcrypto_la_SOURCES += pkcs7/pk7_attr.c
libcrypto_la_SOURCES += pkcs7/pk7_doit.c
libcrypto_la_SOURCES += pkcs7/pk7_lib.c
920
921
922
923
924
925
926

927
928
929
930
931
932
933
libcrypto_la_SOURCES += ts/ts_req_print.c
libcrypto_la_SOURCES += ts/ts_req_utils.c
libcrypto_la_SOURCES += ts/ts_rsp_print.c
libcrypto_la_SOURCES += ts/ts_rsp_sign.c
libcrypto_la_SOURCES += ts/ts_rsp_utils.c
libcrypto_la_SOURCES += ts/ts_rsp_verify.c
libcrypto_la_SOURCES += ts/ts_verify_ctx.c


# txt_db
libcrypto_la_SOURCES += txt_db/txt_db.c

# ui
libcrypto_la_SOURCES += ui/ui_err.c
libcrypto_la_SOURCES += ui/ui_lib.c







>







929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
libcrypto_la_SOURCES += ts/ts_req_print.c
libcrypto_la_SOURCES += ts/ts_req_utils.c
libcrypto_la_SOURCES += ts/ts_rsp_print.c
libcrypto_la_SOURCES += ts/ts_rsp_sign.c
libcrypto_la_SOURCES += ts/ts_rsp_utils.c
libcrypto_la_SOURCES += ts/ts_rsp_verify.c
libcrypto_la_SOURCES += ts/ts_verify_ctx.c
noinst_HEADERS += ts/ts_local.h

# txt_db
libcrypto_la_SOURCES += txt_db/txt_db.c

# ui
libcrypto_la_SOURCES += ui/ui_err.c
libcrypto_la_SOURCES += ui/ui_lib.c
Changes to jni/libressl/crypto/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
376
377
378
379
380
381
382
383
384

385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
	bf/bf_ecb.c bf/bf_enc.c bf/bf_ofb64.c bf/bf_skey.c \
	bio/b_dump.c bio/b_posix.c bio/b_print.c bio/b_sock.c \
	bio/b_win.c bio/bf_buff.c bio/bf_nbio.c bio/bf_null.c \
	bio/bio_cb.c bio/bio_err.c bio/bio_lib.c bio/bio_meth.c \
	bio/bss_acpt.c bio/bss_bio.c bio/bss_conn.c bio/bss_dgram.c \
	bio/bss_fd.c bio/bss_file.c bio/bss_log.c bio/bss_mem.c \
	bio/bss_null.c bio/bss_sock.c bn/bn_add.c bn/bn_asm.c \
	bn/bn_blind.c bn/bn_const.c bn/bn_ctx.c bn/bn_depr.c \
	bn/bn_div.c bn/bn_err.c bn/bn_exp.c bn/bn_exp2.c bn/bn_gcd.c \

	bn/bn_gf2m.c bn/bn_kron.c bn/bn_lib.c bn/bn_mod.c bn/bn_mont.c \
	bn/bn_mpi.c bn/bn_mul.c bn/bn_nist.c bn/bn_prime.c \
	bn/bn_print.c bn/bn_rand.c bn/bn_recp.c bn/bn_shift.c \
	bn/bn_sqr.c bn/bn_sqrt.c bn/bn_word.c bn/bn_x931p.c \
	buffer/buf_err.c buffer/buf_str.c buffer/buffer.c \
	bytestring/bs_ber.c bytestring/bs_cbb.c bytestring/bs_cbs.c \
	camellia/cmll_cfb.c camellia/cmll_ctr.c camellia/cmll_ecb.c \
	camellia/cmll_misc.c camellia/cmll_ofb.c cast/c_cfb64.c \
	cast/c_ecb.c cast/c_enc.c cast/c_ofb64.c cast/c_skey.c \
	chacha/chacha.c cmac/cm_ameth.c cmac/cm_pmeth.c cmac/cmac.c \
	cms/cms_asn1.c cms/cms_att.c cms/cms_cd.c cms/cms_dd.c \
	cms/cms_enc.c cms/cms_env.c cms/cms_err.c cms/cms_ess.c \
	cms/cms_io.c cms/cms_kari.c cms/cms_lib.c cms/cms_pwri.c \
	cms/cms_sd.c cms/cms_smime.c comp/c_rle.c comp/c_zlib.c \
	comp/comp_err.c comp/comp_lib.c conf/conf_api.c \
	conf/conf_def.c conf/conf_err.c conf/conf_lib.c \
	conf/conf_mall.c conf/conf_mod.c conf/conf_sap.c ct/ct_b64.c \
	ct/ct_err.c ct/ct_log.c ct/ct_oct.c ct/ct_policy.c ct/ct_prn.c \
	ct/ct_sct.c ct/ct_sct_ctx.c ct/ct_vfy.c ct/ct_x509v3.c \
	curve25519/curve25519-generic.c curve25519/curve25519.c \
	des/cbc_cksm.c des/cbc_enc.c des/cfb64ede.c des/cfb64enc.c \
	des/cfb_enc.c des/des_enc.c des/ecb3_enc.c des/ecb_enc.c \







|
|
>
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|







376
377
378
379
380
381
382
383
384
385
386
387
388

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
	bf/bf_ecb.c bf/bf_enc.c bf/bf_ofb64.c bf/bf_skey.c \
	bio/b_dump.c bio/b_posix.c bio/b_print.c bio/b_sock.c \
	bio/b_win.c bio/bf_buff.c bio/bf_nbio.c bio/bf_null.c \
	bio/bio_cb.c bio/bio_err.c bio/bio_lib.c bio/bio_meth.c \
	bio/bss_acpt.c bio/bss_bio.c bio/bss_conn.c bio/bss_dgram.c \
	bio/bss_fd.c bio/bss_file.c bio/bss_log.c bio/bss_mem.c \
	bio/bss_null.c bio/bss_sock.c bn/bn_add.c bn/bn_asm.c \
	bn/bn_blind.c bn/bn_bpsw.c bn/bn_const.c bn/bn_ctx.c \
	bn/bn_depr.c bn/bn_div.c bn/bn_err.c bn/bn_exp.c bn/bn_exp2.c \
	bn/bn_gcd.c bn/bn_gf2m.c bn/bn_isqrt.c bn/bn_kron.c \
	bn/bn_lib.c bn/bn_mod.c bn/bn_mont.c bn/bn_mpi.c bn/bn_mul.c \
	bn/bn_nist.c bn/bn_prime.c bn/bn_print.c bn/bn_rand.c \
	bn/bn_recp.c bn/bn_shift.c bn/bn_sqr.c bn/bn_sqrt.c \

	bn/bn_word.c bn/bn_x931p.c buffer/buf_err.c buffer/buf_str.c \
	buffer/buffer.c bytestring/bs_ber.c bytestring/bs_cbb.c \
	bytestring/bs_cbs.c camellia/cmll_cfb.c camellia/cmll_ctr.c \
	camellia/cmll_ecb.c camellia/cmll_misc.c camellia/cmll_ofb.c \
	cast/c_cfb64.c cast/c_ecb.c cast/c_enc.c cast/c_ofb64.c \
	cast/c_skey.c chacha/chacha.c cmac/cm_ameth.c cmac/cm_pmeth.c \
	cmac/cmac.c cms/cms_asn1.c cms/cms_att.c cms/cms_cd.c \
	cms/cms_dd.c cms/cms_enc.c cms/cms_env.c cms/cms_err.c \
	cms/cms_ess.c cms/cms_io.c cms/cms_kari.c cms/cms_lib.c \
	cms/cms_pwri.c cms/cms_sd.c cms/cms_smime.c comp/c_rle.c \
	comp/c_zlib.c comp/comp_err.c comp/comp_lib.c conf/conf_api.c \
	conf/conf_def.c conf/conf_err.c conf/conf_lib.c \
	conf/conf_mall.c conf/conf_mod.c conf/conf_sap.c ct/ct_b64.c \
	ct/ct_err.c ct/ct_log.c ct/ct_oct.c ct/ct_policy.c ct/ct_prn.c \
	ct/ct_sct.c ct/ct_sct_ctx.c ct/ct_vfy.c ct/ct_x509v3.c \
	curve25519/curve25519-generic.c curve25519/curve25519.c \
	des/cbc_cksm.c des/cbc_enc.c des/cfb64ede.c des/cfb64enc.c \
	des/cfb_enc.c des/des_enc.c des/ecb3_enc.c des/ecb_enc.c \
449
450
451
452
453
454
455
456

457
458
459
460
461
462
463
464
465
466
467
468
469
470

471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
	gost/gost2814789.c gost/gost89_keywrap.c gost/gost89_params.c \
	gost/gost89imit_ameth.c gost/gost89imit_pmeth.c \
	gost/gost_asn1.c gost/gost_err.c gost/gostr341001.c \
	gost/gostr341001_ameth.c gost/gostr341001_key.c \
	gost/gostr341001_params.c gost/gostr341001_pmeth.c \
	gost/gostr341194.c gost/streebog.c hkdf/hkdf.c hmac/hm_ameth.c \
	hmac/hm_pmeth.c hmac/hmac.c idea/i_cbc.c idea/i_cfb64.c \
	idea/i_ecb.c idea/i_ofb64.c idea/i_skey.c lhash/lh_stats.c \

	lhash/lhash.c md4/md4_dgst.c md4/md4_one.c md5/md5_dgst.c \
	md5/md5_one.c modes/cbc128.c modes/ccm128.c modes/cfb128.c \
	modes/ctr128.c modes/cts128.c modes/gcm128.c modes/ofb128.c \
	modes/xts128.c objects/o_names.c objects/obj_dat.c \
	objects/obj_err.c objects/obj_lib.c objects/obj_xref.c \
	ocsp/ocsp_asn.c ocsp/ocsp_cl.c ocsp/ocsp_err.c ocsp/ocsp_ext.c \
	ocsp/ocsp_ht.c ocsp/ocsp_lib.c ocsp/ocsp_prn.c ocsp/ocsp_srv.c \
	ocsp/ocsp_vfy.c pem/pem_all.c pem/pem_err.c pem/pem_info.c \
	pem/pem_lib.c pem/pem_oth.c pem/pem_pk8.c pem/pem_pkey.c \
	pem/pem_sign.c pem/pem_x509.c pem/pem_xaux.c pem/pvkfmt.c \
	pkcs12/p12_add.c pkcs12/p12_asn.c pkcs12/p12_attr.c \
	pkcs12/p12_crpt.c pkcs12/p12_crt.c pkcs12/p12_decr.c \
	pkcs12/p12_init.c pkcs12/p12_key.c pkcs12/p12_kiss.c \
	pkcs12/p12_mutl.c pkcs12/p12_npas.c pkcs12/p12_p8d.c \

	pkcs12/p12_p8e.c pkcs12/p12_utl.c pkcs12/pk12err.c \
	pkcs7/bio_pk7.c pkcs7/pk7_asn1.c pkcs7/pk7_attr.c \
	pkcs7/pk7_doit.c pkcs7/pk7_lib.c pkcs7/pk7_mime.c \
	pkcs7/pk7_smime.c pkcs7/pkcs7err.c poly1305/poly1305.c \
	rand/rand_err.c rand/rand_lib.c rand/randfile.c rc2/rc2_cbc.c \
	rc2/rc2_ecb.c rc2/rc2_skey.c rc2/rc2cfb64.c rc2/rc2ofb64.c \
	ripemd/rmd_dgst.c ripemd/rmd_one.c rsa/rsa_ameth.c \
	rsa/rsa_asn1.c rsa/rsa_chk.c rsa/rsa_crpt.c rsa/rsa_depr.c \
	rsa/rsa_eay.c rsa/rsa_err.c rsa/rsa_gen.c rsa/rsa_lib.c \
	rsa/rsa_meth.c rsa/rsa_none.c rsa/rsa_oaep.c rsa/rsa_pk1.c \
	rsa/rsa_pmeth.c rsa/rsa_prn.c rsa/rsa_pss.c rsa/rsa_saos.c \
	rsa/rsa_sign.c rsa/rsa_x931.c sha/sha1_one.c sha/sha1dgst.c \
	sha/sha256.c sha/sha512.c sm3/sm3.c sm4/sm4.c stack/stack.c \
	ts/ts_asn1.c ts/ts_conf.c ts/ts_err.c ts/ts_lib.c \
	ts/ts_req_print.c ts/ts_req_utils.c ts/ts_rsp_print.c \
	ts/ts_rsp_sign.c ts/ts_rsp_utils.c ts/ts_rsp_verify.c \
	ts/ts_verify_ctx.c txt_db/txt_db.c ui/ui_err.c ui/ui_lib.c \
	ui/ui_openssl.c ui/ui_openssl_win.c ui/ui_util.c \
	whrlpool/wp_dgst.c x509/by_dir.c x509/by_file.c x509/by_mem.c \
	x509/pcy_cache.c x509/pcy_data.c x509/pcy_lib.c x509/pcy_map.c \
	x509/pcy_node.c x509/pcy_tree.c x509/x509_addr.c \
	x509/x509_akey.c x509/x509_akeya.c x509/x509_alt.c \
	x509/x509_att.c x509/x509_asid.c x509/x509_bcons.c \
	x509/x509_bitst.c x509/x509_cmp.c x509/x509_conf.c \
	x509/x509_constraints.c x509/x509_cpols.c x509/x509_crld.c \
	x509/x509_d2.c x509/x509_def.c x509/x509_enum.c \
	x509/x509_err.c x509/x509_ext.c x509/x509_extku.c \
	x509/x509_genn.c x509/x509_ia5.c x509/x509_info.c \
	x509/x509_int.c x509/x509_issuer_cache.c x509/x509_lib.c \
	x509/x509_lu.c x509/x509_ncons.c x509/x509_obj.c \
	x509/x509_ocsp.c x509/x509_pci.c x509/x509_pcia.c \
	x509/x509_pcons.c x509/x509_pku.c x509/x509_pmaps.c \
	x509/x509_prn.c x509/x509_purp.c x509/x509_r2x.c \
	x509/x509_req.c x509/x509_set.c x509/x509_skey.c \
	x509/x509_sxnet.c x509/x509_trs.c x509/x509_txt.c \
	x509/x509_utl.c x509/x509_v3.c x509/x509_verify.c \
	x509/x509_vfy.c x509/x509_vpm.c x509/x509cset.c \
	x509/x509name.c x509/x509rset.c x509/x509spki.c \
	x509/x509type.c x509/x_all.c
am__objects_31 = aes/libcrypto_la-aes-elf-armv4.lo \
	bn/libcrypto_la-gf2m-elf-armv4.lo \
	bn/libcrypto_la-mont-elf-armv4.lo \
	sha/libcrypto_la-sha1-elf-armv4.lo \
	sha/libcrypto_la-sha512-elf-armv4.lo \
	sha/libcrypto_la-sha256-elf-armv4.lo \
	modes/libcrypto_la-ghash-elf-armv4.lo \







|
>
|
|
|
|
|
|
|
|
|
<
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466

467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484

485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
	gost/gost2814789.c gost/gost89_keywrap.c gost/gost89_params.c \
	gost/gost89imit_ameth.c gost/gost89imit_pmeth.c \
	gost/gost_asn1.c gost/gost_err.c gost/gostr341001.c \
	gost/gostr341001_ameth.c gost/gostr341001_key.c \
	gost/gostr341001_params.c gost/gostr341001_pmeth.c \
	gost/gostr341194.c gost/streebog.c hkdf/hkdf.c hmac/hm_ameth.c \
	hmac/hm_pmeth.c hmac/hmac.c idea/i_cbc.c idea/i_cfb64.c \
	idea/i_ecb.c idea/i_ofb64.c idea/i_skey.c kdf/hkdf_evp.c \
	kdf/kdf_err.c lhash/lh_stats.c lhash/lhash.c md4/md4_dgst.c \
	md4/md4_one.c md5/md5_dgst.c md5/md5_one.c modes/cbc128.c \
	modes/ccm128.c modes/cfb128.c modes/ctr128.c modes/cts128.c \
	modes/gcm128.c modes/ofb128.c modes/xts128.c objects/o_names.c \
	objects/obj_dat.c objects/obj_err.c objects/obj_lib.c \
	objects/obj_xref.c ocsp/ocsp_asn.c ocsp/ocsp_cl.c \
	ocsp/ocsp_err.c ocsp/ocsp_ext.c ocsp/ocsp_ht.c ocsp/ocsp_lib.c \
	ocsp/ocsp_prn.c ocsp/ocsp_srv.c ocsp/ocsp_vfy.c pem/pem_all.c \
	pem/pem_err.c pem/pem_info.c pem/pem_lib.c pem/pem_oth.c \
	pem/pem_pk8.c pem/pem_pkey.c pem/pem_sign.c pem/pem_x509.c \

	pem/pem_xaux.c pem/pvkfmt.c pkcs12/p12_add.c pkcs12/p12_asn.c \
	pkcs12/p12_attr.c pkcs12/p12_crpt.c pkcs12/p12_crt.c \
	pkcs12/p12_decr.c pkcs12/p12_init.c pkcs12/p12_key.c \
	pkcs12/p12_kiss.c pkcs12/p12_mutl.c pkcs12/p12_npas.c \
	pkcs12/p12_p8d.c pkcs12/p12_p8e.c pkcs12/p12_sbag.c \
	pkcs12/p12_utl.c pkcs12/pk12err.c pkcs7/bio_pk7.c \
	pkcs7/pk7_asn1.c pkcs7/pk7_attr.c pkcs7/pk7_doit.c \
	pkcs7/pk7_lib.c pkcs7/pk7_mime.c pkcs7/pk7_smime.c \
	pkcs7/pkcs7err.c poly1305/poly1305.c rand/rand_err.c \
	rand/rand_lib.c rand/randfile.c rc2/rc2_cbc.c rc2/rc2_ecb.c \
	rc2/rc2_skey.c rc2/rc2cfb64.c rc2/rc2ofb64.c ripemd/rmd_dgst.c \
	ripemd/rmd_one.c rsa/rsa_ameth.c rsa/rsa_asn1.c rsa/rsa_chk.c \
	rsa/rsa_crpt.c rsa/rsa_depr.c rsa/rsa_eay.c rsa/rsa_err.c \
	rsa/rsa_gen.c rsa/rsa_lib.c rsa/rsa_meth.c rsa/rsa_none.c \
	rsa/rsa_oaep.c rsa/rsa_pk1.c rsa/rsa_pmeth.c rsa/rsa_prn.c \
	rsa/rsa_pss.c rsa/rsa_saos.c rsa/rsa_sign.c rsa/rsa_x931.c \
	sha/sha1_one.c sha/sha1dgst.c sha/sha256.c sha/sha512.c \
	sm3/sm3.c sm4/sm4.c stack/stack.c ts/ts_asn1.c ts/ts_conf.c \

	ts/ts_err.c ts/ts_lib.c ts/ts_req_print.c ts/ts_req_utils.c \
	ts/ts_rsp_print.c ts/ts_rsp_sign.c ts/ts_rsp_utils.c \
	ts/ts_rsp_verify.c ts/ts_verify_ctx.c txt_db/txt_db.c \
	ui/ui_err.c ui/ui_lib.c ui/ui_openssl.c ui/ui_openssl_win.c \
	ui/ui_util.c whrlpool/wp_dgst.c x509/by_dir.c x509/by_file.c \
	x509/by_mem.c x509/pcy_cache.c x509/pcy_data.c x509/pcy_lib.c \
	x509/pcy_map.c x509/pcy_node.c x509/pcy_tree.c \
	x509/x509_addr.c x509/x509_akey.c x509/x509_akeya.c \
	x509/x509_alt.c x509/x509_att.c x509/x509_asid.c \
	x509/x509_bcons.c x509/x509_bitst.c x509/x509_cmp.c \
	x509/x509_conf.c x509/x509_constraints.c x509/x509_cpols.c \
	x509/x509_crld.c x509/x509_d2.c x509/x509_def.c \
	x509/x509_enum.c x509/x509_err.c x509/x509_ext.c \
	x509/x509_extku.c x509/x509_genn.c x509/x509_ia5.c \
	x509/x509_info.c x509/x509_int.c x509/x509_issuer_cache.c \
	x509/x509_lib.c x509/x509_lu.c x509/x509_ncons.c \
	x509/x509_obj.c x509/x509_ocsp.c x509/x509_pci.c \
	x509/x509_pcia.c x509/x509_pcons.c x509/x509_pku.c \
	x509/x509_pmaps.c x509/x509_prn.c x509/x509_purp.c \
	x509/x509_r2x.c x509/x509_req.c x509/x509_set.c \
	x509/x509_skey.c x509/x509_sxnet.c x509/x509_trs.c \
	x509/x509_txt.c x509/x509_utl.c x509/x509_v3.c \
	x509/x509_verify.c x509/x509_vfy.c x509/x509_vpm.c \
	x509/x509cset.c x509/x509name.c x509/x509rset.c \
	x509/x509spki.c x509/x509type.c x509/x_all.c
am__objects_31 = aes/libcrypto_la-aes-elf-armv4.lo \
	bn/libcrypto_la-gf2m-elf-armv4.lo \
	bn/libcrypto_la-mont-elf-armv4.lo \
	sha/libcrypto_la-sha1-elf-armv4.lo \
	sha/libcrypto_la-sha512-elf-armv4.lo \
	sha/libcrypto_la-sha256-elf-armv4.lo \
	modes/libcrypto_la-ghash-elf-armv4.lo \
665
666
667
668
669
670
671
672

673
674
675
676
677
678
679
680
681
682
683
	bio/libcrypto_la-bio_lib.lo bio/libcrypto_la-bio_meth.lo \
	bio/libcrypto_la-bss_acpt.lo bio/libcrypto_la-bss_bio.lo \
	bio/libcrypto_la-bss_conn.lo bio/libcrypto_la-bss_dgram.lo \
	bio/libcrypto_la-bss_fd.lo bio/libcrypto_la-bss_file.lo \
	$(am__objects_46) bio/libcrypto_la-bss_mem.lo \
	bio/libcrypto_la-bss_null.lo bio/libcrypto_la-bss_sock.lo \
	bn/libcrypto_la-bn_add.lo bn/libcrypto_la-bn_asm.lo \
	bn/libcrypto_la-bn_blind.lo bn/libcrypto_la-bn_const.lo \

	bn/libcrypto_la-bn_ctx.lo bn/libcrypto_la-bn_depr.lo \
	bn/libcrypto_la-bn_div.lo bn/libcrypto_la-bn_err.lo \
	bn/libcrypto_la-bn_exp.lo bn/libcrypto_la-bn_exp2.lo \
	bn/libcrypto_la-bn_gcd.lo bn/libcrypto_la-bn_gf2m.lo \
	bn/libcrypto_la-bn_kron.lo bn/libcrypto_la-bn_lib.lo \
	bn/libcrypto_la-bn_mod.lo bn/libcrypto_la-bn_mont.lo \
	bn/libcrypto_la-bn_mpi.lo bn/libcrypto_la-bn_mul.lo \
	bn/libcrypto_la-bn_nist.lo bn/libcrypto_la-bn_prime.lo \
	bn/libcrypto_la-bn_print.lo bn/libcrypto_la-bn_rand.lo \
	bn/libcrypto_la-bn_recp.lo bn/libcrypto_la-bn_shift.lo \
	bn/libcrypto_la-bn_sqr.lo bn/libcrypto_la-bn_sqrt.lo \







|
>
|
|
|
|







665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
	bio/libcrypto_la-bio_lib.lo bio/libcrypto_la-bio_meth.lo \
	bio/libcrypto_la-bss_acpt.lo bio/libcrypto_la-bss_bio.lo \
	bio/libcrypto_la-bss_conn.lo bio/libcrypto_la-bss_dgram.lo \
	bio/libcrypto_la-bss_fd.lo bio/libcrypto_la-bss_file.lo \
	$(am__objects_46) bio/libcrypto_la-bss_mem.lo \
	bio/libcrypto_la-bss_null.lo bio/libcrypto_la-bss_sock.lo \
	bn/libcrypto_la-bn_add.lo bn/libcrypto_la-bn_asm.lo \
	bn/libcrypto_la-bn_blind.lo bn/libcrypto_la-bn_bpsw.lo \
	bn/libcrypto_la-bn_const.lo bn/libcrypto_la-bn_ctx.lo \
	bn/libcrypto_la-bn_depr.lo bn/libcrypto_la-bn_div.lo \
	bn/libcrypto_la-bn_err.lo bn/libcrypto_la-bn_exp.lo \
	bn/libcrypto_la-bn_exp2.lo bn/libcrypto_la-bn_gcd.lo \
	bn/libcrypto_la-bn_gf2m.lo bn/libcrypto_la-bn_isqrt.lo \
	bn/libcrypto_la-bn_kron.lo bn/libcrypto_la-bn_lib.lo \
	bn/libcrypto_la-bn_mod.lo bn/libcrypto_la-bn_mont.lo \
	bn/libcrypto_la-bn_mpi.lo bn/libcrypto_la-bn_mul.lo \
	bn/libcrypto_la-bn_nist.lo bn/libcrypto_la-bn_prime.lo \
	bn/libcrypto_la-bn_print.lo bn/libcrypto_la-bn_rand.lo \
	bn/libcrypto_la-bn_recp.lo bn/libcrypto_la-bn_shift.lo \
	bn/libcrypto_la-bn_sqr.lo bn/libcrypto_la-bn_sqrt.lo \
814
815
816
817
818
819
820

821
822
823
824
825
826
827
828
	gost/libcrypto_la-gostr341001_params.lo \
	gost/libcrypto_la-gostr341001_pmeth.lo \
	gost/libcrypto_la-gostr341194.lo gost/libcrypto_la-streebog.lo \
	hkdf/libcrypto_la-hkdf.lo hmac/libcrypto_la-hm_ameth.lo \
	hmac/libcrypto_la-hm_pmeth.lo hmac/libcrypto_la-hmac.lo \
	idea/libcrypto_la-i_cbc.lo idea/libcrypto_la-i_cfb64.lo \
	idea/libcrypto_la-i_ecb.lo idea/libcrypto_la-i_ofb64.lo \

	idea/libcrypto_la-i_skey.lo lhash/libcrypto_la-lh_stats.lo \
	lhash/libcrypto_la-lhash.lo md4/libcrypto_la-md4_dgst.lo \
	md4/libcrypto_la-md4_one.lo md5/libcrypto_la-md5_dgst.lo \
	md5/libcrypto_la-md5_one.lo modes/libcrypto_la-cbc128.lo \
	modes/libcrypto_la-ccm128.lo modes/libcrypto_la-cfb128.lo \
	modes/libcrypto_la-ctr128.lo modes/libcrypto_la-cts128.lo \
	modes/libcrypto_la-gcm128.lo modes/libcrypto_la-ofb128.lo \
	modes/libcrypto_la-xts128.lo objects/libcrypto_la-o_names.lo \







>
|







815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
	gost/libcrypto_la-gostr341001_params.lo \
	gost/libcrypto_la-gostr341001_pmeth.lo \
	gost/libcrypto_la-gostr341194.lo gost/libcrypto_la-streebog.lo \
	hkdf/libcrypto_la-hkdf.lo hmac/libcrypto_la-hm_ameth.lo \
	hmac/libcrypto_la-hm_pmeth.lo hmac/libcrypto_la-hmac.lo \
	idea/libcrypto_la-i_cbc.lo idea/libcrypto_la-i_cfb64.lo \
	idea/libcrypto_la-i_ecb.lo idea/libcrypto_la-i_ofb64.lo \
	idea/libcrypto_la-i_skey.lo kdf/libcrypto_la-hkdf_evp.lo \
	kdf/libcrypto_la-kdf_err.lo lhash/libcrypto_la-lh_stats.lo \
	lhash/libcrypto_la-lhash.lo md4/libcrypto_la-md4_dgst.lo \
	md4/libcrypto_la-md4_one.lo md5/libcrypto_la-md5_dgst.lo \
	md5/libcrypto_la-md5_one.lo modes/libcrypto_la-cbc128.lo \
	modes/libcrypto_la-ccm128.lo modes/libcrypto_la-cfb128.lo \
	modes/libcrypto_la-ctr128.lo modes/libcrypto_la-cts128.lo \
	modes/libcrypto_la-gcm128.lo modes/libcrypto_la-ofb128.lo \
	modes/libcrypto_la-xts128.lo objects/libcrypto_la-o_names.lo \
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
	pkcs12/libcrypto_la-p12_asn.lo pkcs12/libcrypto_la-p12_attr.lo \
	pkcs12/libcrypto_la-p12_crpt.lo pkcs12/libcrypto_la-p12_crt.lo \
	pkcs12/libcrypto_la-p12_decr.lo \
	pkcs12/libcrypto_la-p12_init.lo pkcs12/libcrypto_la-p12_key.lo \
	pkcs12/libcrypto_la-p12_kiss.lo \
	pkcs12/libcrypto_la-p12_mutl.lo \
	pkcs12/libcrypto_la-p12_npas.lo pkcs12/libcrypto_la-p12_p8d.lo \
	pkcs12/libcrypto_la-p12_p8e.lo pkcs12/libcrypto_la-p12_utl.lo \
	pkcs12/libcrypto_la-pk12err.lo pkcs7/libcrypto_la-bio_pk7.lo \
	pkcs7/libcrypto_la-pk7_asn1.lo pkcs7/libcrypto_la-pk7_attr.lo \
	pkcs7/libcrypto_la-pk7_doit.lo pkcs7/libcrypto_la-pk7_lib.lo \
	pkcs7/libcrypto_la-pk7_mime.lo pkcs7/libcrypto_la-pk7_smime.lo \
	pkcs7/libcrypto_la-pkcs7err.lo \
	poly1305/libcrypto_la-poly1305.lo \
	rand/libcrypto_la-rand_err.lo rand/libcrypto_la-rand_lib.lo \
	rand/libcrypto_la-randfile.lo rc2/libcrypto_la-rc2_cbc.lo \
	rc2/libcrypto_la-rc2_ecb.lo rc2/libcrypto_la-rc2_skey.lo \
	rc2/libcrypto_la-rc2cfb64.lo rc2/libcrypto_la-rc2ofb64.lo \
	ripemd/libcrypto_la-rmd_dgst.lo ripemd/libcrypto_la-rmd_one.lo \
	rsa/libcrypto_la-rsa_ameth.lo rsa/libcrypto_la-rsa_asn1.lo \







|
|
|
|
|
|







845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
	pkcs12/libcrypto_la-p12_asn.lo pkcs12/libcrypto_la-p12_attr.lo \
	pkcs12/libcrypto_la-p12_crpt.lo pkcs12/libcrypto_la-p12_crt.lo \
	pkcs12/libcrypto_la-p12_decr.lo \
	pkcs12/libcrypto_la-p12_init.lo pkcs12/libcrypto_la-p12_key.lo \
	pkcs12/libcrypto_la-p12_kiss.lo \
	pkcs12/libcrypto_la-p12_mutl.lo \
	pkcs12/libcrypto_la-p12_npas.lo pkcs12/libcrypto_la-p12_p8d.lo \
	pkcs12/libcrypto_la-p12_p8e.lo pkcs12/libcrypto_la-p12_sbag.lo \
	pkcs12/libcrypto_la-p12_utl.lo pkcs12/libcrypto_la-pk12err.lo \
	pkcs7/libcrypto_la-bio_pk7.lo pkcs7/libcrypto_la-pk7_asn1.lo \
	pkcs7/libcrypto_la-pk7_attr.lo pkcs7/libcrypto_la-pk7_doit.lo \
	pkcs7/libcrypto_la-pk7_lib.lo pkcs7/libcrypto_la-pk7_mime.lo \
	pkcs7/libcrypto_la-pk7_smime.lo pkcs7/libcrypto_la-pkcs7err.lo \
	poly1305/libcrypto_la-poly1305.lo \
	rand/libcrypto_la-rand_err.lo rand/libcrypto_la-rand_lib.lo \
	rand/libcrypto_la-randfile.lo rc2/libcrypto_la-rc2_cbc.lo \
	rc2/libcrypto_la-rc2_ecb.lo rc2/libcrypto_la-rc2_skey.lo \
	rc2/libcrypto_la-rc2cfb64.lo rc2/libcrypto_la-rc2ofb64.lo \
	ripemd/libcrypto_la-rmd_dgst.lo ripemd/libcrypto_la-rmd_one.lo \
	rsa/libcrypto_la-rsa_ameth.lo rsa/libcrypto_la-rsa_asn1.lo \
1074
1075
1076
1077
1078
1079
1080

1081
1082
1083
1084
1085
1086
1087
1088
1089

1090
1091
1092
1093
1094
1095
1096
	bio/$(DEPDIR)/libcrypto_la-bss_log.Plo \
	bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo \
	bio/$(DEPDIR)/libcrypto_la-bss_null.Plo \
	bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_add.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo \

	bn/$(DEPDIR)/libcrypto_la-bn_const.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_div.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_err.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo \

	bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo \







>









>







1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
	bio/$(DEPDIR)/libcrypto_la-bss_log.Plo \
	bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo \
	bio/$(DEPDIR)/libcrypto_la-bss_null.Plo \
	bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_add.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_bpsw.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_const.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_div.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_err.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_isqrt.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo \
	bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo \
1393
1394
1395
1396
1397
1398
1399


1400
1401
1402
1403
1404
1405
1406
	hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo \
	hmac/$(DEPDIR)/libcrypto_la-hmac.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_skey.Plo \


	lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo \
	lhash/$(DEPDIR)/libcrypto_la-lhash.Plo \
	md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo \
	md4/$(DEPDIR)/libcrypto_la-md4_one.Plo \
	md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo \
	md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo \
	md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo \







>
>







1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
	hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo \
	hmac/$(DEPDIR)/libcrypto_la-hmac.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo \
	idea/$(DEPDIR)/libcrypto_la-i_skey.Plo \
	kdf/$(DEPDIR)/libcrypto_la-hkdf_evp.Plo \
	kdf/$(DEPDIR)/libcrypto_la-kdf_err.Plo \
	lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo \
	lhash/$(DEPDIR)/libcrypto_la-lhash.Plo \
	md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo \
	md4/$(DEPDIR)/libcrypto_la-md4_one.Plo \
	md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo \
	md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo \
	md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo \
1454
1455
1456
1457
1458
1459
1460

1461
1462
1463
1464
1465
1466
1467
	pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo \

	pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo \







>







1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
	pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_sbag.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo \
	pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo \
	pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo \
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.am.arc4random \
	$(srcdir)/Makefile.am.elf-arm $(srcdir)/Makefile.am.elf-x86_64 \
	$(srcdir)/Makefile.am.macosx-x86_64 \
	$(srcdir)/Makefile.am.masm-x86_64 \
	$(srcdir)/Makefile.am.mingw64-x86_64 $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)







<
<







1677
1678
1679
1680
1681
1682
1683


1684
1685
1686
1687
1688
1689
1690
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__DIST_COMMON = $(srcdir)/Makefile.am.arc4random \
	$(srcdir)/Makefile.am.elf-arm $(srcdir)/Makefile.am.elf-x86_64 \
	$(srcdir)/Makefile.am.macosx-x86_64 \
	$(srcdir)/Makefile.am.masm-x86_64 \
	$(srcdir)/Makefile.am.mingw64-x86_64 $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
1695
1696
1697
1698
1699
1700
1701


1702
1703
1704
1705
1706
1707
1708
1709
1710
1711

1712
1713
1714
1715
1716
1717
1718
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







>
>










>







1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
1813
1814
1815
1816
1817
1818
1819
1820

1821
1822
1823
1824
1825
1826
1827
1828
	-D__END_HIDDEN_DECLS= -DLIBRESSL_CRYPTO_INTERNAL \
	-I$(top_srcdir)/crypto/asn1 -I$(top_srcdir)/crypto/bio \
	-I$(top_srcdir)/crypto/bn -I$(top_srcdir)/crypto/bytestring \
	-I$(top_srcdir)/crypto/dh -I$(top_srcdir)/crypto/dsa \
	-I$(top_srcdir)/crypto/ec -I$(top_srcdir)/crypto/ecdh \
	-I$(top_srcdir)/crypto/ecdsa -I$(top_srcdir)/crypto/evp \
	-I$(top_srcdir)/crypto/hmac -I$(top_srcdir)/crypto/modes \
	-I$(top_srcdir)/crypto/ocsp -I$(top_srcdir)/crypto/rsa \

	-I$(top_srcdir)/crypto/x509 -I$(top_srcdir)/crypto
noinst_LTLIBRARIES = libcompat.la $(am__append_1) $(am__append_6)
@ENABLE_LIBTLS_ONLY_FALSE@lib_LTLIBRARIES = libcrypto.la

# needed for a CMake target
EXTRA_DIST = VERSION CMakeLists.txt crypto.sym compat/strcasecmp.c \
	$(ASM_ARM_ELF) $(ASM_X86_64_ELF) $(ASM_X86_64_MACOSX) \
	$(ASM_X86_64_MASM) $(ASM_X86_64_MINGW64)







|
>
|







1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
	-D__END_HIDDEN_DECLS= -DLIBRESSL_CRYPTO_INTERNAL \
	-I$(top_srcdir)/crypto/asn1 -I$(top_srcdir)/crypto/bio \
	-I$(top_srcdir)/crypto/bn -I$(top_srcdir)/crypto/bytestring \
	-I$(top_srcdir)/crypto/dh -I$(top_srcdir)/crypto/dsa \
	-I$(top_srcdir)/crypto/ec -I$(top_srcdir)/crypto/ecdh \
	-I$(top_srcdir)/crypto/ecdsa -I$(top_srcdir)/crypto/evp \
	-I$(top_srcdir)/crypto/hmac -I$(top_srcdir)/crypto/modes \
	-I$(top_srcdir)/crypto/ocsp -I$(top_srcdir)/crypto/pkcs12 \
	-I$(top_srcdir)/crypto/rsa -I$(top_srcdir)/crypto/x509 \
	-I$(top_srcdir)/crypto
noinst_LTLIBRARIES = libcompat.la $(am__append_1) $(am__append_6)
@ENABLE_LIBTLS_ONLY_FALSE@lib_LTLIBRARIES = libcrypto.la

# needed for a CMake target
EXTRA_DIST = VERSION CMakeLists.txt crypto.sym compat/strcasecmp.c \
	$(ASM_ARM_ELF) $(ASM_X86_64_ELF) $(ASM_X86_64_MACOSX) \
	$(ASM_X86_64_MASM) $(ASM_X86_64_MINGW64)
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878

1879
1880
1881
1882
1883
1884
1885
	cms/cms_lcl.h comp/comp_local.h conf/conf_def.h ct/ct_local.h \
	curve25519/curve25519_internal.h des/des_locl.h des/spr.h \
	dh/dh_local.h dsa/dsa_locl.h ec/ec_lcl.h ecdh/ech_locl.h \
	ecdsa/ecs_locl.h engine/eng_int.h evp/evp_locl.h \
	gost/gost_asn1.h gost/gost_locl.h hmac/hmac_local.h \
	idea/idea_lcl.h md4/md4_locl.h md5/md5_locl.h \
	modes/modes_lcl.h objects/obj_dat.h objects/obj_xref.h \
	ocsp/ocsp_local.h rc2/rc2_locl.h rc4/rc4_locl.h \
	ripemd/rmd_locl.h ripemd/rmdconst.h rsa/rsa_locl.h \
	sha/sha_locl.h sm3/sm3_locl.h ui/ui_locl.h whrlpool/wp_locl.h \
	x509/ext_dat.h x509/pcy_int.h x509/vpm_int.h \
	x509/x509_internal.h x509/x509_issuer_cache.h x509/x509_lcl.h


# aes

# asn1

# bf








|
|
|
|
|
>







1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
	cms/cms_lcl.h comp/comp_local.h conf/conf_def.h ct/ct_local.h \
	curve25519/curve25519_internal.h des/des_locl.h des/spr.h \
	dh/dh_local.h dsa/dsa_locl.h ec/ec_lcl.h ecdh/ech_locl.h \
	ecdsa/ecs_locl.h engine/eng_int.h evp/evp_locl.h \
	gost/gost_asn1.h gost/gost_locl.h hmac/hmac_local.h \
	idea/idea_lcl.h md4/md4_locl.h md5/md5_locl.h \
	modes/modes_lcl.h objects/obj_dat.h objects/obj_xref.h \
	ocsp/ocsp_local.h pkcs12/pkcs12_local.h rc2/rc2_locl.h \
	rc4/rc4_locl.h ripemd/rmd_locl.h ripemd/rmdconst.h \
	rsa/rsa_locl.h sha/sha_locl.h sm3/sm3_locl.h ts/ts_local.h \
	ui/ui_locl.h whrlpool/wp_locl.h x509/ext_dat.h x509/pcy_int.h \
	x509/vpm_int.h x509/x509_internal.h x509/x509_issuer_cache.h \
	x509/x509_lcl.h

# aes

# asn1

# bf

1930
1931
1932
1933
1934
1935
1936


1937
1938
1939
1940
1941
1942
1943
# gost

# hkdf

# hmac

# idea



# lhash

# md4

# md5








>
>







1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
# gost

# hkdf

# hmac

# idea

# kdf

# lhash

# md4

# md5

2005
2006
2007
2008
2009
2010
2011
2012
2013

2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
	bf/bf_ecb.c bf/bf_enc.c bf/bf_ofb64.c bf/bf_skey.c \
	bio/b_dump.c $(am__append_50) bio/b_print.c bio/b_sock.c \
	$(am__append_51) bio/bf_buff.c bio/bf_nbio.c bio/bf_null.c \
	bio/bio_cb.c bio/bio_err.c bio/bio_lib.c bio/bio_meth.c \
	bio/bss_acpt.c bio/bss_bio.c bio/bss_conn.c bio/bss_dgram.c \
	bio/bss_fd.c bio/bss_file.c $(am__append_52) bio/bss_mem.c \
	bio/bss_null.c bio/bss_sock.c bn/bn_add.c bn/bn_asm.c \
	bn/bn_blind.c bn/bn_const.c bn/bn_ctx.c bn/bn_depr.c \
	bn/bn_div.c bn/bn_err.c bn/bn_exp.c bn/bn_exp2.c bn/bn_gcd.c \

	bn/bn_gf2m.c bn/bn_kron.c bn/bn_lib.c bn/bn_mod.c bn/bn_mont.c \
	bn/bn_mpi.c bn/bn_mul.c bn/bn_nist.c bn/bn_prime.c \
	bn/bn_print.c bn/bn_rand.c bn/bn_recp.c bn/bn_shift.c \
	bn/bn_sqr.c bn/bn_sqrt.c bn/bn_word.c bn/bn_x931p.c \
	buffer/buf_err.c buffer/buf_str.c buffer/buffer.c \
	bytestring/bs_ber.c bytestring/bs_cbb.c bytestring/bs_cbs.c \
	camellia/cmll_cfb.c camellia/cmll_ctr.c camellia/cmll_ecb.c \
	camellia/cmll_misc.c camellia/cmll_ofb.c cast/c_cfb64.c \
	cast/c_ecb.c cast/c_enc.c cast/c_ofb64.c cast/c_skey.c \
	chacha/chacha.c cmac/cm_ameth.c cmac/cm_pmeth.c cmac/cmac.c \
	cms/cms_asn1.c cms/cms_att.c cms/cms_cd.c cms/cms_dd.c \
	cms/cms_enc.c cms/cms_env.c cms/cms_err.c cms/cms_ess.c \
	cms/cms_io.c cms/cms_kari.c cms/cms_lib.c cms/cms_pwri.c \
	cms/cms_sd.c cms/cms_smime.c comp/c_rle.c comp/c_zlib.c \
	comp/comp_err.c comp/comp_lib.c conf/conf_api.c \
	conf/conf_def.c conf/conf_err.c conf/conf_lib.c \
	conf/conf_mall.c conf/conf_mod.c conf/conf_sap.c ct/ct_b64.c \
	ct/ct_err.c ct/ct_log.c ct/ct_oct.c ct/ct_policy.c ct/ct_prn.c \
	ct/ct_sct.c ct/ct_sct_ctx.c ct/ct_vfy.c ct/ct_x509v3.c \
	curve25519/curve25519-generic.c curve25519/curve25519.c \
	des/cbc_cksm.c des/cbc_enc.c des/cfb64ede.c des/cfb64enc.c \
	des/cfb_enc.c des/des_enc.c des/ecb3_enc.c des/ecb_enc.c \







|
|
>
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|







2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029

2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
	bf/bf_ecb.c bf/bf_enc.c bf/bf_ofb64.c bf/bf_skey.c \
	bio/b_dump.c $(am__append_50) bio/b_print.c bio/b_sock.c \
	$(am__append_51) bio/bf_buff.c bio/bf_nbio.c bio/bf_null.c \
	bio/bio_cb.c bio/bio_err.c bio/bio_lib.c bio/bio_meth.c \
	bio/bss_acpt.c bio/bss_bio.c bio/bss_conn.c bio/bss_dgram.c \
	bio/bss_fd.c bio/bss_file.c $(am__append_52) bio/bss_mem.c \
	bio/bss_null.c bio/bss_sock.c bn/bn_add.c bn/bn_asm.c \
	bn/bn_blind.c bn/bn_bpsw.c bn/bn_const.c bn/bn_ctx.c \
	bn/bn_depr.c bn/bn_div.c bn/bn_err.c bn/bn_exp.c bn/bn_exp2.c \
	bn/bn_gcd.c bn/bn_gf2m.c bn/bn_isqrt.c bn/bn_kron.c \
	bn/bn_lib.c bn/bn_mod.c bn/bn_mont.c bn/bn_mpi.c bn/bn_mul.c \
	bn/bn_nist.c bn/bn_prime.c bn/bn_print.c bn/bn_rand.c \
	bn/bn_recp.c bn/bn_shift.c bn/bn_sqr.c bn/bn_sqrt.c \

	bn/bn_word.c bn/bn_x931p.c buffer/buf_err.c buffer/buf_str.c \
	buffer/buffer.c bytestring/bs_ber.c bytestring/bs_cbb.c \
	bytestring/bs_cbs.c camellia/cmll_cfb.c camellia/cmll_ctr.c \
	camellia/cmll_ecb.c camellia/cmll_misc.c camellia/cmll_ofb.c \
	cast/c_cfb64.c cast/c_ecb.c cast/c_enc.c cast/c_ofb64.c \
	cast/c_skey.c chacha/chacha.c cmac/cm_ameth.c cmac/cm_pmeth.c \
	cmac/cmac.c cms/cms_asn1.c cms/cms_att.c cms/cms_cd.c \
	cms/cms_dd.c cms/cms_enc.c cms/cms_env.c cms/cms_err.c \
	cms/cms_ess.c cms/cms_io.c cms/cms_kari.c cms/cms_lib.c \
	cms/cms_pwri.c cms/cms_sd.c cms/cms_smime.c comp/c_rle.c \
	comp/c_zlib.c comp/comp_err.c comp/comp_lib.c conf/conf_api.c \
	conf/conf_def.c conf/conf_err.c conf/conf_lib.c \
	conf/conf_mall.c conf/conf_mod.c conf/conf_sap.c ct/ct_b64.c \
	ct/ct_err.c ct/ct_log.c ct/ct_oct.c ct/ct_policy.c ct/ct_prn.c \
	ct/ct_sct.c ct/ct_sct_ctx.c ct/ct_vfy.c ct/ct_x509v3.c \
	curve25519/curve25519-generic.c curve25519/curve25519.c \
	des/cbc_cksm.c des/cbc_enc.c des/cfb64ede.c des/cfb64enc.c \
	des/cfb_enc.c des/des_enc.c des/ecb3_enc.c des/ecb_enc.c \
2078
2079
2080
2081
2082
2083
2084
2085

2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099

2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
	gost/gost2814789.c gost/gost89_keywrap.c gost/gost89_params.c \
	gost/gost89imit_ameth.c gost/gost89imit_pmeth.c \
	gost/gost_asn1.c gost/gost_err.c gost/gostr341001.c \
	gost/gostr341001_ameth.c gost/gostr341001_key.c \
	gost/gostr341001_params.c gost/gostr341001_pmeth.c \
	gost/gostr341194.c gost/streebog.c hkdf/hkdf.c hmac/hm_ameth.c \
	hmac/hm_pmeth.c hmac/hmac.c idea/i_cbc.c idea/i_cfb64.c \
	idea/i_ecb.c idea/i_ofb64.c idea/i_skey.c lhash/lh_stats.c \

	lhash/lhash.c md4/md4_dgst.c md4/md4_one.c md5/md5_dgst.c \
	md5/md5_one.c modes/cbc128.c modes/ccm128.c modes/cfb128.c \
	modes/ctr128.c modes/cts128.c modes/gcm128.c modes/ofb128.c \
	modes/xts128.c objects/o_names.c objects/obj_dat.c \
	objects/obj_err.c objects/obj_lib.c objects/obj_xref.c \
	ocsp/ocsp_asn.c ocsp/ocsp_cl.c ocsp/ocsp_err.c ocsp/ocsp_ext.c \
	ocsp/ocsp_ht.c ocsp/ocsp_lib.c ocsp/ocsp_prn.c ocsp/ocsp_srv.c \
	ocsp/ocsp_vfy.c pem/pem_all.c pem/pem_err.c pem/pem_info.c \
	pem/pem_lib.c pem/pem_oth.c pem/pem_pk8.c pem/pem_pkey.c \
	pem/pem_sign.c pem/pem_x509.c pem/pem_xaux.c pem/pvkfmt.c \
	pkcs12/p12_add.c pkcs12/p12_asn.c pkcs12/p12_attr.c \
	pkcs12/p12_crpt.c pkcs12/p12_crt.c pkcs12/p12_decr.c \
	pkcs12/p12_init.c pkcs12/p12_key.c pkcs12/p12_kiss.c \
	pkcs12/p12_mutl.c pkcs12/p12_npas.c pkcs12/p12_p8d.c \

	pkcs12/p12_p8e.c pkcs12/p12_utl.c pkcs12/pk12err.c \
	pkcs7/bio_pk7.c pkcs7/pk7_asn1.c pkcs7/pk7_attr.c \
	pkcs7/pk7_doit.c pkcs7/pk7_lib.c pkcs7/pk7_mime.c \
	pkcs7/pk7_smime.c pkcs7/pkcs7err.c poly1305/poly1305.c \
	rand/rand_err.c rand/rand_lib.c rand/randfile.c rc2/rc2_cbc.c \
	rc2/rc2_ecb.c rc2/rc2_skey.c rc2/rc2cfb64.c rc2/rc2ofb64.c \
	ripemd/rmd_dgst.c ripemd/rmd_one.c rsa/rsa_ameth.c \
	rsa/rsa_asn1.c rsa/rsa_chk.c rsa/rsa_crpt.c rsa/rsa_depr.c \
	rsa/rsa_eay.c rsa/rsa_err.c rsa/rsa_gen.c rsa/rsa_lib.c \
	rsa/rsa_meth.c rsa/rsa_none.c rsa/rsa_oaep.c rsa/rsa_pk1.c \
	rsa/rsa_pmeth.c rsa/rsa_prn.c rsa/rsa_pss.c rsa/rsa_saos.c \
	rsa/rsa_sign.c rsa/rsa_x931.c sha/sha1_one.c sha/sha1dgst.c \
	sha/sha256.c sha/sha512.c sm3/sm3.c sm4/sm4.c stack/stack.c \
	ts/ts_asn1.c ts/ts_conf.c ts/ts_err.c ts/ts_lib.c \
	ts/ts_req_print.c ts/ts_req_utils.c ts/ts_rsp_print.c \
	ts/ts_rsp_sign.c ts/ts_rsp_utils.c ts/ts_rsp_verify.c \
	ts/ts_verify_ctx.c txt_db/txt_db.c ui/ui_err.c ui/ui_lib.c \
	$(am__append_53) $(am__append_54) ui/ui_util.c \
	whrlpool/wp_dgst.c x509/by_dir.c x509/by_file.c x509/by_mem.c \
	x509/pcy_cache.c x509/pcy_data.c x509/pcy_lib.c x509/pcy_map.c \
	x509/pcy_node.c x509/pcy_tree.c x509/x509_addr.c \
	x509/x509_akey.c x509/x509_akeya.c x509/x509_alt.c \
	x509/x509_att.c x509/x509_asid.c x509/x509_bcons.c \
	x509/x509_bitst.c x509/x509_cmp.c x509/x509_conf.c \
	x509/x509_constraints.c x509/x509_cpols.c x509/x509_crld.c \
	x509/x509_d2.c x509/x509_def.c x509/x509_enum.c \
	x509/x509_err.c x509/x509_ext.c x509/x509_extku.c \
	x509/x509_genn.c x509/x509_ia5.c x509/x509_info.c \
	x509/x509_int.c x509/x509_issuer_cache.c x509/x509_lib.c \
	x509/x509_lu.c x509/x509_ncons.c x509/x509_obj.c \
	x509/x509_ocsp.c x509/x509_pci.c x509/x509_pcia.c \
	x509/x509_pcons.c x509/x509_pku.c x509/x509_pmaps.c \
	x509/x509_prn.c x509/x509_purp.c x509/x509_r2x.c \
	x509/x509_req.c x509/x509_set.c x509/x509_skey.c \
	x509/x509_sxnet.c x509/x509_trs.c x509/x509_txt.c \
	x509/x509_utl.c x509/x509_v3.c x509/x509_verify.c \
	x509/x509_vfy.c x509/x509_vpm.c x509/x509cset.c \
	x509/x509name.c x509/x509rset.c x509/x509spki.c \
	x509/x509type.c x509/x_all.c

# chacha

# poly1305
EXTRA_libcrypto_la_SOURCES = chacha/chacha-merged.c des/ncbc_enc.c \
	poly1305/poly1305-donna.c
ASM_ARM_ELF = aes/aes-elf-armv4.S bn/gf2m-elf-armv4.S \







|
>
|
|
|
|
|
|
|
|
|
<
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107

2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125

2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
	gost/gost2814789.c gost/gost89_keywrap.c gost/gost89_params.c \
	gost/gost89imit_ameth.c gost/gost89imit_pmeth.c \
	gost/gost_asn1.c gost/gost_err.c gost/gostr341001.c \
	gost/gostr341001_ameth.c gost/gostr341001_key.c \
	gost/gostr341001_params.c gost/gostr341001_pmeth.c \
	gost/gostr341194.c gost/streebog.c hkdf/hkdf.c hmac/hm_ameth.c \
	hmac/hm_pmeth.c hmac/hmac.c idea/i_cbc.c idea/i_cfb64.c \
	idea/i_ecb.c idea/i_ofb64.c idea/i_skey.c kdf/hkdf_evp.c \
	kdf/kdf_err.c lhash/lh_stats.c lhash/lhash.c md4/md4_dgst.c \
	md4/md4_one.c md5/md5_dgst.c md5/md5_one.c modes/cbc128.c \
	modes/ccm128.c modes/cfb128.c modes/ctr128.c modes/cts128.c \
	modes/gcm128.c modes/ofb128.c modes/xts128.c objects/o_names.c \
	objects/obj_dat.c objects/obj_err.c objects/obj_lib.c \
	objects/obj_xref.c ocsp/ocsp_asn.c ocsp/ocsp_cl.c \
	ocsp/ocsp_err.c ocsp/ocsp_ext.c ocsp/ocsp_ht.c ocsp/ocsp_lib.c \
	ocsp/ocsp_prn.c ocsp/ocsp_srv.c ocsp/ocsp_vfy.c pem/pem_all.c \
	pem/pem_err.c pem/pem_info.c pem/pem_lib.c pem/pem_oth.c \
	pem/pem_pk8.c pem/pem_pkey.c pem/pem_sign.c pem/pem_x509.c \

	pem/pem_xaux.c pem/pvkfmt.c pkcs12/p12_add.c pkcs12/p12_asn.c \
	pkcs12/p12_attr.c pkcs12/p12_crpt.c pkcs12/p12_crt.c \
	pkcs12/p12_decr.c pkcs12/p12_init.c pkcs12/p12_key.c \
	pkcs12/p12_kiss.c pkcs12/p12_mutl.c pkcs12/p12_npas.c \
	pkcs12/p12_p8d.c pkcs12/p12_p8e.c pkcs12/p12_sbag.c \
	pkcs12/p12_utl.c pkcs12/pk12err.c pkcs7/bio_pk7.c \
	pkcs7/pk7_asn1.c pkcs7/pk7_attr.c pkcs7/pk7_doit.c \
	pkcs7/pk7_lib.c pkcs7/pk7_mime.c pkcs7/pk7_smime.c \
	pkcs7/pkcs7err.c poly1305/poly1305.c rand/rand_err.c \
	rand/rand_lib.c rand/randfile.c rc2/rc2_cbc.c rc2/rc2_ecb.c \
	rc2/rc2_skey.c rc2/rc2cfb64.c rc2/rc2ofb64.c ripemd/rmd_dgst.c \
	ripemd/rmd_one.c rsa/rsa_ameth.c rsa/rsa_asn1.c rsa/rsa_chk.c \
	rsa/rsa_crpt.c rsa/rsa_depr.c rsa/rsa_eay.c rsa/rsa_err.c \
	rsa/rsa_gen.c rsa/rsa_lib.c rsa/rsa_meth.c rsa/rsa_none.c \
	rsa/rsa_oaep.c rsa/rsa_pk1.c rsa/rsa_pmeth.c rsa/rsa_prn.c \
	rsa/rsa_pss.c rsa/rsa_saos.c rsa/rsa_sign.c rsa/rsa_x931.c \
	sha/sha1_one.c sha/sha1dgst.c sha/sha256.c sha/sha512.c \
	sm3/sm3.c sm4/sm4.c stack/stack.c ts/ts_asn1.c ts/ts_conf.c \

	ts/ts_err.c ts/ts_lib.c ts/ts_req_print.c ts/ts_req_utils.c \
	ts/ts_rsp_print.c ts/ts_rsp_sign.c ts/ts_rsp_utils.c \
	ts/ts_rsp_verify.c ts/ts_verify_ctx.c txt_db/txt_db.c \
	ui/ui_err.c ui/ui_lib.c $(am__append_53) $(am__append_54) \
	ui/ui_util.c whrlpool/wp_dgst.c x509/by_dir.c x509/by_file.c \
	x509/by_mem.c x509/pcy_cache.c x509/pcy_data.c x509/pcy_lib.c \
	x509/pcy_map.c x509/pcy_node.c x509/pcy_tree.c \
	x509/x509_addr.c x509/x509_akey.c x509/x509_akeya.c \
	x509/x509_alt.c x509/x509_att.c x509/x509_asid.c \
	x509/x509_bcons.c x509/x509_bitst.c x509/x509_cmp.c \
	x509/x509_conf.c x509/x509_constraints.c x509/x509_cpols.c \
	x509/x509_crld.c x509/x509_d2.c x509/x509_def.c \
	x509/x509_enum.c x509/x509_err.c x509/x509_ext.c \
	x509/x509_extku.c x509/x509_genn.c x509/x509_ia5.c \
	x509/x509_info.c x509/x509_int.c x509/x509_issuer_cache.c \
	x509/x509_lib.c x509/x509_lu.c x509/x509_ncons.c \
	x509/x509_obj.c x509/x509_ocsp.c x509/x509_pci.c \
	x509/x509_pcia.c x509/x509_pcons.c x509/x509_pku.c \
	x509/x509_pmaps.c x509/x509_prn.c x509/x509_purp.c \
	x509/x509_r2x.c x509/x509_req.c x509/x509_set.c \
	x509/x509_skey.c x509/x509_sxnet.c x509/x509_trs.c \
	x509/x509_txt.c x509/x509_utl.c x509/x509_v3.c \
	x509/x509_verify.c x509/x509_vfy.c x509/x509_vpm.c \
	x509/x509cset.c x509/x509name.c x509/x509rset.c \
	x509/x509spki.c x509/x509type.c x509/x_all.c

# chacha

# poly1305
EXTRA_libcrypto_la_SOURCES = chacha/chacha-merged.c des/ncbc_enc.c \
	poly1305/poly1305-donna.c
ASM_ARM_ELF = aes/aes-elf-armv4.S bn/gf2m-elf-armv4.S \
2772
2773
2774
2775
2776
2777
2778


2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796


2797
2798
2799
2800
2801
2802
2803
bio/libcrypto_la-bss_sock.lo: bio/$(am__dirstamp) \
	bio/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_add.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_asm.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_blind.lo: bn/$(am__dirstamp) \


	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_const.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_ctx.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_depr.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_div.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_err.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_exp.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_exp2.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_gcd.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_gf2m.lo: bn/$(am__dirstamp) \


	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_kron.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_lib.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_mod.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)







>
>


















>
>







2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
bio/libcrypto_la-bss_sock.lo: bio/$(am__dirstamp) \
	bio/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_add.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_asm.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_blind.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_bpsw.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_const.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_ctx.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_depr.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_div.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_err.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_exp.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_exp2.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_gcd.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_gf2m.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_isqrt.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_kron.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_lib.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
bn/libcrypto_la-bn_mod.lo: bn/$(am__dirstamp) \
	bn/$(DEPDIR)/$(am__dirstamp)
3456
3457
3458
3459
3460
3461
3462










3463
3464
3465
3466
3467
3468
3469
	idea/$(DEPDIR)/$(am__dirstamp)
idea/libcrypto_la-i_ecb.lo: idea/$(am__dirstamp) \
	idea/$(DEPDIR)/$(am__dirstamp)
idea/libcrypto_la-i_ofb64.lo: idea/$(am__dirstamp) \
	idea/$(DEPDIR)/$(am__dirstamp)
idea/libcrypto_la-i_skey.lo: idea/$(am__dirstamp) \
	idea/$(DEPDIR)/$(am__dirstamp)










lhash/$(am__dirstamp):
	@$(MKDIR_P) lhash
	@: > lhash/$(am__dirstamp)
lhash/$(DEPDIR)/$(am__dirstamp):
	@$(MKDIR_P) lhash/$(DEPDIR)
	@: > lhash/$(DEPDIR)/$(am__dirstamp)
lhash/libcrypto_la-lh_stats.lo: lhash/$(am__dirstamp) \







>
>
>
>
>
>
>
>
>
>







3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
	idea/$(DEPDIR)/$(am__dirstamp)
idea/libcrypto_la-i_ecb.lo: idea/$(am__dirstamp) \
	idea/$(DEPDIR)/$(am__dirstamp)
idea/libcrypto_la-i_ofb64.lo: idea/$(am__dirstamp) \
	idea/$(DEPDIR)/$(am__dirstamp)
idea/libcrypto_la-i_skey.lo: idea/$(am__dirstamp) \
	idea/$(DEPDIR)/$(am__dirstamp)
kdf/$(am__dirstamp):
	@$(MKDIR_P) kdf
	@: > kdf/$(am__dirstamp)
kdf/$(DEPDIR)/$(am__dirstamp):
	@$(MKDIR_P) kdf/$(DEPDIR)
	@: > kdf/$(DEPDIR)/$(am__dirstamp)
kdf/libcrypto_la-hkdf_evp.lo: kdf/$(am__dirstamp) \
	kdf/$(DEPDIR)/$(am__dirstamp)
kdf/libcrypto_la-kdf_err.lo: kdf/$(am__dirstamp) \
	kdf/$(DEPDIR)/$(am__dirstamp)
lhash/$(am__dirstamp):
	@$(MKDIR_P) lhash
	@: > lhash/$(am__dirstamp)
lhash/$(DEPDIR)/$(am__dirstamp):
	@$(MKDIR_P) lhash/$(DEPDIR)
	@: > lhash/$(DEPDIR)/$(am__dirstamp)
lhash/libcrypto_la-lh_stats.lo: lhash/$(am__dirstamp) \
3595
3596
3597
3598
3599
3600
3601


3602
3603
3604
3605
3606
3607
3608
pkcs12/libcrypto_la-p12_mutl.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_npas.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_p8d.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_p8e.lo: pkcs12/$(am__dirstamp) \


	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_utl.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-pk12err.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs7/$(am__dirstamp):
	@$(MKDIR_P) pkcs7







>
>







3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
pkcs12/libcrypto_la-p12_mutl.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_npas.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_p8d.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_p8e.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_sbag.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-p12_utl.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs12/libcrypto_la-pk12err.lo: pkcs12/$(am__dirstamp) \
	pkcs12/$(DEPDIR)/$(am__dirstamp)
pkcs7/$(am__dirstamp):
	@$(MKDIR_P) pkcs7
4004
4005
4006
4007
4008
4009
4010


4011
4012
4013
4014
4015
4016
4017
	-rm -f gost/*.lo
	-rm -f hkdf/*.$(OBJEXT)
	-rm -f hkdf/*.lo
	-rm -f hmac/*.$(OBJEXT)
	-rm -f hmac/*.lo
	-rm -f idea/*.$(OBJEXT)
	-rm -f idea/*.lo


	-rm -f lhash/*.$(OBJEXT)
	-rm -f lhash/*.lo
	-rm -f md4/*.$(OBJEXT)
	-rm -f md4/*.lo
	-rm -f md5/*.$(OBJEXT)
	-rm -f md5/*.lo
	-rm -f modes/*.$(OBJEXT)







>
>







4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
	-rm -f gost/*.lo
	-rm -f hkdf/*.$(OBJEXT)
	-rm -f hkdf/*.lo
	-rm -f hmac/*.$(OBJEXT)
	-rm -f hmac/*.lo
	-rm -f idea/*.$(OBJEXT)
	-rm -f idea/*.lo
	-rm -f kdf/*.$(OBJEXT)
	-rm -f kdf/*.lo
	-rm -f lhash/*.$(OBJEXT)
	-rm -f lhash/*.lo
	-rm -f md4/*.$(OBJEXT)
	-rm -f md4/*.lo
	-rm -f md5/*.$(OBJEXT)
	-rm -f md5/*.lo
	-rm -f modes/*.$(OBJEXT)
4197
4198
4199
4200
4201
4202
4203

4204
4205
4206
4207
4208
4209
4210
4211
4212

4213
4214
4215
4216
4217
4218
4219
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_log.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_null.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_add.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_const.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_div.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_err.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo@am__quote@ # am--include-marker







>









>







4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_log.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_null.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_add.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_bpsw.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_const.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_div.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_err.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_isqrt.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo@am__quote@ # am--include-marker
4521
4522
4523
4524
4525
4526
4527


4528
4529
4530
4531
4532
4533
4534
@AMDEP_TRUE@@am__include@ @am__quote@hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@hmac/$(DEPDIR)/libcrypto_la-hmac.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_skey.Plo@am__quote@ # am--include-marker


@AMDEP_TRUE@@am__include@ @am__quote@lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@lhash/$(DEPDIR)/libcrypto_la-lhash.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md4/$(DEPDIR)/libcrypto_la-md4_one.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo@am__quote@ # am--include-marker







>
>







4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
@AMDEP_TRUE@@am__include@ @am__quote@hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@hmac/$(DEPDIR)/libcrypto_la-hmac.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@idea/$(DEPDIR)/libcrypto_la-i_skey.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@kdf/$(DEPDIR)/libcrypto_la-hkdf_evp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@kdf/$(DEPDIR)/libcrypto_la-kdf_err.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@lhash/$(DEPDIR)/libcrypto_la-lhash.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md4/$(DEPDIR)/libcrypto_la-md4_one.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo@am__quote@ # am--include-marker
4582
4583
4584
4585
4586
4587
4588

4589
4590
4591
4592
4593
4594
4595
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo@am__quote@ # am--include-marker







>







4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_sbag.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo@am__quote@ # am--include-marker
6217
6218
6219
6220
6221
6222
6223







6224
6225
6226
6227
6228
6229
6230
bn/libcrypto_la-bn_blind.lo: bn/bn_blind.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_blind.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_blind.Tpo -c -o bn/libcrypto_la-bn_blind.lo `test -f 'bn/bn_blind.c' || echo '$(srcdir)/'`bn/bn_blind.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_blind.Tpo bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_blind.c' object='bn/libcrypto_la-bn_blind.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_blind.lo `test -f 'bn/bn_blind.c' || echo '$(srcdir)/'`bn/bn_blind.c








bn/libcrypto_la-bn_const.lo: bn/bn_const.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_const.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_const.Tpo -c -o bn/libcrypto_la-bn_const.lo `test -f 'bn/bn_const.c' || echo '$(srcdir)/'`bn/bn_const.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_const.Tpo bn/$(DEPDIR)/libcrypto_la-bn_const.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_const.c' object='bn/libcrypto_la-bn_const.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_const.lo `test -f 'bn/bn_const.c' || echo '$(srcdir)/'`bn/bn_const.c








>
>
>
>
>
>
>







6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
bn/libcrypto_la-bn_blind.lo: bn/bn_blind.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_blind.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_blind.Tpo -c -o bn/libcrypto_la-bn_blind.lo `test -f 'bn/bn_blind.c' || echo '$(srcdir)/'`bn/bn_blind.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_blind.Tpo bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_blind.c' object='bn/libcrypto_la-bn_blind.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_blind.lo `test -f 'bn/bn_blind.c' || echo '$(srcdir)/'`bn/bn_blind.c

bn/libcrypto_la-bn_bpsw.lo: bn/bn_bpsw.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_bpsw.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_bpsw.Tpo -c -o bn/libcrypto_la-bn_bpsw.lo `test -f 'bn/bn_bpsw.c' || echo '$(srcdir)/'`bn/bn_bpsw.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_bpsw.Tpo bn/$(DEPDIR)/libcrypto_la-bn_bpsw.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_bpsw.c' object='bn/libcrypto_la-bn_bpsw.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_bpsw.lo `test -f 'bn/bn_bpsw.c' || echo '$(srcdir)/'`bn/bn_bpsw.c

bn/libcrypto_la-bn_const.lo: bn/bn_const.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_const.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_const.Tpo -c -o bn/libcrypto_la-bn_const.lo `test -f 'bn/bn_const.c' || echo '$(srcdir)/'`bn/bn_const.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_const.Tpo bn/$(DEPDIR)/libcrypto_la-bn_const.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_const.c' object='bn/libcrypto_la-bn_const.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_const.lo `test -f 'bn/bn_const.c' || echo '$(srcdir)/'`bn/bn_const.c

6280
6281
6282
6283
6284
6285
6286







6287
6288
6289
6290
6291
6292
6293
bn/libcrypto_la-bn_gf2m.lo: bn/bn_gf2m.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_gf2m.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Tpo -c -o bn/libcrypto_la-bn_gf2m.lo `test -f 'bn/bn_gf2m.c' || echo '$(srcdir)/'`bn/bn_gf2m.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Tpo bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_gf2m.c' object='bn/libcrypto_la-bn_gf2m.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_gf2m.lo `test -f 'bn/bn_gf2m.c' || echo '$(srcdir)/'`bn/bn_gf2m.c








bn/libcrypto_la-bn_kron.lo: bn/bn_kron.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_kron.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_kron.Tpo -c -o bn/libcrypto_la-bn_kron.lo `test -f 'bn/bn_kron.c' || echo '$(srcdir)/'`bn/bn_kron.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_kron.Tpo bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_kron.c' object='bn/libcrypto_la-bn_kron.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_kron.lo `test -f 'bn/bn_kron.c' || echo '$(srcdir)/'`bn/bn_kron.c








>
>
>
>
>
>
>







6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
bn/libcrypto_la-bn_gf2m.lo: bn/bn_gf2m.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_gf2m.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Tpo -c -o bn/libcrypto_la-bn_gf2m.lo `test -f 'bn/bn_gf2m.c' || echo '$(srcdir)/'`bn/bn_gf2m.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Tpo bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_gf2m.c' object='bn/libcrypto_la-bn_gf2m.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_gf2m.lo `test -f 'bn/bn_gf2m.c' || echo '$(srcdir)/'`bn/bn_gf2m.c

bn/libcrypto_la-bn_isqrt.lo: bn/bn_isqrt.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_isqrt.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_isqrt.Tpo -c -o bn/libcrypto_la-bn_isqrt.lo `test -f 'bn/bn_isqrt.c' || echo '$(srcdir)/'`bn/bn_isqrt.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_isqrt.Tpo bn/$(DEPDIR)/libcrypto_la-bn_isqrt.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_isqrt.c' object='bn/libcrypto_la-bn_isqrt.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_isqrt.lo `test -f 'bn/bn_isqrt.c' || echo '$(srcdir)/'`bn/bn_isqrt.c

bn/libcrypto_la-bn_kron.lo: bn/bn_kron.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bn/libcrypto_la-bn_kron.lo -MD -MP -MF bn/$(DEPDIR)/libcrypto_la-bn_kron.Tpo -c -o bn/libcrypto_la-bn_kron.lo `test -f 'bn/bn_kron.c' || echo '$(srcdir)/'`bn/bn_kron.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) bn/$(DEPDIR)/libcrypto_la-bn_kron.Tpo bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='bn/bn_kron.c' object='bn/libcrypto_la-bn_kron.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bn/libcrypto_la-bn_kron.lo `test -f 'bn/bn_kron.c' || echo '$(srcdir)/'`bn/bn_kron.c

8100
8101
8102
8103
8104
8105
8106














8107
8108
8109
8110
8111
8112
8113
idea/libcrypto_la-i_skey.lo: idea/i_skey.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT idea/libcrypto_la-i_skey.lo -MD -MP -MF idea/$(DEPDIR)/libcrypto_la-i_skey.Tpo -c -o idea/libcrypto_la-i_skey.lo `test -f 'idea/i_skey.c' || echo '$(srcdir)/'`idea/i_skey.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) idea/$(DEPDIR)/libcrypto_la-i_skey.Tpo idea/$(DEPDIR)/libcrypto_la-i_skey.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='idea/i_skey.c' object='idea/libcrypto_la-i_skey.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o idea/libcrypto_la-i_skey.lo `test -f 'idea/i_skey.c' || echo '$(srcdir)/'`idea/i_skey.c















lhash/libcrypto_la-lh_stats.lo: lhash/lh_stats.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lhash/libcrypto_la-lh_stats.lo -MD -MP -MF lhash/$(DEPDIR)/libcrypto_la-lh_stats.Tpo -c -o lhash/libcrypto_la-lh_stats.lo `test -f 'lhash/lh_stats.c' || echo '$(srcdir)/'`lhash/lh_stats.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) lhash/$(DEPDIR)/libcrypto_la-lh_stats.Tpo lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lhash/lh_stats.c' object='lhash/libcrypto_la-lh_stats.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lhash/libcrypto_la-lh_stats.lo `test -f 'lhash/lh_stats.c' || echo '$(srcdir)/'`lhash/lh_stats.c








>
>
>
>
>
>
>
>
>
>
>
>
>
>







8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
idea/libcrypto_la-i_skey.lo: idea/i_skey.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT idea/libcrypto_la-i_skey.lo -MD -MP -MF idea/$(DEPDIR)/libcrypto_la-i_skey.Tpo -c -o idea/libcrypto_la-i_skey.lo `test -f 'idea/i_skey.c' || echo '$(srcdir)/'`idea/i_skey.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) idea/$(DEPDIR)/libcrypto_la-i_skey.Tpo idea/$(DEPDIR)/libcrypto_la-i_skey.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='idea/i_skey.c' object='idea/libcrypto_la-i_skey.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o idea/libcrypto_la-i_skey.lo `test -f 'idea/i_skey.c' || echo '$(srcdir)/'`idea/i_skey.c

kdf/libcrypto_la-hkdf_evp.lo: kdf/hkdf_evp.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kdf/libcrypto_la-hkdf_evp.lo -MD -MP -MF kdf/$(DEPDIR)/libcrypto_la-hkdf_evp.Tpo -c -o kdf/libcrypto_la-hkdf_evp.lo `test -f 'kdf/hkdf_evp.c' || echo '$(srcdir)/'`kdf/hkdf_evp.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) kdf/$(DEPDIR)/libcrypto_la-hkdf_evp.Tpo kdf/$(DEPDIR)/libcrypto_la-hkdf_evp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='kdf/hkdf_evp.c' object='kdf/libcrypto_la-hkdf_evp.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kdf/libcrypto_la-hkdf_evp.lo `test -f 'kdf/hkdf_evp.c' || echo '$(srcdir)/'`kdf/hkdf_evp.c

kdf/libcrypto_la-kdf_err.lo: kdf/kdf_err.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kdf/libcrypto_la-kdf_err.lo -MD -MP -MF kdf/$(DEPDIR)/libcrypto_la-kdf_err.Tpo -c -o kdf/libcrypto_la-kdf_err.lo `test -f 'kdf/kdf_err.c' || echo '$(srcdir)/'`kdf/kdf_err.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) kdf/$(DEPDIR)/libcrypto_la-kdf_err.Tpo kdf/$(DEPDIR)/libcrypto_la-kdf_err.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='kdf/kdf_err.c' object='kdf/libcrypto_la-kdf_err.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kdf/libcrypto_la-kdf_err.lo `test -f 'kdf/kdf_err.c' || echo '$(srcdir)/'`kdf/kdf_err.c

lhash/libcrypto_la-lh_stats.lo: lhash/lh_stats.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lhash/libcrypto_la-lh_stats.lo -MD -MP -MF lhash/$(DEPDIR)/libcrypto_la-lh_stats.Tpo -c -o lhash/libcrypto_la-lh_stats.lo `test -f 'lhash/lh_stats.c' || echo '$(srcdir)/'`lhash/lh_stats.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) lhash/$(DEPDIR)/libcrypto_la-lh_stats.Tpo lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lhash/lh_stats.c' object='lhash/libcrypto_la-lh_stats.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lhash/libcrypto_la-lh_stats.lo `test -f 'lhash/lh_stats.c' || echo '$(srcdir)/'`lhash/lh_stats.c

8464
8465
8466
8467
8468
8469
8470







8471
8472
8473
8474
8475
8476
8477
pkcs12/libcrypto_la-p12_p8e.lo: pkcs12/p12_p8e.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pkcs12/libcrypto_la-p12_p8e.lo -MD -MP -MF pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Tpo -c -o pkcs12/libcrypto_la-p12_p8e.lo `test -f 'pkcs12/p12_p8e.c' || echo '$(srcdir)/'`pkcs12/p12_p8e.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Tpo pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pkcs12/p12_p8e.c' object='pkcs12/libcrypto_la-p12_p8e.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pkcs12/libcrypto_la-p12_p8e.lo `test -f 'pkcs12/p12_p8e.c' || echo '$(srcdir)/'`pkcs12/p12_p8e.c








pkcs12/libcrypto_la-p12_utl.lo: pkcs12/p12_utl.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pkcs12/libcrypto_la-p12_utl.lo -MD -MP -MF pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Tpo -c -o pkcs12/libcrypto_la-p12_utl.lo `test -f 'pkcs12/p12_utl.c' || echo '$(srcdir)/'`pkcs12/p12_utl.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Tpo pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pkcs12/p12_utl.c' object='pkcs12/libcrypto_la-p12_utl.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pkcs12/libcrypto_la-p12_utl.lo `test -f 'pkcs12/p12_utl.c' || echo '$(srcdir)/'`pkcs12/p12_utl.c








>
>
>
>
>
>
>







8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
pkcs12/libcrypto_la-p12_p8e.lo: pkcs12/p12_p8e.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pkcs12/libcrypto_la-p12_p8e.lo -MD -MP -MF pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Tpo -c -o pkcs12/libcrypto_la-p12_p8e.lo `test -f 'pkcs12/p12_p8e.c' || echo '$(srcdir)/'`pkcs12/p12_p8e.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Tpo pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pkcs12/p12_p8e.c' object='pkcs12/libcrypto_la-p12_p8e.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pkcs12/libcrypto_la-p12_p8e.lo `test -f 'pkcs12/p12_p8e.c' || echo '$(srcdir)/'`pkcs12/p12_p8e.c

pkcs12/libcrypto_la-p12_sbag.lo: pkcs12/p12_sbag.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pkcs12/libcrypto_la-p12_sbag.lo -MD -MP -MF pkcs12/$(DEPDIR)/libcrypto_la-p12_sbag.Tpo -c -o pkcs12/libcrypto_la-p12_sbag.lo `test -f 'pkcs12/p12_sbag.c' || echo '$(srcdir)/'`pkcs12/p12_sbag.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) pkcs12/$(DEPDIR)/libcrypto_la-p12_sbag.Tpo pkcs12/$(DEPDIR)/libcrypto_la-p12_sbag.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pkcs12/p12_sbag.c' object='pkcs12/libcrypto_la-p12_sbag.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pkcs12/libcrypto_la-p12_sbag.lo `test -f 'pkcs12/p12_sbag.c' || echo '$(srcdir)/'`pkcs12/p12_sbag.c

pkcs12/libcrypto_la-p12_utl.lo: pkcs12/p12_utl.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pkcs12/libcrypto_la-p12_utl.lo -MD -MP -MF pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Tpo -c -o pkcs12/libcrypto_la-p12_utl.lo `test -f 'pkcs12/p12_utl.c' || echo '$(srcdir)/'`pkcs12/p12_utl.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Tpo pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pkcs12/p12_utl.c' object='pkcs12/libcrypto_la-p12_utl.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pkcs12/libcrypto_la-p12_utl.lo `test -f 'pkcs12/p12_utl.c' || echo '$(srcdir)/'`pkcs12/p12_utl.c

9417
9418
9419
9420
9421
9422
9423

9424
9425
9426
9427
9428
9429
9430
	-rm -rf engine/.libs engine/_libs
	-rm -rf err/.libs err/_libs
	-rm -rf evp/.libs evp/_libs
	-rm -rf gost/.libs gost/_libs
	-rm -rf hkdf/.libs hkdf/_libs
	-rm -rf hmac/.libs hmac/_libs
	-rm -rf idea/.libs idea/_libs

	-rm -rf lhash/.libs lhash/_libs
	-rm -rf md4/.libs md4/_libs
	-rm -rf md5/.libs md5/_libs
	-rm -rf modes/.libs modes/_libs
	-rm -rf objects/.libs objects/_libs
	-rm -rf ocsp/.libs ocsp/_libs
	-rm -rf pem/.libs pem/_libs







>







9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
	-rm -rf engine/.libs engine/_libs
	-rm -rf err/.libs err/_libs
	-rm -rf evp/.libs evp/_libs
	-rm -rf gost/.libs gost/_libs
	-rm -rf hkdf/.libs hkdf/_libs
	-rm -rf hmac/.libs hmac/_libs
	-rm -rf idea/.libs idea/_libs
	-rm -rf kdf/.libs kdf/_libs
	-rm -rf lhash/.libs lhash/_libs
	-rm -rf md4/.libs md4/_libs
	-rm -rf md5/.libs md5/_libs
	-rm -rf modes/.libs modes/_libs
	-rm -rf objects/.libs objects/_libs
	-rm -rf ocsp/.libs ocsp/_libs
	-rm -rf pem/.libs pem/_libs
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







9564
9565
9566
9567
9568
9569
9570

9571
9572
9573
9574
9575
9576
9577
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
9626
9627
9628
9629
9630
9631
9632


9633
9634
9635
9636
9637
9638
9639
	-rm -f gost/$(am__dirstamp)
	-rm -f hkdf/$(DEPDIR)/$(am__dirstamp)
	-rm -f hkdf/$(am__dirstamp)
	-rm -f hmac/$(DEPDIR)/$(am__dirstamp)
	-rm -f hmac/$(am__dirstamp)
	-rm -f idea/$(DEPDIR)/$(am__dirstamp)
	-rm -f idea/$(am__dirstamp)


	-rm -f lhash/$(DEPDIR)/$(am__dirstamp)
	-rm -f lhash/$(am__dirstamp)
	-rm -f md4/$(DEPDIR)/$(am__dirstamp)
	-rm -f md4/$(am__dirstamp)
	-rm -f md5/$(DEPDIR)/$(am__dirstamp)
	-rm -f md5/$(am__dirstamp)
	-rm -f modes/$(DEPDIR)/$(am__dirstamp)







>
>







9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
	-rm -f gost/$(am__dirstamp)
	-rm -f hkdf/$(DEPDIR)/$(am__dirstamp)
	-rm -f hkdf/$(am__dirstamp)
	-rm -f hmac/$(DEPDIR)/$(am__dirstamp)
	-rm -f hmac/$(am__dirstamp)
	-rm -f idea/$(DEPDIR)/$(am__dirstamp)
	-rm -f idea/$(am__dirstamp)
	-rm -f kdf/$(DEPDIR)/$(am__dirstamp)
	-rm -f kdf/$(am__dirstamp)
	-rm -f lhash/$(DEPDIR)/$(am__dirstamp)
	-rm -f lhash/$(am__dirstamp)
	-rm -f md4/$(DEPDIR)/$(am__dirstamp)
	-rm -f md4/$(am__dirstamp)
	-rm -f md5/$(DEPDIR)/$(am__dirstamp)
	-rm -f md5/$(am__dirstamp)
	-rm -f modes/$(DEPDIR)/$(am__dirstamp)
9826
9827
9828
9829
9830
9831
9832

9833
9834
9835
9836
9837
9838
9839
9840
9841

9842
9843
9844
9845
9846
9847
9848
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_log.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_null.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_add.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo

	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_const.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_div.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_err.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo

	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo







>









>







9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_log.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_null.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_add.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_bpsw.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_const.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_div.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_err.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_isqrt.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
	-rm -f compat/$(DEPDIR)/getprogname_linux.Plo
	-rm -f compat/$(DEPDIR)/getprogname_unimpl.Plo
	-rm -f compat/$(DEPDIR)/getprogname_windows.Plo
	-rm -f compat/$(DEPDIR)/libcompatnoopt_la-explicit_bzero.Plo
	-rm -f compat/$(DEPDIR)/libcompatnoopt_la-explicit_bzero_win.Plo
	-rm -f compat/$(DEPDIR)/libcrypto_la-crypto_lock_win.Plo
	-rm -f compat/$(DEPDIR)/posix_win.Plo
	-rm -f compat/$(DEPDIR)/wsa_inet_pton.Plo
	-rm -f compat/$(DEPDIR)/reallocarray.Plo
	-rm -f compat/$(DEPDIR)/recallocarray.Plo
	-rm -f compat/$(DEPDIR)/strlcat.Plo
	-rm -f compat/$(DEPDIR)/strlcpy.Plo
	-rm -f compat/$(DEPDIR)/strndup.Plo
	-rm -f compat/$(DEPDIR)/strnlen.Plo
	-rm -f compat/$(DEPDIR)/strsep.Plo







<







10004
10005
10006
10007
10008
10009
10010

10011
10012
10013
10014
10015
10016
10017
	-rm -f compat/$(DEPDIR)/getprogname_linux.Plo
	-rm -f compat/$(DEPDIR)/getprogname_unimpl.Plo
	-rm -f compat/$(DEPDIR)/getprogname_windows.Plo
	-rm -f compat/$(DEPDIR)/libcompatnoopt_la-explicit_bzero.Plo
	-rm -f compat/$(DEPDIR)/libcompatnoopt_la-explicit_bzero_win.Plo
	-rm -f compat/$(DEPDIR)/libcrypto_la-crypto_lock_win.Plo
	-rm -f compat/$(DEPDIR)/posix_win.Plo

	-rm -f compat/$(DEPDIR)/reallocarray.Plo
	-rm -f compat/$(DEPDIR)/recallocarray.Plo
	-rm -f compat/$(DEPDIR)/strlcat.Plo
	-rm -f compat/$(DEPDIR)/strlcpy.Plo
	-rm -f compat/$(DEPDIR)/strndup.Plo
	-rm -f compat/$(DEPDIR)/strnlen.Plo
	-rm -f compat/$(DEPDIR)/strsep.Plo
10150
10151
10152
10153
10154
10155
10156


10157
10158
10159
10160
10161
10162
10163
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hmac.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_skey.Plo


	-rm -f lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo
	-rm -f lhash/$(DEPDIR)/libcrypto_la-lhash.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_one.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo







>
>







10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hmac.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_skey.Plo
	-rm -f kdf/$(DEPDIR)/libcrypto_la-hkdf_evp.Plo
	-rm -f kdf/$(DEPDIR)/libcrypto_la-kdf_err.Plo
	-rm -f lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo
	-rm -f lhash/$(DEPDIR)/libcrypto_la-lhash.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_one.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo
10211
10212
10213
10214
10215
10216
10217

10218
10219
10220
10221
10222
10223
10224
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo

	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo







>







10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_sbag.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo
10556
10557
10558
10559
10560
10561
10562

10563
10564
10565
10566
10567
10568
10569
10570
10571

10572
10573
10574
10575
10576
10577
10578
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_log.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_null.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_add.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo

	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_const.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_div.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_err.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo

	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo







>









>







10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_log.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_mem.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_null.Plo
	-rm -f bio/$(DEPDIR)/libcrypto_la-bss_sock.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_add.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_asm.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_blind.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_bpsw.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_const.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_ctx.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_depr.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_div.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_err.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_exp2.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gcd.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_gf2m.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_isqrt.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_kron.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_lib.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mod.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mont.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mpi.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_mul.Plo
	-rm -f bn/$(DEPDIR)/libcrypto_la-bn_nist.Plo
10879
10880
10881
10882
10883
10884
10885


10886
10887
10888
10889
10890
10891
10892
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hmac.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_skey.Plo


	-rm -f lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo
	-rm -f lhash/$(DEPDIR)/libcrypto_la-lhash.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_one.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo







>
>







10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hm_pmeth.Plo
	-rm -f hmac/$(DEPDIR)/libcrypto_la-hmac.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cbc.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_cfb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ecb.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_ofb64.Plo
	-rm -f idea/$(DEPDIR)/libcrypto_la-i_skey.Plo
	-rm -f kdf/$(DEPDIR)/libcrypto_la-hkdf_evp.Plo
	-rm -f kdf/$(DEPDIR)/libcrypto_la-kdf_err.Plo
	-rm -f lhash/$(DEPDIR)/libcrypto_la-lh_stats.Plo
	-rm -f lhash/$(DEPDIR)/libcrypto_la-lhash.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_dgst.Plo
	-rm -f md4/$(DEPDIR)/libcrypto_la-md4_one.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-elf-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-macosx-x86_64.Plo
	-rm -f md5/$(DEPDIR)/libcrypto_la-md5-masm-x86_64.Plo
10940
10941
10942
10943
10944
10945
10946

10947
10948
10949
10950
10951
10952
10953
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo

	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo







>







11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_init.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_key.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_kiss.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_mutl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_npas.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8d.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_p8e.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_sbag.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-p12_utl.Plo
	-rm -f pkcs12/$(DEPDIR)/libcrypto_la-pk12err.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-bio_pk7.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_asn1.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_attr.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_doit.Plo
	-rm -f pkcs7/$(DEPDIR)/libcrypto_la-pk7_lib.Plo
Changes to jni/libressl/crypto/VERSION.
1
49:0:0
|
1
50:0:0
Changes to jni/libressl/crypto/aes/aesni-elf-x86_64.S.
883
884
885
886
887
888
889




890
891
892
893
894
895
896
	movups	%xmm3,(%r9)
	retq
.size	aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
.globl	aesni_ctr32_encrypt_blocks
.type	aesni_ctr32_encrypt_blocks,@function
.align	16
aesni_ctr32_encrypt_blocks:




	cmpq	$1,%rdx
	je	.Lctr32_one_shortcut

	movdqu	(%r8),%xmm14
	movdqa	.Lbswap_mask(%rip),%xmm15
	xorl	%eax,%eax
.byte	102,69,15,58,22,242,3







>
>
>
>







883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
	movups	%xmm3,(%r9)
	retq
.size	aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
.globl	aesni_ctr32_encrypt_blocks
.type	aesni_ctr32_encrypt_blocks,@function
.align	16
aesni_ctr32_encrypt_blocks:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$32,%rsp
	leaq	-8(%rax),%rbp
	cmpq	$1,%rdx
	je	.Lctr32_one_shortcut

	movdqu	(%r8),%xmm14
	movdqa	.Lbswap_mask(%rip),%xmm15
	xorl	%eax,%eax
.byte	102,69,15,58,22,242,3
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
.byte	102,69,15,58,34,226,1
	incq	%r11
.byte	102,69,15,58,34,235,1
	incl	%r10d
.byte	102,69,15,58,34,226,2
	incq	%r11
.byte	102,69,15,58,34,235,2
	movdqa	%xmm12,-40(%rsp)
.byte	102,69,15,56,0,231
	movdqa	%xmm13,-24(%rsp)
.byte	102,69,15,56,0,239

	pshufd	$192,%xmm12,%xmm2
	pshufd	$128,%xmm12,%xmm3
	pshufd	$64,%xmm12,%xmm4
	cmpq	$6,%rdx
	jb	.Lctr32_tail







|

|







911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
.byte	102,69,15,58,34,226,1
	incq	%r11
.byte	102,69,15,58,34,235,1
	incl	%r10d
.byte	102,69,15,58,34,226,2
	incq	%r11
.byte	102,69,15,58,34,235,2
	movdqa	%xmm12,0(%rsp)
.byte	102,69,15,56,0,231
	movdqa	%xmm13,16(%rsp)
.byte	102,69,15,56,0,239

	pshufd	$192,%xmm12,%xmm2
	pshufd	$128,%xmm12,%xmm3
	pshufd	$64,%xmm12,%xmm4
	cmpq	$6,%rdx
	jb	.Lctr32_tail
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
	aesenc	%xmm1,%xmm2
	leaq	32(%r11),%rcx
	pxor	%xmm0,%xmm4
	aesenc	%xmm1,%xmm3
	movdqa	.Lincrement32(%rip),%xmm13
	pxor	%xmm0,%xmm5
	aesenc	%xmm1,%xmm4
	movdqa	-40(%rsp),%xmm12
	pxor	%xmm0,%xmm6
	aesenc	%xmm1,%xmm5
	pxor	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	decl	%eax
	aesenc	%xmm1,%xmm6
	aesenc	%xmm1,%xmm7







|







953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
	aesenc	%xmm1,%xmm2
	leaq	32(%r11),%rcx
	pxor	%xmm0,%xmm4
	aesenc	%xmm1,%xmm3
	movdqa	.Lincrement32(%rip),%xmm13
	pxor	%xmm0,%xmm5
	aesenc	%xmm1,%xmm4
	movdqa	(%rsp),%xmm12
	pxor	%xmm0,%xmm6
	aesenc	%xmm1,%xmm5
	pxor	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	decl	%eax
	aesenc	%xmm1,%xmm6
	aesenc	%xmm1,%xmm7
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
	aesenc	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	jnz	.Lctr32_enc_loop6

	aesenc	%xmm1,%xmm2
	paddd	%xmm13,%xmm12
	aesenc	%xmm1,%xmm3
	paddd	-24(%rsp),%xmm13
	aesenc	%xmm1,%xmm4
	movdqa	%xmm12,-40(%rsp)
	aesenc	%xmm1,%xmm5
	movdqa	%xmm13,-24(%rsp)
	aesenc	%xmm1,%xmm6
.byte	102,69,15,56,0,231
	aesenc	%xmm1,%xmm7
.byte	102,69,15,56,0,239

	aesenclast	%xmm0,%xmm2
	movups	(%rdi),%xmm8







|

|

|







986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
	aesenc	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	jnz	.Lctr32_enc_loop6

	aesenc	%xmm1,%xmm2
	paddd	%xmm13,%xmm12
	aesenc	%xmm1,%xmm3
	paddd	16(%rsp),%xmm13
	aesenc	%xmm1,%xmm4
	movdqa	%xmm12,0(%rsp)
	aesenc	%xmm1,%xmm5
	movdqa	%xmm13,16(%rsp)
	aesenc	%xmm1,%xmm6
.byte	102,69,15,56,0,231
	aesenc	%xmm1,%xmm7
.byte	102,69,15,56,0,239

	aesenclast	%xmm0,%xmm2
	movups	(%rdi),%xmm8
1125
1126
1127
1128
1129
1130
1131



1132
1133
1134
1135
1136
1137
1138



1139
1140
1141
1142
1143
1144
1145
	xorps	%xmm4,%xmm10
	movups	%xmm9,16(%rsi)
	xorps	%xmm5,%xmm11
	movups	%xmm10,32(%rsi)
	movups	%xmm11,48(%rsi)

.Lctr32_done:



	retq
.size	aesni_ctr32_encrypt_blocks,.-aesni_ctr32_encrypt_blocks
.globl	aesni_xts_encrypt
.type	aesni_xts_encrypt,@function
.align	16
aesni_xts_encrypt:
	leaq	-104(%rsp),%rsp



	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15







>
>
>






|
>
>
>







1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
	xorps	%xmm4,%xmm10
	movups	%xmm9,16(%rsi)
	xorps	%xmm5,%xmm11
	movups	%xmm10,32(%rsi)
	movups	%xmm11,48(%rsi)

.Lctr32_done:
	leaq	(%rbp),%rsp
	popq	%rbp
.Lctr32_ret:
	retq
.size	aesni_ctr32_encrypt_blocks,.-aesni_ctr32_encrypt_blocks
.globl	aesni_xts_encrypt
.type	aesni_xts_encrypt,@function
.align	16
aesni_xts_encrypt:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$96,%rsp
	leaq	-8(%rax),%rbp
	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15
1519
1520
1521
1522
1523
1524
1525
1526

1527
1528
1529
1530
1531
1532
1533
1534



1535
1536
1537
1538
1539
1540
1541
	leaq	16(%rcx),%rcx
	jnz	.Loop_enc1_10	
	aesenclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,-16(%rsi)

.Lxts_enc_ret:
	leaq	104(%rsp),%rsp

.Lxts_enc_epilogue:
	retq
.size	aesni_xts_encrypt,.-aesni_xts_encrypt
.globl	aesni_xts_decrypt
.type	aesni_xts_decrypt,@function
.align	16
aesni_xts_decrypt:
	leaq	-104(%rsp),%rsp



	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15







|
>







|
>
>
>







1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
	leaq	16(%rcx),%rcx
	jnz	.Loop_enc1_10	
	aesenclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,-16(%rsi)

.Lxts_enc_ret:
	leaq	(%rbp),%rsp
	popq	%rbp
.Lxts_enc_epilogue:
	retq
.size	aesni_xts_encrypt,.-aesni_xts_encrypt
.globl	aesni_xts_decrypt
.type	aesni_xts_decrypt,@function
.align	16
aesni_xts_decrypt:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$96,%rsp
	leaq	-8(%rax),%rbp
	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15
1959
1960
1961
1962
1963
1964
1965
1966

1967
1968
1969
1970
1971
1972
1973
	leaq	16(%rcx),%rcx
	jnz	.Loop_dec1_14	
	aesdeclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,(%rsi)

.Lxts_dec_ret:
	leaq	104(%rsp),%rsp

.Lxts_dec_epilogue:
	retq
.size	aesni_xts_decrypt,.-aesni_xts_decrypt
.globl	aesni_cbc_encrypt
.type	aesni_cbc_encrypt,@function
.align	16
aesni_cbc_encrypt:







|
>







1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
	leaq	16(%rcx),%rcx
	jnz	.Loop_dec1_14	
	aesdeclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,(%rsi)

.Lxts_dec_ret:
	leaq	(%rbp),%rsp
	popq	%rbp
.Lxts_dec_epilogue:
	retq
.size	aesni_xts_decrypt,.-aesni_xts_decrypt
.globl	aesni_cbc_encrypt
.type	aesni_cbc_encrypt,@function
.align	16
aesni_cbc_encrypt:
2026
2027
2028
2029
2030
2031
2032




2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
	movq	%rdi,%rsi
	movq	%r11,%rcx
	xorq	%rdx,%rdx
	jmp	.Lcbc_enc_loop	

.align	16
.Lcbc_decrypt:




	movups	(%r8),%xmm9
	movl	%r10d,%eax
	cmpq	$112,%rdx
	jbe	.Lcbc_dec_tail
	shrl	$1,%r10d
	subq	$112,%rdx
	movl	%r10d,%eax
	movaps	%xmm9,-24(%rsp)
	jmp	.Lcbc_dec_loop8_enter
.align	16
.Lcbc_dec_loop8:
	movaps	%xmm0,-24(%rsp)
	movups	%xmm9,(%rsi)
	leaq	16(%rsi),%rsi
.Lcbc_dec_loop8_enter:
	movups	(%rcx),%xmm0
	movups	(%rdi),%xmm2
	movups	16(%rdi),%xmm3
	movups	16(%rcx),%xmm1







>
>
>
>







|



|







2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
	movq	%rdi,%rsi
	movq	%r11,%rcx
	xorq	%rdx,%rdx
	jmp	.Lcbc_enc_loop	

.align	16
.Lcbc_decrypt:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$16,%rsp
	leaq	-8(%rax),%rbp
	movups	(%r8),%xmm9
	movl	%r10d,%eax
	cmpq	$112,%rdx
	jbe	.Lcbc_dec_tail
	shrl	$1,%r10d
	subq	$112,%rdx
	movl	%r10d,%eax
	movaps	%xmm9,(%rsp)
	jmp	.Lcbc_dec_loop8_enter
.align	16
.Lcbc_dec_loop8:
	movaps	%xmm0,(%rsp)
	movups	%xmm9,(%rsi)
	leaq	16(%rsi),%rsi
.Lcbc_dec_loop8_enter:
	movups	(%rcx),%xmm0
	movups	(%rdi),%xmm2
	movups	16(%rdi),%xmm3
	movups	16(%rcx),%xmm1
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
	aesdec	%xmm1,%xmm9
	movups	16(%rcx),%xmm1

	call	.Ldec_loop8_enter

	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	-24(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6







|







2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
	aesdec	%xmm1,%xmm9
	movups	16(%rcx),%xmm1

	call	.Ldec_loop8_enter

	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
	jbe	.Lcbc_dec_five

	movups	80(%rdi),%xmm7
	cmpq	$96,%rdx
	jbe	.Lcbc_dec_six

	movups	96(%rdi),%xmm8
	movaps	%xmm9,-24(%rsp)
	call	_aesni_decrypt8
	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	-24(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6







|



|







2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
	jbe	.Lcbc_dec_five

	movups	80(%rdi),%xmm7
	cmpq	$96,%rdx
	jbe	.Lcbc_dec_six

	movups	96(%rdi),%xmm8
	movaps	%xmm9,(%rsp)
	call	_aesni_decrypt8
	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291


2292
2293
2294
2295
2296
2297
2298
	andq	$15,%rdx
	movups	%xmm9,(%r8)
	jnz	.Lcbc_dec_tail_partial
	movups	%xmm2,(%rsi)
	jmp	.Lcbc_dec_ret
.align	16
.Lcbc_dec_tail_partial:
	movaps	%xmm2,-24(%rsp)
	movq	$16,%rcx
	movq	%rsi,%rdi
	subq	%rdx,%rcx
	leaq	-24(%rsp),%rsi
.long	0x9066A4F3	

.Lcbc_dec_ret:


.Lcbc_ret:
	retq
.size	aesni_cbc_encrypt,.-aesni_cbc_encrypt
.globl	aesni_set_decrypt_key
.type	aesni_set_decrypt_key,@function
.align	16
aesni_set_decrypt_key:







|



|



>
>







2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
	andq	$15,%rdx
	movups	%xmm9,(%r8)
	jnz	.Lcbc_dec_tail_partial
	movups	%xmm2,(%rsi)
	jmp	.Lcbc_dec_ret
.align	16
.Lcbc_dec_tail_partial:
	movaps	%xmm2,(%rsp)
	movq	$16,%rcx
	movq	%rsi,%rdi
	subq	%rdx,%rcx
	leaq	(%rsp),%rsi
.long	0x9066A4F3	

.Lcbc_dec_ret:
	leaq	(%rbp),%rsp
	popq	%rbp
.Lcbc_ret:
	retq
.size	aesni_cbc_encrypt,.-aesni_cbc_encrypt
.globl	aesni_set_decrypt_key
.type	aesni_set_decrypt_key,@function
.align	16
aesni_set_decrypt_key:
Changes to jni/libressl/crypto/aes/aesni-macosx-x86_64.S.
883
884
885
886
887
888
889




890
891
892
893
894
895
896
	movups	%xmm3,(%r9)
	retq

.globl	_aesni_ctr32_encrypt_blocks

.p2align	4
_aesni_ctr32_encrypt_blocks:




	cmpq	$1,%rdx
	je	L$ctr32_one_shortcut

	movdqu	(%r8),%xmm14
	movdqa	L$bswap_mask(%rip),%xmm15
	xorl	%eax,%eax
.byte	102,69,15,58,22,242,3







>
>
>
>







883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
	movups	%xmm3,(%r9)
	retq

.globl	_aesni_ctr32_encrypt_blocks

.p2align	4
_aesni_ctr32_encrypt_blocks:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$32,%rsp
	leaq	-8(%rax),%rbp
	cmpq	$1,%rdx
	je	L$ctr32_one_shortcut

	movdqu	(%r8),%xmm14
	movdqa	L$bswap_mask(%rip),%xmm15
	xorl	%eax,%eax
.byte	102,69,15,58,22,242,3
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
.byte	102,69,15,58,34,226,1
	incq	%r11
.byte	102,69,15,58,34,235,1
	incl	%r10d
.byte	102,69,15,58,34,226,2
	incq	%r11
.byte	102,69,15,58,34,235,2
	movdqa	%xmm12,-40(%rsp)
.byte	102,69,15,56,0,231
	movdqa	%xmm13,-24(%rsp)
.byte	102,69,15,56,0,239

	pshufd	$192,%xmm12,%xmm2
	pshufd	$128,%xmm12,%xmm3
	pshufd	$64,%xmm12,%xmm4
	cmpq	$6,%rdx
	jb	L$ctr32_tail







|

|







911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
.byte	102,69,15,58,34,226,1
	incq	%r11
.byte	102,69,15,58,34,235,1
	incl	%r10d
.byte	102,69,15,58,34,226,2
	incq	%r11
.byte	102,69,15,58,34,235,2
	movdqa	%xmm12,0(%rsp)
.byte	102,69,15,56,0,231
	movdqa	%xmm13,16(%rsp)
.byte	102,69,15,56,0,239

	pshufd	$192,%xmm12,%xmm2
	pshufd	$128,%xmm12,%xmm3
	pshufd	$64,%xmm12,%xmm4
	cmpq	$6,%rdx
	jb	L$ctr32_tail
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
	aesenc	%xmm1,%xmm2
	leaq	32(%r11),%rcx
	pxor	%xmm0,%xmm4
	aesenc	%xmm1,%xmm3
	movdqa	L$increment32(%rip),%xmm13
	pxor	%xmm0,%xmm5
	aesenc	%xmm1,%xmm4
	movdqa	-40(%rsp),%xmm12
	pxor	%xmm0,%xmm6
	aesenc	%xmm1,%xmm5
	pxor	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	decl	%eax
	aesenc	%xmm1,%xmm6
	aesenc	%xmm1,%xmm7







|







953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
	aesenc	%xmm1,%xmm2
	leaq	32(%r11),%rcx
	pxor	%xmm0,%xmm4
	aesenc	%xmm1,%xmm3
	movdqa	L$increment32(%rip),%xmm13
	pxor	%xmm0,%xmm5
	aesenc	%xmm1,%xmm4
	movdqa	(%rsp),%xmm12
	pxor	%xmm0,%xmm6
	aesenc	%xmm1,%xmm5
	pxor	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	decl	%eax
	aesenc	%xmm1,%xmm6
	aesenc	%xmm1,%xmm7
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
	aesenc	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	jnz	L$ctr32_enc_loop6

	aesenc	%xmm1,%xmm2
	paddd	%xmm13,%xmm12
	aesenc	%xmm1,%xmm3
	paddd	-24(%rsp),%xmm13
	aesenc	%xmm1,%xmm4
	movdqa	%xmm12,-40(%rsp)
	aesenc	%xmm1,%xmm5
	movdqa	%xmm13,-24(%rsp)
	aesenc	%xmm1,%xmm6
.byte	102,69,15,56,0,231
	aesenc	%xmm1,%xmm7
.byte	102,69,15,56,0,239

	aesenclast	%xmm0,%xmm2
	movups	(%rdi),%xmm8







|

|

|







986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
	aesenc	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	jnz	L$ctr32_enc_loop6

	aesenc	%xmm1,%xmm2
	paddd	%xmm13,%xmm12
	aesenc	%xmm1,%xmm3
	paddd	16(%rsp),%xmm13
	aesenc	%xmm1,%xmm4
	movdqa	%xmm12,0(%rsp)
	aesenc	%xmm1,%xmm5
	movdqa	%xmm13,16(%rsp)
	aesenc	%xmm1,%xmm6
.byte	102,69,15,56,0,231
	aesenc	%xmm1,%xmm7
.byte	102,69,15,56,0,239

	aesenclast	%xmm0,%xmm2
	movups	(%rdi),%xmm8
1125
1126
1127
1128
1129
1130
1131



1132
1133
1134
1135
1136
1137
1138



1139
1140
1141
1142
1143
1144
1145
	xorps	%xmm4,%xmm10
	movups	%xmm9,16(%rsi)
	xorps	%xmm5,%xmm11
	movups	%xmm10,32(%rsi)
	movups	%xmm11,48(%rsi)

L$ctr32_done:



	retq

.globl	_aesni_xts_encrypt

.p2align	4
_aesni_xts_encrypt:
	leaq	-104(%rsp),%rsp



	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15







>
>
>






|
>
>
>







1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
	xorps	%xmm4,%xmm10
	movups	%xmm9,16(%rsi)
	xorps	%xmm5,%xmm11
	movups	%xmm10,32(%rsi)
	movups	%xmm11,48(%rsi)

L$ctr32_done:
	leaq	(%rbp),%rsp
	popq	%rbp
L$ctr32_ret:
	retq

.globl	_aesni_xts_encrypt

.p2align	4
_aesni_xts_encrypt:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$96,%rsp
	leaq	-8(%rax),%rbp
	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15
1519
1520
1521
1522
1523
1524
1525
1526

1527
1528
1529
1530
1531
1532
1533
1534



1535
1536
1537
1538
1539
1540
1541
	leaq	16(%rcx),%rcx
	jnz	L$oop_enc1_10	
	aesenclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,-16(%rsi)

L$xts_enc_ret:
	leaq	104(%rsp),%rsp

L$xts_enc_epilogue:
	retq

.globl	_aesni_xts_decrypt

.p2align	4
_aesni_xts_decrypt:
	leaq	-104(%rsp),%rsp



	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15







|
>







|
>
>
>







1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
	leaq	16(%rcx),%rcx
	jnz	L$oop_enc1_10	
	aesenclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,-16(%rsi)

L$xts_enc_ret:
	leaq	(%rbp),%rsp
	popq	%rbp
L$xts_enc_epilogue:
	retq

.globl	_aesni_xts_decrypt

.p2align	4
_aesni_xts_decrypt:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$96,%rsp
	leaq	-8(%rax),%rbp
	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15
1959
1960
1961
1962
1963
1964
1965
1966

1967
1968
1969
1970
1971
1972
1973
	leaq	16(%rcx),%rcx
	jnz	L$oop_dec1_14	
	aesdeclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,(%rsi)

L$xts_dec_ret:
	leaq	104(%rsp),%rsp

L$xts_dec_epilogue:
	retq

.globl	_aesni_cbc_encrypt

.p2align	4
_aesni_cbc_encrypt:







|
>







1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
	leaq	16(%rcx),%rcx
	jnz	L$oop_dec1_14	
	aesdeclast	%xmm1,%xmm2
	xorps	%xmm10,%xmm2
	movups	%xmm2,(%rsi)

L$xts_dec_ret:
	leaq	(%rbp),%rsp
	popq	%rbp
L$xts_dec_epilogue:
	retq

.globl	_aesni_cbc_encrypt

.p2align	4
_aesni_cbc_encrypt:
2026
2027
2028
2029
2030
2031
2032




2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
	movq	%rdi,%rsi
	movq	%r11,%rcx
	xorq	%rdx,%rdx
	jmp	L$cbc_enc_loop	

.p2align	4
L$cbc_decrypt:




	movups	(%r8),%xmm9
	movl	%r10d,%eax
	cmpq	$112,%rdx
	jbe	L$cbc_dec_tail
	shrl	$1,%r10d
	subq	$112,%rdx
	movl	%r10d,%eax
	movaps	%xmm9,-24(%rsp)
	jmp	L$cbc_dec_loop8_enter
.p2align	4
L$cbc_dec_loop8:
	movaps	%xmm0,-24(%rsp)
	movups	%xmm9,(%rsi)
	leaq	16(%rsi),%rsi
L$cbc_dec_loop8_enter:
	movups	(%rcx),%xmm0
	movups	(%rdi),%xmm2
	movups	16(%rdi),%xmm3
	movups	16(%rcx),%xmm1







>
>
>
>







|



|







2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
	movq	%rdi,%rsi
	movq	%r11,%rcx
	xorq	%rdx,%rdx
	jmp	L$cbc_enc_loop	

.p2align	4
L$cbc_decrypt:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$16,%rsp
	leaq	-8(%rax),%rbp
	movups	(%r8),%xmm9
	movl	%r10d,%eax
	cmpq	$112,%rdx
	jbe	L$cbc_dec_tail
	shrl	$1,%r10d
	subq	$112,%rdx
	movl	%r10d,%eax
	movaps	%xmm9,(%rsp)
	jmp	L$cbc_dec_loop8_enter
.p2align	4
L$cbc_dec_loop8:
	movaps	%xmm0,(%rsp)
	movups	%xmm9,(%rsi)
	leaq	16(%rsi),%rsi
L$cbc_dec_loop8_enter:
	movups	(%rcx),%xmm0
	movups	(%rdi),%xmm2
	movups	16(%rdi),%xmm3
	movups	16(%rcx),%xmm1
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
	aesdec	%xmm1,%xmm9
	movups	16(%rcx),%xmm1

	call	L$dec_loop8_enter

	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	-24(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6







|







2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
	aesdec	%xmm1,%xmm9
	movups	16(%rcx),%xmm1

	call	L$dec_loop8_enter

	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
	jbe	L$cbc_dec_five

	movups	80(%rdi),%xmm7
	cmpq	$96,%rdx
	jbe	L$cbc_dec_six

	movups	96(%rdi),%xmm8
	movaps	%xmm9,-24(%rsp)
	call	_aesni_decrypt8
	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	-24(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6







|



|







2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
	jbe	L$cbc_dec_five

	movups	80(%rdi),%xmm7
	cmpq	$96,%rdx
	jbe	L$cbc_dec_six

	movups	96(%rdi),%xmm8
	movaps	%xmm9,(%rsp)
	call	_aesni_decrypt8
	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291


2292
2293
2294
2295
2296
2297
2298
	andq	$15,%rdx
	movups	%xmm9,(%r8)
	jnz	L$cbc_dec_tail_partial
	movups	%xmm2,(%rsi)
	jmp	L$cbc_dec_ret
.p2align	4
L$cbc_dec_tail_partial:
	movaps	%xmm2,-24(%rsp)
	movq	$16,%rcx
	movq	%rsi,%rdi
	subq	%rdx,%rcx
	leaq	-24(%rsp),%rsi
.long	0x9066A4F3	

L$cbc_dec_ret:


L$cbc_ret:
	retq

.globl	_aesni_set_decrypt_key

.p2align	4
_aesni_set_decrypt_key:







|



|



>
>







2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
	andq	$15,%rdx
	movups	%xmm9,(%r8)
	jnz	L$cbc_dec_tail_partial
	movups	%xmm2,(%rsi)
	jmp	L$cbc_dec_ret
.p2align	4
L$cbc_dec_tail_partial:
	movaps	%xmm2,(%rsp)
	movq	$16,%rcx
	movq	%rsi,%rdi
	subq	%rdx,%rcx
	leaq	(%rsp),%rsi
.long	0x9066A4F3	

L$cbc_dec_ret:
	leaq	(%rbp),%rsp
	popq	%rbp
L$cbc_ret:
	retq

.globl	_aesni_set_decrypt_key

.p2align	4
_aesni_set_decrypt_key:
Changes to jni/libressl/crypto/aes/aesni-masm-x86_64.S.
1030
1031
1032
1033
1034
1035
1036
1037


1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048

1049
1050
1051
1052
1053
1054
1055
	mov	rdi,rcx
	mov	rsi,rdx
	mov	rdx,r8
	mov	rcx,r9
	mov	r8,QWORD PTR[40+rsp]


	lea	rsp,QWORD PTR[((-200))+rsp]


	movaps	XMMWORD PTR[32+rsp],xmm6
	movaps	XMMWORD PTR[48+rsp],xmm7
	movaps	XMMWORD PTR[64+rsp],xmm8
	movaps	XMMWORD PTR[80+rsp],xmm9
	movaps	XMMWORD PTR[96+rsp],xmm10
	movaps	XMMWORD PTR[112+rsp],xmm11
	movaps	XMMWORD PTR[128+rsp],xmm12
	movaps	XMMWORD PTR[144+rsp],xmm13
	movaps	XMMWORD PTR[160+rsp],xmm14
	movaps	XMMWORD PTR[176+rsp],xmm15
$L$ctr32_body::

	cmp	rdx,1
	je	$L$ctr32_one_shortcut

	movdqu	xmm14,XMMWORD PTR[r8]
	movdqa	xmm15,XMMWORD PTR[$L$bswap_mask]
	xor	eax,eax
DB	102,69,15,58,22,242,3







|
>
>











>







1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
	mov	rdi,rcx
	mov	rsi,rdx
	mov	rdx,r8
	mov	rcx,r9
	mov	r8,QWORD PTR[40+rsp]


	lea	rax,QWORD PTR[rsp]
	push	rbp
	sub	rsp,192
	movaps	XMMWORD PTR[32+rsp],xmm6
	movaps	XMMWORD PTR[48+rsp],xmm7
	movaps	XMMWORD PTR[64+rsp],xmm8
	movaps	XMMWORD PTR[80+rsp],xmm9
	movaps	XMMWORD PTR[96+rsp],xmm10
	movaps	XMMWORD PTR[112+rsp],xmm11
	movaps	XMMWORD PTR[128+rsp],xmm12
	movaps	XMMWORD PTR[144+rsp],xmm13
	movaps	XMMWORD PTR[160+rsp],xmm14
	movaps	XMMWORD PTR[176+rsp],xmm15
$L$ctr32_body::
	lea	rbp,QWORD PTR[((-8))+rax]
	cmp	rdx,1
	je	$L$ctr32_one_shortcut

	movdqu	xmm14,XMMWORD PTR[r8]
	movdqa	xmm15,XMMWORD PTR[$L$bswap_mask]
	xor	eax,eax
DB	102,69,15,58,22,242,3
1294
1295
1296
1297
1298
1299
1300
1301

1302
1303
1304
1305
1306
1307
1308
	movaps	xmm9,XMMWORD PTR[80+rsp]
	movaps	xmm10,XMMWORD PTR[96+rsp]
	movaps	xmm11,XMMWORD PTR[112+rsp]
	movaps	xmm12,XMMWORD PTR[128+rsp]
	movaps	xmm13,XMMWORD PTR[144+rsp]
	movaps	xmm14,XMMWORD PTR[160+rsp]
	movaps	xmm15,XMMWORD PTR[176+rsp]
	lea	rsp,QWORD PTR[200+rsp]

$L$ctr32_ret::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_ctr32_encrypt_blocks::
aesni_ctr32_encrypt_blocks	ENDP
PUBLIC	aesni_xts_encrypt







|
>







1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
	movaps	xmm9,XMMWORD PTR[80+rsp]
	movaps	xmm10,XMMWORD PTR[96+rsp]
	movaps	xmm11,XMMWORD PTR[112+rsp]
	movaps	xmm12,XMMWORD PTR[128+rsp]
	movaps	xmm13,XMMWORD PTR[144+rsp]
	movaps	xmm14,XMMWORD PTR[160+rsp]
	movaps	xmm15,XMMWORD PTR[176+rsp]
	lea	rsp,QWORD PTR[rbp]
	pop	rbp
$L$ctr32_ret::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_ctr32_encrypt_blocks::
aesni_ctr32_encrypt_blocks	ENDP
PUBLIC	aesni_xts_encrypt
1317
1318
1319
1320
1321
1322
1323
1324


1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335

1336
1337
1338
1339
1340
1341
1342
	mov	rsi,rdx
	mov	rdx,r8
	mov	rcx,r9
	mov	r8,QWORD PTR[40+rsp]
	mov	r9,QWORD PTR[48+rsp]


	lea	rsp,QWORD PTR[((-264))+rsp]


	movaps	XMMWORD PTR[96+rsp],xmm6
	movaps	XMMWORD PTR[112+rsp],xmm7
	movaps	XMMWORD PTR[128+rsp],xmm8
	movaps	XMMWORD PTR[144+rsp],xmm9
	movaps	XMMWORD PTR[160+rsp],xmm10
	movaps	XMMWORD PTR[176+rsp],xmm11
	movaps	XMMWORD PTR[192+rsp],xmm12
	movaps	XMMWORD PTR[208+rsp],xmm13
	movaps	XMMWORD PTR[224+rsp],xmm14
	movaps	XMMWORD PTR[240+rsp],xmm15
$L$xts_enc_body::

	movups	xmm15,XMMWORD PTR[r9]
	mov	eax,DWORD PTR[240+r8]
	mov	r10d,DWORD PTR[240+rcx]
	movups	xmm0,XMMWORD PTR[r8]
	movups	xmm1,XMMWORD PTR[16+r8]
	lea	r8,QWORD PTR[32+r8]
	xorps	xmm15,xmm0







|
>
>











>







1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
	mov	rsi,rdx
	mov	rdx,r8
	mov	rcx,r9
	mov	r8,QWORD PTR[40+rsp]
	mov	r9,QWORD PTR[48+rsp]


	lea	rax,QWORD PTR[rsp]
	push	rbp
	sub	rsp,256
	movaps	XMMWORD PTR[96+rsp],xmm6
	movaps	XMMWORD PTR[112+rsp],xmm7
	movaps	XMMWORD PTR[128+rsp],xmm8
	movaps	XMMWORD PTR[144+rsp],xmm9
	movaps	XMMWORD PTR[160+rsp],xmm10
	movaps	XMMWORD PTR[176+rsp],xmm11
	movaps	XMMWORD PTR[192+rsp],xmm12
	movaps	XMMWORD PTR[208+rsp],xmm13
	movaps	XMMWORD PTR[224+rsp],xmm14
	movaps	XMMWORD PTR[240+rsp],xmm15
$L$xts_enc_body::
	lea	rbp,QWORD PTR[((-8))+rax]
	movups	xmm15,XMMWORD PTR[r9]
	mov	eax,DWORD PTR[240+r8]
	mov	r10d,DWORD PTR[240+rcx]
	movups	xmm0,XMMWORD PTR[r8]
	movups	xmm1,XMMWORD PTR[16+r8]
	lea	r8,QWORD PTR[32+r8]
	xorps	xmm15,xmm0
1726
1727
1728
1729
1730
1731
1732
1733

1734
1735
1736
1737
1738
1739
1740
	movaps	xmm9,XMMWORD PTR[144+rsp]
	movaps	xmm10,XMMWORD PTR[160+rsp]
	movaps	xmm11,XMMWORD PTR[176+rsp]
	movaps	xmm12,XMMWORD PTR[192+rsp]
	movaps	xmm13,XMMWORD PTR[208+rsp]
	movaps	xmm14,XMMWORD PTR[224+rsp]
	movaps	xmm15,XMMWORD PTR[240+rsp]
	lea	rsp,QWORD PTR[264+rsp]

$L$xts_enc_epilogue::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_xts_encrypt::
aesni_xts_encrypt	ENDP
PUBLIC	aesni_xts_decrypt







|
>







1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
	movaps	xmm9,XMMWORD PTR[144+rsp]
	movaps	xmm10,XMMWORD PTR[160+rsp]
	movaps	xmm11,XMMWORD PTR[176+rsp]
	movaps	xmm12,XMMWORD PTR[192+rsp]
	movaps	xmm13,XMMWORD PTR[208+rsp]
	movaps	xmm14,XMMWORD PTR[224+rsp]
	movaps	xmm15,XMMWORD PTR[240+rsp]
	lea	rsp,QWORD PTR[rbp]
	pop	rbp
$L$xts_enc_epilogue::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_xts_encrypt::
aesni_xts_encrypt	ENDP
PUBLIC	aesni_xts_decrypt
1749
1750
1751
1752
1753
1754
1755
1756


1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767

1768
1769
1770
1771
1772
1773
1774
	mov	rsi,rdx
	mov	rdx,r8
	mov	rcx,r9
	mov	r8,QWORD PTR[40+rsp]
	mov	r9,QWORD PTR[48+rsp]


	lea	rsp,QWORD PTR[((-264))+rsp]


	movaps	XMMWORD PTR[96+rsp],xmm6
	movaps	XMMWORD PTR[112+rsp],xmm7
	movaps	XMMWORD PTR[128+rsp],xmm8
	movaps	XMMWORD PTR[144+rsp],xmm9
	movaps	XMMWORD PTR[160+rsp],xmm10
	movaps	XMMWORD PTR[176+rsp],xmm11
	movaps	XMMWORD PTR[192+rsp],xmm12
	movaps	XMMWORD PTR[208+rsp],xmm13
	movaps	XMMWORD PTR[224+rsp],xmm14
	movaps	XMMWORD PTR[240+rsp],xmm15
$L$xts_dec_body::

	movups	xmm15,XMMWORD PTR[r9]
	mov	eax,DWORD PTR[240+r8]
	mov	r10d,DWORD PTR[240+rcx]
	movups	xmm0,XMMWORD PTR[r8]
	movups	xmm1,XMMWORD PTR[16+r8]
	lea	r8,QWORD PTR[32+r8]
	xorps	xmm15,xmm0







|
>
>











>







1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
	mov	rsi,rdx
	mov	rdx,r8
	mov	rcx,r9
	mov	r8,QWORD PTR[40+rsp]
	mov	r9,QWORD PTR[48+rsp]


	lea	rax,QWORD PTR[rsp]
	push	rbp
	sub	rsp,256
	movaps	XMMWORD PTR[96+rsp],xmm6
	movaps	XMMWORD PTR[112+rsp],xmm7
	movaps	XMMWORD PTR[128+rsp],xmm8
	movaps	XMMWORD PTR[144+rsp],xmm9
	movaps	XMMWORD PTR[160+rsp],xmm10
	movaps	XMMWORD PTR[176+rsp],xmm11
	movaps	XMMWORD PTR[192+rsp],xmm12
	movaps	XMMWORD PTR[208+rsp],xmm13
	movaps	XMMWORD PTR[224+rsp],xmm14
	movaps	XMMWORD PTR[240+rsp],xmm15
$L$xts_dec_body::
	lea	rbp,QWORD PTR[((-8))+rax]
	movups	xmm15,XMMWORD PTR[r9]
	mov	eax,DWORD PTR[240+r8]
	mov	r10d,DWORD PTR[240+rcx]
	movups	xmm0,XMMWORD PTR[r8]
	movups	xmm1,XMMWORD PTR[16+r8]
	lea	r8,QWORD PTR[32+r8]
	xorps	xmm15,xmm0
2202
2203
2204
2205
2206
2207
2208
2209

2210
2211
2212
2213
2214
2215
2216
	movaps	xmm9,XMMWORD PTR[144+rsp]
	movaps	xmm10,XMMWORD PTR[160+rsp]
	movaps	xmm11,XMMWORD PTR[176+rsp]
	movaps	xmm12,XMMWORD PTR[192+rsp]
	movaps	xmm13,XMMWORD PTR[208+rsp]
	movaps	xmm14,XMMWORD PTR[224+rsp]
	movaps	xmm15,XMMWORD PTR[240+rsp]
	lea	rsp,QWORD PTR[264+rsp]

$L$xts_dec_epilogue::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_xts_decrypt::
aesni_xts_decrypt	ENDP
PUBLIC	aesni_cbc_encrypt







|
>







2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
	movaps	xmm9,XMMWORD PTR[144+rsp]
	movaps	xmm10,XMMWORD PTR[160+rsp]
	movaps	xmm11,XMMWORD PTR[176+rsp]
	movaps	xmm12,XMMWORD PTR[192+rsp]
	movaps	xmm13,XMMWORD PTR[208+rsp]
	movaps	xmm14,XMMWORD PTR[224+rsp]
	movaps	xmm15,XMMWORD PTR[240+rsp]
	lea	rsp,QWORD PTR[rbp]
	pop	rbp
$L$xts_dec_epilogue::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_xts_decrypt::
aesni_xts_decrypt	ENDP
PUBLIC	aesni_cbc_encrypt
2284
2285
2286
2287
2288
2289
2290
2291


2292
2293
2294
2295
2296

2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
	mov	rsi,rdi
	mov	rcx,r11
	xor	rdx,rdx
	jmp	$L$cbc_enc_loop	

ALIGN	16
$L$cbc_decrypt::
	lea	rsp,QWORD PTR[((-88))+rsp]


	movaps	XMMWORD PTR[rsp],xmm6
	movaps	XMMWORD PTR[16+rsp],xmm7
	movaps	XMMWORD PTR[32+rsp],xmm8
	movaps	XMMWORD PTR[48+rsp],xmm9
$L$cbc_decrypt_body::

	movups	xmm9,XMMWORD PTR[r8]
	mov	eax,r10d
	cmp	rdx,070h
	jbe	$L$cbc_dec_tail
	shr	r10d,1
	sub	rdx,070h
	mov	eax,r10d
	movaps	XMMWORD PTR[64+rsp],xmm9
	jmp	$L$cbc_dec_loop8_enter
ALIGN	16
$L$cbc_dec_loop8::
	movaps	XMMWORD PTR[64+rsp],xmm0
	movups	XMMWORD PTR[rsi],xmm9
	lea	rsi,QWORD PTR[16+rsi]
$L$cbc_dec_loop8_enter::
	movups	xmm0,XMMWORD PTR[rcx]
	movups	xmm2,XMMWORD PTR[rdi]
	movups	xmm3,XMMWORD PTR[16+rdi]
	movups	xmm1,XMMWORD PTR[16+rcx]







|
>
>
|
|
|
|

>







|



|







2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
	mov	rsi,rdi
	mov	rcx,r11
	xor	rdx,rdx
	jmp	$L$cbc_enc_loop	

ALIGN	16
$L$cbc_decrypt::
	lea	rax,QWORD PTR[rsp]
	push	rbp
	sub	rsp,80
	movaps	XMMWORD PTR[16+rsp],xmm6
	movaps	XMMWORD PTR[32+rsp],xmm7
	movaps	XMMWORD PTR[48+rsp],xmm8
	movaps	XMMWORD PTR[64+rsp],xmm9
$L$cbc_decrypt_body::
	lea	rbp,QWORD PTR[((-8))+rax]
	movups	xmm9,XMMWORD PTR[r8]
	mov	eax,r10d
	cmp	rdx,070h
	jbe	$L$cbc_dec_tail
	shr	r10d,1
	sub	rdx,070h
	mov	eax,r10d
	movaps	XMMWORD PTR[rsp],xmm9
	jmp	$L$cbc_dec_loop8_enter
ALIGN	16
$L$cbc_dec_loop8::
	movaps	XMMWORD PTR[rsp],xmm0
	movups	XMMWORD PTR[rsi],xmm9
	lea	rsi,QWORD PTR[16+rsi]
$L$cbc_dec_loop8_enter::
	movups	xmm0,XMMWORD PTR[rcx]
	movups	xmm2,XMMWORD PTR[rdi]
	movups	xmm3,XMMWORD PTR[16+rdi]
	movups	xmm1,XMMWORD PTR[16+rcx]
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
	aesdec	xmm9,xmm1
	movups	xmm1,XMMWORD PTR[16+rcx]

	call	$L$dec_loop8_enter

	movups	xmm1,XMMWORD PTR[rdi]
	movups	xmm0,XMMWORD PTR[16+rdi]
	xorps	xmm2,XMMWORD PTR[64+rsp]
	xorps	xmm3,xmm1
	movups	xmm1,XMMWORD PTR[32+rdi]
	xorps	xmm4,xmm0
	movups	xmm0,XMMWORD PTR[48+rdi]
	xorps	xmm5,xmm1
	movups	xmm1,XMMWORD PTR[64+rdi]
	xorps	xmm6,xmm0







|







2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
	aesdec	xmm9,xmm1
	movups	xmm1,XMMWORD PTR[16+rcx]

	call	$L$dec_loop8_enter

	movups	xmm1,XMMWORD PTR[rdi]
	movups	xmm0,XMMWORD PTR[16+rdi]
	xorps	xmm2,XMMWORD PTR[rsp]
	xorps	xmm3,xmm1
	movups	xmm1,XMMWORD PTR[32+rdi]
	xorps	xmm4,xmm0
	movups	xmm0,XMMWORD PTR[48+rdi]
	xorps	xmm5,xmm1
	movups	xmm1,XMMWORD PTR[64+rdi]
	xorps	xmm6,xmm0
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
	jbe	$L$cbc_dec_five

	movups	xmm7,XMMWORD PTR[80+rdi]
	cmp	rdx,060h
	jbe	$L$cbc_dec_six

	movups	xmm8,XMMWORD PTR[96+rdi]
	movaps	XMMWORD PTR[64+rsp],xmm9
	call	_aesni_decrypt8
	movups	xmm1,XMMWORD PTR[rdi]
	movups	xmm0,XMMWORD PTR[16+rdi]
	xorps	xmm2,XMMWORD PTR[64+rsp]
	xorps	xmm3,xmm1
	movups	xmm1,XMMWORD PTR[32+rdi]
	xorps	xmm4,xmm0
	movups	xmm0,XMMWORD PTR[48+rdi]
	xorps	xmm5,xmm1
	movups	xmm1,XMMWORD PTR[64+rdi]
	xorps	xmm6,xmm0







|



|







2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
	jbe	$L$cbc_dec_five

	movups	xmm7,XMMWORD PTR[80+rdi]
	cmp	rdx,060h
	jbe	$L$cbc_dec_six

	movups	xmm8,XMMWORD PTR[96+rdi]
	movaps	XMMWORD PTR[rsp],xmm9
	call	_aesni_decrypt8
	movups	xmm1,XMMWORD PTR[rdi]
	movups	xmm0,XMMWORD PTR[16+rdi]
	xorps	xmm2,XMMWORD PTR[rsp]
	xorps	xmm3,xmm1
	movups	xmm1,XMMWORD PTR[32+rdi]
	xorps	xmm4,xmm0
	movups	xmm0,XMMWORD PTR[48+rdi]
	xorps	xmm5,xmm1
	movups	xmm1,XMMWORD PTR[64+rdi]
	xorps	xmm6,xmm0
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560

2561
2562
2563
2564
2565
2566
2567
	and	rdx,15
	movups	XMMWORD PTR[r8],xmm9
	jnz	$L$cbc_dec_tail_partial
	movups	XMMWORD PTR[rsi],xmm2
	jmp	$L$cbc_dec_ret
ALIGN	16
$L$cbc_dec_tail_partial::
	movaps	XMMWORD PTR[64+rsp],xmm2
	mov	rcx,16
	mov	rdi,rsi
	sub	rcx,rdx
	lea	rsi,QWORD PTR[64+rsp]
	DD	09066A4F3h	

$L$cbc_dec_ret::
	movaps	xmm6,XMMWORD PTR[rsp]
	movaps	xmm7,XMMWORD PTR[16+rsp]
	movaps	xmm8,XMMWORD PTR[32+rsp]
	movaps	xmm9,XMMWORD PTR[48+rsp]
	lea	rsp,QWORD PTR[88+rsp]

$L$cbc_ret::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_cbc_encrypt::
aesni_cbc_encrypt	ENDP
PUBLIC	aesni_set_decrypt_key







|



|



|
|
|
|
|
>







2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
	and	rdx,15
	movups	XMMWORD PTR[r8],xmm9
	jnz	$L$cbc_dec_tail_partial
	movups	XMMWORD PTR[rsi],xmm2
	jmp	$L$cbc_dec_ret
ALIGN	16
$L$cbc_dec_tail_partial::
	movaps	XMMWORD PTR[rsp],xmm2
	mov	rcx,16
	mov	rdi,rsi
	sub	rcx,rdx
	lea	rsi,QWORD PTR[rsp]
	DD	09066A4F3h	

$L$cbc_dec_ret::
	movaps	xmm6,XMMWORD PTR[16+rsp]
	movaps	xmm7,XMMWORD PTR[32+rsp]
	movaps	xmm8,XMMWORD PTR[48+rsp]
	movaps	xmm9,XMMWORD PTR[64+rsp]
	lea	rsp,QWORD PTR[rbp]
	pop	rbp
$L$cbc_ret::
	mov	rdi,QWORD PTR[8+rsp]	;WIN64 epilogue
	mov	rsi,QWORD PTR[16+rsp]
	DB	0F3h,0C3h		;repret
$L$SEH_end_aesni_cbc_encrypt::
aesni_cbc_encrypt	ENDP
PUBLIC	aesni_set_decrypt_key
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
	cmp	rbx,r10
	jae	$L$common_seh_tail

	lea	rsi,QWORD PTR[32+rax]
	lea	rdi,QWORD PTR[512+r8]
	mov	ecx,20
	DD	0a548f3fch		
	lea	rax,QWORD PTR[200+rax]

	jmp	$L$common_seh_tail
ctr32_se_handler	ENDP


ALIGN	16
xts_se_handler	PROC PRIVATE
	push	rsi
	push	rdi







<

|







2913
2914
2915
2916
2917
2918
2919

2920
2921
2922
2923
2924
2925
2926
2927
2928
	cmp	rbx,r10
	jae	$L$common_seh_tail

	lea	rsi,QWORD PTR[32+rax]
	lea	rdi,QWORD PTR[512+r8]
	mov	ecx,20
	DD	0a548f3fch		


	jmp	$L$common_rbp_tail
ctr32_se_handler	ENDP


ALIGN	16
xts_se_handler	PROC PRIVATE
	push	rsi
	push	rdi
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
	cmp	rbx,r10
	jae	$L$common_seh_tail

	lea	rsi,QWORD PTR[96+rax]
	lea	rdi,QWORD PTR[512+r8]
	mov	ecx,20
	DD	0a548f3fch		
	lea	rax,QWORD PTR[((104+160))+rax]

	jmp	$L$common_seh_tail
xts_se_handler	ENDP

ALIGN	16
cbc_se_handler	PROC PRIVATE
	push	rsi
	push	rdi
	push	rbx







<

|







2953
2954
2955
2956
2957
2958
2959

2960
2961
2962
2963
2964
2965
2966
2967
2968
	cmp	rbx,r10
	jae	$L$common_seh_tail

	lea	rsi,QWORD PTR[96+rax]
	lea	rdi,QWORD PTR[512+r8]
	mov	ecx,20
	DD	0a548f3fch		


	jmp	$L$common_rbp_tail
xts_se_handler	ENDP

ALIGN	16
cbc_se_handler	PROC PRIVATE
	push	rsi
	push	rdi
	push	rbx
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981




2982

2983
2984
2985
2986
2987
2988
2989
	cmp	rbx,r10
	jb	$L$restore_cbc_rax

	lea	r10,QWORD PTR[$L$cbc_ret]
	cmp	rbx,r10
	jae	$L$common_seh_tail

	lea	rsi,QWORD PTR[rax]
	lea	rdi,QWORD PTR[512+r8]
	mov	ecx,8
	DD	0a548f3fch		




	lea	rax,QWORD PTR[88+rax]

	jmp	$L$common_seh_tail

$L$restore_cbc_rax::
	mov	rax,QWORD PTR[120+r8]

$L$common_seh_tail::
	mov	rdi,QWORD PTR[8+rax]







|



>
>
>
>
|
>







2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
	cmp	rbx,r10
	jb	$L$restore_cbc_rax

	lea	r10,QWORD PTR[$L$cbc_ret]
	cmp	rbx,r10
	jae	$L$common_seh_tail

	lea	rsi,QWORD PTR[16+rax]
	lea	rdi,QWORD PTR[512+r8]
	mov	ecx,8
	DD	0a548f3fch		

$L$common_rbp_tail::
	mov	rax,QWORD PTR[160+r8]
	mov	rbp,QWORD PTR[rax]
	lea	rax,QWORD PTR[8+rax]
	mov	QWORD PTR[160+r8],rbp
	jmp	$L$common_seh_tail

$L$restore_cbc_rax::
	mov	rax,QWORD PTR[120+r8]

$L$common_seh_tail::
	mov	rdi,QWORD PTR[8+rax]
Changes to jni/libressl/crypto/aes/aesni-mingw64-x86_64.S.
955
956
957
958
959
960
961
962


963
964
965
966
967
968
969
970
971
972
973

974
975
976
977
978
979
980
.LSEH_begin_aesni_ctr32_encrypt_blocks:
	movq	%rcx,%rdi
	movq	%rdx,%rsi
	movq	%r8,%rdx
	movq	%r9,%rcx
	movq	40(%rsp),%r8

	leaq	-200(%rsp),%rsp


	movaps	%xmm6,32(%rsp)
	movaps	%xmm7,48(%rsp)
	movaps	%xmm8,64(%rsp)
	movaps	%xmm9,80(%rsp)
	movaps	%xmm10,96(%rsp)
	movaps	%xmm11,112(%rsp)
	movaps	%xmm12,128(%rsp)
	movaps	%xmm13,144(%rsp)
	movaps	%xmm14,160(%rsp)
	movaps	%xmm15,176(%rsp)
.Lctr32_body:

	cmpq	$1,%rdx
	je	.Lctr32_one_shortcut

	movdqu	(%r8),%xmm14
	movdqa	.Lbswap_mask(%rip),%xmm15
	xorl	%eax,%eax
.byte	102,69,15,58,22,242,3







|
>
>











>







955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
.LSEH_begin_aesni_ctr32_encrypt_blocks:
	movq	%rcx,%rdi
	movq	%rdx,%rsi
	movq	%r8,%rdx
	movq	%r9,%rcx
	movq	40(%rsp),%r8

	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$192,%rsp
	movaps	%xmm6,32(%rsp)
	movaps	%xmm7,48(%rsp)
	movaps	%xmm8,64(%rsp)
	movaps	%xmm9,80(%rsp)
	movaps	%xmm10,96(%rsp)
	movaps	%xmm11,112(%rsp)
	movaps	%xmm12,128(%rsp)
	movaps	%xmm13,144(%rsp)
	movaps	%xmm14,160(%rsp)
	movaps	%xmm15,176(%rsp)
.Lctr32_body:
	leaq	-8(%rax),%rbp
	cmpq	$1,%rdx
	je	.Lctr32_one_shortcut

	movdqu	(%r8),%xmm14
	movdqa	.Lbswap_mask(%rip),%xmm15
	xorl	%eax,%eax
.byte	102,69,15,58,22,242,3
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
	aesenc	%xmm1,%xmm2
	leaq	32(%r11),%rcx
	pxor	%xmm0,%xmm4
	aesenc	%xmm1,%xmm3
	movdqa	.Lincrement32(%rip),%xmm13
	pxor	%xmm0,%xmm5
	aesenc	%xmm1,%xmm4
	movdqa	0(%rsp),%xmm12
	pxor	%xmm0,%xmm6
	aesenc	%xmm1,%xmm5
	pxor	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	decl	%eax
	aesenc	%xmm1,%xmm6
	aesenc	%xmm1,%xmm7







|







1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
	aesenc	%xmm1,%xmm2
	leaq	32(%r11),%rcx
	pxor	%xmm0,%xmm4
	aesenc	%xmm1,%xmm3
	movdqa	.Lincrement32(%rip),%xmm13
	pxor	%xmm0,%xmm5
	aesenc	%xmm1,%xmm4
	movdqa	(%rsp),%xmm12
	pxor	%xmm0,%xmm6
	aesenc	%xmm1,%xmm5
	pxor	%xmm0,%xmm7
	movups	(%rcx),%xmm0
	decl	%eax
	aesenc	%xmm1,%xmm6
	aesenc	%xmm1,%xmm7
1219
1220
1221
1222
1223
1224
1225
1226

1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247


1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258

1259
1260
1261
1262
1263
1264
1265
	movaps	80(%rsp),%xmm9
	movaps	96(%rsp),%xmm10
	movaps	112(%rsp),%xmm11
	movaps	128(%rsp),%xmm12
	movaps	144(%rsp),%xmm13
	movaps	160(%rsp),%xmm14
	movaps	176(%rsp),%xmm15
	leaq	200(%rsp),%rsp

.Lctr32_ret:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_ctr32_encrypt_blocks:
.globl	aesni_xts_encrypt
.def	aesni_xts_encrypt;	.scl 2;	.type 32;	.endef
.p2align	4
aesni_xts_encrypt:
	movq	%rdi,8(%rsp)
	movq	%rsi,16(%rsp)
	movq	%rsp,%rax
.LSEH_begin_aesni_xts_encrypt:
	movq	%rcx,%rdi
	movq	%rdx,%rsi
	movq	%r8,%rdx
	movq	%r9,%rcx
	movq	40(%rsp),%r8
	movq	48(%rsp),%r9

	leaq	-264(%rsp),%rsp


	movaps	%xmm6,96(%rsp)
	movaps	%xmm7,112(%rsp)
	movaps	%xmm8,128(%rsp)
	movaps	%xmm9,144(%rsp)
	movaps	%xmm10,160(%rsp)
	movaps	%xmm11,176(%rsp)
	movaps	%xmm12,192(%rsp)
	movaps	%xmm13,208(%rsp)
	movaps	%xmm14,224(%rsp)
	movaps	%xmm15,240(%rsp)
.Lxts_enc_body:

	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15







|
>




















|
>
>











>







1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
	movaps	80(%rsp),%xmm9
	movaps	96(%rsp),%xmm10
	movaps	112(%rsp),%xmm11
	movaps	128(%rsp),%xmm12
	movaps	144(%rsp),%xmm13
	movaps	160(%rsp),%xmm14
	movaps	176(%rsp),%xmm15
	leaq	(%rbp),%rsp
	popq	%rbp
.Lctr32_ret:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_ctr32_encrypt_blocks:
.globl	aesni_xts_encrypt
.def	aesni_xts_encrypt;	.scl 2;	.type 32;	.endef
.p2align	4
aesni_xts_encrypt:
	movq	%rdi,8(%rsp)
	movq	%rsi,16(%rsp)
	movq	%rsp,%rax
.LSEH_begin_aesni_xts_encrypt:
	movq	%rcx,%rdi
	movq	%rdx,%rsi
	movq	%r8,%rdx
	movq	%r9,%rcx
	movq	40(%rsp),%r8
	movq	48(%rsp),%r9

	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$256,%rsp
	movaps	%xmm6,96(%rsp)
	movaps	%xmm7,112(%rsp)
	movaps	%xmm8,128(%rsp)
	movaps	%xmm9,144(%rsp)
	movaps	%xmm10,160(%rsp)
	movaps	%xmm11,176(%rsp)
	movaps	%xmm12,192(%rsp)
	movaps	%xmm13,208(%rsp)
	movaps	%xmm14,224(%rsp)
	movaps	%xmm15,240(%rsp)
.Lxts_enc_body:
	leaq	-8(%rax),%rbp
	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15
1649
1650
1651
1652
1653
1654
1655
1656

1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677


1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688

1689
1690
1691
1692
1693
1694
1695
	movaps	144(%rsp),%xmm9
	movaps	160(%rsp),%xmm10
	movaps	176(%rsp),%xmm11
	movaps	192(%rsp),%xmm12
	movaps	208(%rsp),%xmm13
	movaps	224(%rsp),%xmm14
	movaps	240(%rsp),%xmm15
	leaq	264(%rsp),%rsp

.Lxts_enc_epilogue:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_xts_encrypt:
.globl	aesni_xts_decrypt
.def	aesni_xts_decrypt;	.scl 2;	.type 32;	.endef
.p2align	4
aesni_xts_decrypt:
	movq	%rdi,8(%rsp)
	movq	%rsi,16(%rsp)
	movq	%rsp,%rax
.LSEH_begin_aesni_xts_decrypt:
	movq	%rcx,%rdi
	movq	%rdx,%rsi
	movq	%r8,%rdx
	movq	%r9,%rcx
	movq	40(%rsp),%r8
	movq	48(%rsp),%r9

	leaq	-264(%rsp),%rsp


	movaps	%xmm6,96(%rsp)
	movaps	%xmm7,112(%rsp)
	movaps	%xmm8,128(%rsp)
	movaps	%xmm9,144(%rsp)
	movaps	%xmm10,160(%rsp)
	movaps	%xmm11,176(%rsp)
	movaps	%xmm12,192(%rsp)
	movaps	%xmm13,208(%rsp)
	movaps	%xmm14,224(%rsp)
	movaps	%xmm15,240(%rsp)
.Lxts_dec_body:

	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15







|
>




















|
>
>











>







1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
	movaps	144(%rsp),%xmm9
	movaps	160(%rsp),%xmm10
	movaps	176(%rsp),%xmm11
	movaps	192(%rsp),%xmm12
	movaps	208(%rsp),%xmm13
	movaps	224(%rsp),%xmm14
	movaps	240(%rsp),%xmm15
	leaq	(%rbp),%rsp
	popq	%rbp
.Lxts_enc_epilogue:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_xts_encrypt:
.globl	aesni_xts_decrypt
.def	aesni_xts_decrypt;	.scl 2;	.type 32;	.endef
.p2align	4
aesni_xts_decrypt:
	movq	%rdi,8(%rsp)
	movq	%rsi,16(%rsp)
	movq	%rsp,%rax
.LSEH_begin_aesni_xts_decrypt:
	movq	%rcx,%rdi
	movq	%rdx,%rsi
	movq	%r8,%rdx
	movq	%r9,%rcx
	movq	40(%rsp),%r8
	movq	48(%rsp),%r9

	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$256,%rsp
	movaps	%xmm6,96(%rsp)
	movaps	%xmm7,112(%rsp)
	movaps	%xmm8,128(%rsp)
	movaps	%xmm9,144(%rsp)
	movaps	%xmm10,160(%rsp)
	movaps	%xmm11,176(%rsp)
	movaps	%xmm12,192(%rsp)
	movaps	%xmm13,208(%rsp)
	movaps	%xmm14,224(%rsp)
	movaps	%xmm15,240(%rsp)
.Lxts_dec_body:
	leaq	-8(%rax),%rbp
	movups	(%r9),%xmm15
	movl	240(%r8),%eax
	movl	240(%rcx),%r10d
	movups	(%r8),%xmm0
	movups	16(%r8),%xmm1
	leaq	32(%r8),%r8
	xorps	%xmm0,%xmm15
2123
2124
2125
2126
2127
2128
2129
2130

2131
2132
2133
2134
2135
2136
2137
	movaps	144(%rsp),%xmm9
	movaps	160(%rsp),%xmm10
	movaps	176(%rsp),%xmm11
	movaps	192(%rsp),%xmm12
	movaps	208(%rsp),%xmm13
	movaps	224(%rsp),%xmm14
	movaps	240(%rsp),%xmm15
	leaq	264(%rsp),%rsp

.Lxts_dec_epilogue:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_xts_decrypt:
.globl	aesni_cbc_encrypt
.def	aesni_cbc_encrypt;	.scl 2;	.type 32;	.endef







|
>







2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
	movaps	144(%rsp),%xmm9
	movaps	160(%rsp),%xmm10
	movaps	176(%rsp),%xmm11
	movaps	192(%rsp),%xmm12
	movaps	208(%rsp),%xmm13
	movaps	224(%rsp),%xmm14
	movaps	240(%rsp),%xmm15
	leaq	(%rbp),%rsp
	popq	%rbp
.Lxts_dec_epilogue:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_xts_decrypt:
.globl	aesni_cbc_encrypt
.def	aesni_cbc_encrypt;	.scl 2;	.type 32;	.endef
2203
2204
2205
2206
2207
2208
2209
2210


2211
2212
2213
2214
2215

2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
	movq	%rdi,%rsi
	movq	%r11,%rcx
	xorq	%rdx,%rdx
	jmp	.Lcbc_enc_loop	

.p2align	4
.Lcbc_decrypt:
	leaq	-88(%rsp),%rsp


	movaps	%xmm6,(%rsp)
	movaps	%xmm7,16(%rsp)
	movaps	%xmm8,32(%rsp)
	movaps	%xmm9,48(%rsp)
.Lcbc_decrypt_body:

	movups	(%r8),%xmm9
	movl	%r10d,%eax
	cmpq	$112,%rdx
	jbe	.Lcbc_dec_tail
	shrl	$1,%r10d
	subq	$112,%rdx
	movl	%r10d,%eax
	movaps	%xmm9,64(%rsp)
	jmp	.Lcbc_dec_loop8_enter
.p2align	4
.Lcbc_dec_loop8:
	movaps	%xmm0,64(%rsp)
	movups	%xmm9,(%rsi)
	leaq	16(%rsi),%rsi
.Lcbc_dec_loop8_enter:
	movups	(%rcx),%xmm0
	movups	(%rdi),%xmm2
	movups	16(%rdi),%xmm3
	movups	16(%rcx),%xmm1







|
>
>
|
|
|
|

>







|



|







2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
	movq	%rdi,%rsi
	movq	%r11,%rcx
	xorq	%rdx,%rdx
	jmp	.Lcbc_enc_loop	

.p2align	4
.Lcbc_decrypt:
	leaq	(%rsp),%rax
	pushq	%rbp
	subq	$80,%rsp
	movaps	%xmm6,16(%rsp)
	movaps	%xmm7,32(%rsp)
	movaps	%xmm8,48(%rsp)
	movaps	%xmm9,64(%rsp)
.Lcbc_decrypt_body:
	leaq	-8(%rax),%rbp
	movups	(%r8),%xmm9
	movl	%r10d,%eax
	cmpq	$112,%rdx
	jbe	.Lcbc_dec_tail
	shrl	$1,%r10d
	subq	$112,%rdx
	movl	%r10d,%eax
	movaps	%xmm9,(%rsp)
	jmp	.Lcbc_dec_loop8_enter
.p2align	4
.Lcbc_dec_loop8:
	movaps	%xmm0,(%rsp)
	movups	%xmm9,(%rsi)
	leaq	16(%rsi),%rsi
.Lcbc_dec_loop8_enter:
	movups	(%rcx),%xmm0
	movups	(%rdi),%xmm2
	movups	16(%rdi),%xmm3
	movups	16(%rcx),%xmm1
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
	aesdec	%xmm1,%xmm9
	movups	16(%rcx),%xmm1

	call	.Ldec_loop8_enter

	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	64(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6







|







2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
	aesdec	%xmm1,%xmm9
	movups	16(%rcx),%xmm1

	call	.Ldec_loop8_enter

	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
	jbe	.Lcbc_dec_five

	movups	80(%rdi),%xmm7
	cmpq	$96,%rdx
	jbe	.Lcbc_dec_six

	movups	96(%rdi),%xmm8
	movaps	%xmm9,64(%rsp)
	call	_aesni_decrypt8
	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	64(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6







|



|







2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
	jbe	.Lcbc_dec_five

	movups	80(%rdi),%xmm7
	cmpq	$96,%rdx
	jbe	.Lcbc_dec_six

	movups	96(%rdi),%xmm8
	movaps	%xmm9,(%rsp)
	call	_aesni_decrypt8
	movups	(%rdi),%xmm1
	movups	16(%rdi),%xmm0
	xorps	(%rsp),%xmm2
	xorps	%xmm1,%xmm3
	movups	32(%rdi),%xmm1
	xorps	%xmm0,%xmm4
	movups	48(%rdi),%xmm0
	xorps	%xmm1,%xmm5
	movups	64(%rdi),%xmm1
	xorps	%xmm0,%xmm6
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479


2480
2481
2482
2483
2484
2485
2486
	andq	$15,%rdx
	movups	%xmm9,(%r8)
	jnz	.Lcbc_dec_tail_partial
	movups	%xmm2,(%rsi)
	jmp	.Lcbc_dec_ret
.p2align	4
.Lcbc_dec_tail_partial:
	movaps	%xmm2,64(%rsp)
	movq	$16,%rcx
	movq	%rsi,%rdi
	subq	%rdx,%rcx
	leaq	64(%rsp),%rsi
.long	0x9066A4F3	

.Lcbc_dec_ret:
	movaps	(%rsp),%xmm6
	movaps	16(%rsp),%xmm7
	movaps	32(%rsp),%xmm8
	movaps	48(%rsp),%xmm9
	leaq	88(%rsp),%rsp


.Lcbc_ret:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_cbc_encrypt:
.globl	aesni_set_decrypt_key
.def	aesni_set_decrypt_key;	.scl 2;	.type 32;	.endef







|



|



<
|
|
|
|
>
>







2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489

2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
	andq	$15,%rdx
	movups	%xmm9,(%r8)
	jnz	.Lcbc_dec_tail_partial
	movups	%xmm2,(%rsi)
	jmp	.Lcbc_dec_ret
.p2align	4
.Lcbc_dec_tail_partial:
	movaps	%xmm2,(%rsp)
	movq	$16,%rcx
	movq	%rsi,%rdi
	subq	%rdx,%rcx
	leaq	(%rsp),%rsi
.long	0x9066A4F3	

.Lcbc_dec_ret:

	movaps	16(%rsp),%xmm6
	movaps	32(%rsp),%xmm7
	movaps	48(%rsp),%xmm8
	movaps	64(%rsp),%xmm9
	leaq	(%rbp),%rsp
	popq	%rbp
.Lcbc_ret:
	movq	8(%rsp),%rdi
	movq	16(%rsp),%rsi
	retq
.LSEH_end_aesni_cbc_encrypt:
.globl	aesni_set_decrypt_key
.def	aesni_set_decrypt_key;	.scl 2;	.type 32;	.endef
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
	cmpq	%r10,%rbx
	jae	.Lcommon_seh_tail

	leaq	32(%rax),%rsi
	leaq	512(%r8),%rdi
	movl	$20,%ecx
.long	0xa548f3fc		
	leaq	200(%rax),%rax

	jmp	.Lcommon_seh_tail


.def	xts_se_handler;	.scl 3;	.type 32;	.endef
.p2align	4
xts_se_handler:
	pushq	%rsi
	pushq	%rdi







<

|







2828
2829
2830
2831
2832
2833
2834

2835
2836
2837
2838
2839
2840
2841
2842
2843
	cmpq	%r10,%rbx
	jae	.Lcommon_seh_tail

	leaq	32(%rax),%rsi
	leaq	512(%r8),%rdi
	movl	$20,%ecx
.long	0xa548f3fc		


	jmp	.Lcommon_rbp_tail


.def	xts_se_handler;	.scl 3;	.type 32;	.endef
.p2align	4
xts_se_handler:
	pushq	%rsi
	pushq	%rdi
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
	cmpq	%r10,%rbx
	jae	.Lcommon_seh_tail

	leaq	96(%rax),%rsi
	leaq	512(%r8),%rdi
	movl	$20,%ecx
.long	0xa548f3fc		
	leaq	104+160(%rax),%rax

	jmp	.Lcommon_seh_tail

.def	cbc_se_handler;	.scl 3;	.type 32;	.endef
.p2align	4
cbc_se_handler:
	pushq	%rsi
	pushq	%rdi
	pushq	%rbx







<

|







2868
2869
2870
2871
2872
2873
2874

2875
2876
2877
2878
2879
2880
2881
2882
2883
	cmpq	%r10,%rbx
	jae	.Lcommon_seh_tail

	leaq	96(%rax),%rsi
	leaq	512(%r8),%rdi
	movl	$20,%ecx
.long	0xa548f3fc		


	jmp	.Lcommon_rbp_tail

.def	cbc_se_handler;	.scl 3;	.type 32;	.endef
.p2align	4
cbc_se_handler:
	pushq	%rsi
	pushq	%rdi
	pushq	%rbx
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896




2897

2898
2899
2900
2901
2902
2903
2904
	cmpq	%r10,%rbx
	jb	.Lrestore_cbc_rax

	leaq	.Lcbc_ret(%rip),%r10
	cmpq	%r10,%rbx
	jae	.Lcommon_seh_tail

	leaq	0(%rax),%rsi
	leaq	512(%r8),%rdi
	movl	$8,%ecx
.long	0xa548f3fc		




	leaq	88(%rax),%rax

	jmp	.Lcommon_seh_tail

.Lrestore_cbc_rax:
	movq	120(%r8),%rax

.Lcommon_seh_tail:
	movq	8(%rax),%rdi







|



>
>
>
>
|
>







2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
	cmpq	%r10,%rbx
	jb	.Lrestore_cbc_rax

	leaq	.Lcbc_ret(%rip),%r10
	cmpq	%r10,%rbx
	jae	.Lcommon_seh_tail

	leaq	16(%rax),%rsi
	leaq	512(%r8),%rdi
	movl	$8,%ecx
.long	0xa548f3fc		

.Lcommon_rbp_tail:
	movq	160(%r8),%rax
	movq	(%rax),%rbp
	leaq	8(%rax),%rax
	movq	%rbp,160(%r8)
	jmp	.Lcommon_seh_tail

.Lrestore_cbc_rax:
	movq	120(%r8),%rax

.Lcommon_seh_tail:
	movq	8(%rax),%rdi
Changes to jni/libressl/crypto/asn1/a_bitstr.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: a_bitstr.c,v 1.33 2021/12/25 08:52:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: a_bitstr.c,v 1.36 2022/05/17 09:17:20 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84



















85
86
87
88
89
90
91
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */


#include <stdio.h>
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>



const ASN1_ITEM ASN1_BIT_STRING_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,
	.utype = V_ASN1_BIT_STRING,
	.sname = "ASN1_BIT_STRING",
};

ASN1_BIT_STRING *
ASN1_BIT_STRING_new(void)
{
	return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it);
}

void
ASN1_BIT_STRING_free(ASN1_BIT_STRING *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it);
}




















int
ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{
	return ASN1_STRING_set(x, d, len);
}








>








>
>


















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>

#include "bytestring.h"

const ASN1_ITEM ASN1_BIT_STRING_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,
	.utype = V_ASN1_BIT_STRING,
	.sname = "ASN1_BIT_STRING",
};

ASN1_BIT_STRING *
ASN1_BIT_STRING_new(void)
{
	return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it);
}

void
ASN1_BIT_STRING_free(ASN1_BIT_STRING *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it);
}

static void
asn1_abs_clear_unused_bits(ASN1_BIT_STRING *abs)
{
	abs->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
}

int
asn1_abs_set_unused_bits(ASN1_BIT_STRING *abs, uint8_t unused_bits)
{
	if (unused_bits > 7)
		return 0;

	asn1_abs_clear_unused_bits(abs);

	abs->flags |= ASN1_STRING_FLAG_BITS_LEFT | unused_bits;

	return 1;
}

int
ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{
	return ASN1_STRING_set(x, d, len);
}

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
	iv = ~v;
	if (!value)
		v = 0;

	if (a == NULL)
		return 0;

	a->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); /* clear, set on write */

	if ((a->length < (w + 1)) || (a->data == NULL)) {
		if (!value)
			return(1); /* Don't need to set */
		if ((c = recallocarray(a->data, a->length, w + 1, 1)) == NULL) {
			ASN1error(ERR_R_MALLOC_FAILURE);
			return 0;







|







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
	iv = ~v;
	if (!value)
		v = 0;

	if (a == NULL)
		return 0;

	asn1_abs_clear_unused_bits(a);

	if ((a->length < (w + 1)) || (a->data == NULL)) {
		if (!value)
			return(1); /* Don't need to set */
		if ((c = recallocarray(a->data, a->length, w + 1, 1)) == NULL) {
			ASN1error(ERR_R_MALLOC_FAILURE);
			return 0;
265
266
267
268
269
270
271

272
273
274
275


276

277


278



279
280

281
282
283
284
285

286
287
288
289
290
291
292
293
294
295
296



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329


330










331

332
















333
334
335
336
337
338
339
340
		p += len;
		p[-1] &= 0xff << bits;
	}
	*pp = p;
	return (ret);
}


ASN1_BIT_STRING *
c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len)
{
	ASN1_BIT_STRING *ret = NULL;


	const unsigned char *p;

	unsigned char *s;


	int i;




	if (len < 1) {

		ASN1error(ASN1_R_STRING_TOO_SHORT);
		goto err;
	}

	if (a == NULL || *a == NULL) {

		if ((ret = ASN1_BIT_STRING_new()) == NULL)
			return (NULL);
	} else
		ret = *a;

	p = *pp;
	i = *(p++);
	if (i > 7) {
		ASN1error(ASN1_R_INVALID_BIT_STRING_BITS_LEFT);
		goto err;
	}




	/*
	 * We do this to preserve the settings. If we modify the settings,
	 * via the _set_bit function, we will recalculate on output.
	 */
	ret->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); /* clear */
	ret->flags |= (ASN1_STRING_FLAG_BITS_LEFT | i); /* set */

	/* using one because of the bits left byte */
	if (len-- > 1) {
		if ((s = malloc(len)) == NULL) {
			ASN1error(ERR_R_MALLOC_FAILURE);
			goto err;
		}
		memcpy(s, p, len);
		s[len - 1] &= (0xff << i);
		p += len;
	} else
		s = NULL;

	free(ret->data);
	ret->data = s;
	ret->length = (int)len;
	ret->type = V_ASN1_BIT_STRING;

	if (a != NULL)
		*a = ret;

	*pp = p;

	return (ret);

 err:


	if (a == NULL || *a != ret)










		ASN1_BIT_STRING_free(ret);


















	return (NULL);
}

int
i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it);
}







>
|
<

|
>
>
|
>
|
>
>
|
>
>
>
|
|
>




|
>
|
<
|
<

<
<
<
|

|
>
>
>





<
<
|
<
<
<
|
|
|
|
|
<
<
<

<
<
<
<
|
|
<

|
<
<


>
>
|
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







287
288
289
290
291
292
293
294
295

296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318

319

320



321
322
323
324
325
326
327
328
329
330
331


332



333
334
335
336
337



338




339
340

341
342


343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
		p += len;
		p[-1] &= 0xff << bits;
	}
	*pp = p;
	return (ret);
}

int
c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs)

{
	ASN1_BIT_STRING *abs = NULL;
	uint8_t *data = NULL;
	size_t data_len = 0;
	uint8_t unused_bits;
	int ret = 0;

	if (out_abs == NULL)
		goto err;

	if (*out_abs != NULL) {
		ASN1_BIT_STRING_free(*out_abs);
		*out_abs = NULL;
	}

	if (!CBS_get_u8(cbs, &unused_bits)) {
		ASN1error(ASN1_R_STRING_TOO_SHORT);
		goto err;
	}

	if (!CBS_stow(cbs, &data, &data_len))
		goto err;
	if (data_len > INT_MAX)

		goto err;





	if ((abs = ASN1_BIT_STRING_new()) == NULL)
		goto err;

	abs->data = data;
	abs->length = (int)data_len;
	data = NULL;

	/*
	 * We do this to preserve the settings. If we modify the settings,
	 * via the _set_bit function, we will recalculate on output.
	 */


	if (!asn1_abs_set_unused_bits(abs, unused_bits)) {



		ASN1error(ASN1_R_INVALID_BIT_STRING_BITS_LEFT);
		goto err;
	}
	if (abs->length > 0)
		abs->data[abs->length - 1] &= 0xff << unused_bits;








	*out_abs = abs;
	abs = NULL;


	ret = 1;



 err:
	ASN1_BIT_STRING_free(abs);
	freezero(data, data_len);

	return ret;
}

ASN1_BIT_STRING *
c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **out_abs, const unsigned char **pp, long len)
{
	ASN1_BIT_STRING *abs = NULL;
	CBS content;

	if (out_abs != NULL) {
		ASN1_BIT_STRING_free(*out_abs);
		*out_abs = NULL;
	}

	if (len < 0) {
		ASN1error(ASN1_R_LENGTH_ERROR);
		return NULL;
	}

	CBS_init(&content, *pp, len);

	if (!c2i_ASN1_BIT_STRING_cbs(&abs, &content))
		return NULL;

	*pp = CBS_data(&content);

	if (out_abs != NULL)
		*out_abs = abs;

	return abs;
}

int
i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it);
}
Changes to jni/libressl/crypto/asn1/a_enum.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: a_enum.c,v 1.23 2021/12/25 13:17:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: a_enum.c,v 1.27 2022/09/03 18:45:51 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83










84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

105
106
107
108

109
110
111

112
113
114
115
116


117
118

119
120
121


122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

155
156
157
158
159
160
161
162
163
164
165
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>
#include <openssl/err.h>




/*
 * Code for ENUMERATED type: identical to INTEGER apart from a different tag.
 * for comments on encoding see a_int.c
 */

const ASN1_ITEM ASN1_ENUMERATED_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,
	.utype = V_ASN1_ENUMERATED,
	.sname = "ASN1_ENUMERATED",
};

ASN1_ENUMERATED *
ASN1_ENUMERATED_new(void)
{
	return (ASN1_ENUMERATED *)ASN1_item_new(&ASN1_ENUMERATED_it);
}











void
ASN1_ENUMERATED_free(ASN1_ENUMERATED *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_ENUMERATED_it);
}

int
ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
{
	int j, k;
	unsigned int i;
	unsigned char buf[sizeof(long) + 1];
	long d;

	a->type = V_ASN1_ENUMERATED;
	if (a->length < (int)(sizeof(long) + 1)) {
		free(a->data);
		a->data = calloc(1, sizeof(long) + 1);
	}
	if (a->data == NULL) {

		ASN1error(ERR_R_MALLOC_FAILURE);
		return (0);
	}
	d = v;

	if (d < 0) {
		d = -d;
		a->type = V_ASN1_NEG_ENUMERATED;

	}

	for (i = 0; i < sizeof(long); i++) {
		if (d == 0)
			break;


		buf[i] = (int)d & 0xff;
		d >>= 8;

	}
	j = 0;
	for (k = i - 1; k >= 0; k--)


		a->data[j++] = buf[k];

	a->length = j;
	return (1);
}

long
ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a)
{
	int neg = 0, i;
	unsigned long r = 0;

	if (a == NULL)
		return (0L);
	i = a->type;
	if (i == V_ASN1_NEG_ENUMERATED)
		neg = 1;
	else if (i != V_ASN1_ENUMERATED)
		return -1;

	if (a->length > (int)sizeof(long)) {
		/* hmm... a bit ugly */
		return -1;
	}
	if (a->data == NULL)
		return 0;

	for (i = 0; i < a->length; i++) {
		r <<= 8;
		r |= (unsigned char)a->data[i];
	}

	if (r > LONG_MAX)
		return -1;


	if (neg)
		return -(long)r;
	return (long)r;
}

ASN1_ENUMERATED *
BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai)
{
	ASN1_ENUMERATED *ret;
	int len, j;







|







>
>
>
















>
>
>
>
>
>
>
>
>
>








|

|
|
<
|

<
|
|
<
|
|
>
|
|

|
>
|
<
|
>
|

<
|
<
>
>
|
|
>
|
|
|
>
>
|
>
|
|



|

|
<

|
|
<
<
<
|

|
<
|


|
|
|
<
<
<
|
|
<
<
>
|
<
|
<







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

109
110

111
112

113
114
115
116
117
118
119
120
121

122
123
124
125

126

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

147
148
149



150
151
152

153
154
155
156
157
158



159
160


161
162

163

164
165
166
167
168
169
170
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>
#include <openssl/err.h>

#include "asn1_locl.h"
#include "bytestring.h"

/*
 * Code for ENUMERATED type: identical to INTEGER apart from a different tag.
 * for comments on encoding see a_int.c
 */

const ASN1_ITEM ASN1_ENUMERATED_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,
	.utype = V_ASN1_ENUMERATED,
	.sname = "ASN1_ENUMERATED",
};

ASN1_ENUMERATED *
ASN1_ENUMERATED_new(void)
{
	return (ASN1_ENUMERATED *)ASN1_item_new(&ASN1_ENUMERATED_it);
}

static void
asn1_aenum_clear(ASN1_ENUMERATED *aenum)
{
	freezero(aenum->data, aenum->length);

	memset(aenum, 0, sizeof(*aenum));

	aenum->type = V_ASN1_ENUMERATED;
}

void
ASN1_ENUMERATED_free(ASN1_ENUMERATED *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_ENUMERATED_it);
}

int
ASN1_ENUMERATED_get_int64(int64_t *out_val, const ASN1_ENUMERATED *aenum)
{
	CBS cbs;


	*out_val = 0;


	if (aenum == NULL || aenum->length < 0)
		return 0;


	if (aenum->type != V_ASN1_ENUMERATED &&
	    aenum->type != V_ASN1_NEG_ENUMERATED) {
		ASN1error(ASN1_R_WRONG_INTEGER_TYPE);
		return 0;
	}

	CBS_init(&cbs, aenum->data, aenum->length);


	return asn1_aint_get_int64(&cbs, (aenum->type == V_ASN1_NEG_ENUMERATED),
	    out_val);
}


int

ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *aenum, int64_t val)
{
	uint64_t uval;

	asn1_aenum_clear(aenum);

	uval = (uint64_t)val;

	if (val < 0) {
		aenum->type = V_ASN1_NEG_ENUMERATED;
		uval = -uval;
	}

	return asn1_aint_set_uint64(uval, &aenum->data, &aenum->length);
}

long
ASN1_ENUMERATED_get(const ASN1_ENUMERATED *aenum)
{
	int64_t val;


	if (aenum == NULL)
		return 0;



	if (!ASN1_ENUMERATED_get_int64(&val, aenum))
		return -1;
	if (val < LONG_MIN || val > LONG_MAX) {

		/* hmm... a bit ugly, return all ones */
		return -1;
	}

	return (long)val;
}




int


ASN1_ENUMERATED_set(ASN1_ENUMERATED *aenum, long val)
{

	return ASN1_ENUMERATED_set_int64(aenum, val);

}

ASN1_ENUMERATED *
BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai)
{
	ASN1_ENUMERATED *ret;
	int len, j;
335
336
337
338
339
340
341






















342
343
344
345
346
347
348
349
350
351
352
353
354

 err_sl:
	ASN1error(ASN1_R_SHORT_LINE);
 err:
	free(s);
	return (ret);
}























int
i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it);
}

ASN1_ENUMERATED *
d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len)
{
	return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
	    &ASN1_ENUMERATED_it);
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381

 err_sl:
	ASN1error(ASN1_R_SHORT_LINE);
 err:
	free(s);
	return (ret);
}

int
c2i_ASN1_ENUMERATED_cbs(ASN1_ENUMERATED **out_aenum, CBS *cbs)
{
	ASN1_ENUMERATED *aenum = NULL;

	if (out_aenum == NULL)
		return 0;

	if (*out_aenum != NULL) {
		ASN1_INTEGER_free(*out_aenum);
		*out_aenum = NULL;
	}

	if (!c2i_ASN1_INTEGER_cbs((ASN1_INTEGER **)&aenum, cbs))
		return 0;

	aenum->type = V_ASN1_ENUMERATED | (aenum->type & V_ASN1_NEG);
	*out_aenum = aenum;

	return 1;
}

int
i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it);
}

ASN1_ENUMERATED *
d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len)
{
	return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
	    &ASN1_ENUMERATED_it);
}
Changes to jni/libressl/crypto/asn1/a_int.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: a_int.c,v 1.38 2021/12/25 13:17:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: a_int.c,v 1.46 2022/08/28 17:49:25 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
61
62
63
64
65
66
67


68
69
70
71
72
73
74
75
76
77
78
79










80
81
82
83
84
85
86
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>
#include <openssl/err.h>



const ASN1_ITEM ASN1_INTEGER_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,
	.utype = V_ASN1_INTEGER,
	.sname = "ASN1_INTEGER",
};

ASN1_INTEGER *
ASN1_INTEGER_new(void)
{
	return (ASN1_INTEGER *)ASN1_item_new(&ASN1_INTEGER_it);
}











void
ASN1_INTEGER_free(ASN1_INTEGER *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it);
}








>
>












>
>
>
>
>
>
>
>
>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>
#include <openssl/err.h>

#include "bytestring.h"

const ASN1_ITEM ASN1_INTEGER_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,
	.utype = V_ASN1_INTEGER,
	.sname = "ASN1_INTEGER",
};

ASN1_INTEGER *
ASN1_INTEGER_new(void)
{
	return (ASN1_INTEGER *)ASN1_item_new(&ASN1_INTEGER_it);
}

static void
asn1_aint_clear(ASN1_INTEGER *aint)
{
	freezero(aint->data, aint->length);

	memset(aint, 0, sizeof(*aint));

	aint->type = V_ASN1_INTEGER;
}

void
ASN1_INTEGER_free(ASN1_INTEGER *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it);
}

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119






















































































120


121

































































122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204
205
206
207
208
	if (!ASN1_INTEGER_valid(x))
		return NULL;

	return ASN1_STRING_dup(x);
}

int
ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y)
{
	int neg, ret;

	/* Compare signs */
	neg = x->type & V_ASN1_NEG;
	if (neg != (y->type & V_ASN1_NEG)) {
		if (neg)
			return -1;
		else
			return 1;
	}

	ret = ASN1_STRING_cmp(x, y);

	if (neg)
		return -ret;






















































































	else


		return ret;

































































}

int
ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
{
	int j, k;
	unsigned int i;
	unsigned char buf[sizeof(long) + 1];
	long d;

	a->type = V_ASN1_INTEGER;
	/* XXX ssl/ssl_asn1.c:i2d_SSL_SESSION() depends upon this bound vae */
	if (a->length < (int)(sizeof(long) + 1)) {
		free(a->data);
		a->data = calloc(1, sizeof(long) + 1);
	}
	if (a->data == NULL) {
		ASN1error(ERR_R_MALLOC_FAILURE);
		return (0);
	}
	d = v;
	if (d < 0) {
		d = -d;
		a->type = V_ASN1_NEG_INTEGER;

	}

	for (i = 0; i < sizeof(long); i++) {
		if (d == 0)
			break;
		buf[i] = (int)d & 0xff;
		d >>= 8;
	}
	j = 0;
	for (k = i - 1; k >= 0; k--)
		a->data[j++] = buf[k];
	a->length = j;
	return (1);
}

/*
 * XXX this particular API is a gibbering eidrich horror that makes it
 * impossible to determine valid return cases from errors.. "a bit
 * ugly" is preserved for posterity, unfortunately this is probably
 * unfixable without changing public API
 */
long
ASN1_INTEGER_get(const ASN1_INTEGER *a)
{
	int neg = 0, i;
	unsigned long r = 0;

	if (a == NULL)
		return (0L);
	i = a->type;
	if (i == V_ASN1_NEG_INTEGER)
		neg = 1;
	else if (i != V_ASN1_INTEGER)
		return -1;

	if (!ASN1_INTEGER_valid(a))
		return -1; /* XXX best effort */

	if (a->length > (int)sizeof(long)) {
		/* hmm... a bit ugly, return all ones */
		return -1;
	}
	if (a->data == NULL)
		return 0;

	for (i = 0; i < a->length; i++) {
		r <<= 8;
		r |= (unsigned char)a->data[i];
	}

	if (r > LONG_MAX)
		return -1;


	if (neg)
		return -(long)r;
	return (long)r;
}

ASN1_INTEGER *
BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
{
	ASN1_INTEGER *ret;
	int len, j;







|

|

|
|
<
<
<
<
<
<
<
|

|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



|

|
<
<
<

<
<
|
<
<
|
<
<
|
|
<
|
<
|
>


<
<
<
<
<
<
<
<
<
<
|


<
<
<
<
<
<

|

|
<

|
|
<
<
<
<
<
<
|
|
|
<



|
|
|
<
<
<
|
|
<
<
>
|
<
|
<







108
109
110
111
112
113
114
115
116
117
118
119
120







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285



286


287


288


289
290

291

292
293
294
295










296
297
298






299
300
301
302

303
304
305






306
307
308

309
310
311
312
313
314



315
316


317
318

319

320
321
322
323
324
325
326
	if (!ASN1_INTEGER_valid(x))
		return NULL;

	return ASN1_STRING_dup(x);
}

int
ASN1_INTEGER_cmp(const ASN1_INTEGER *a, const ASN1_INTEGER *b)
{
	int ret = 1;

	/* Compare sign, then content. */
	if ((a->type & V_ASN1_NEG) == (b->type & V_ASN1_NEG))







		ret = ASN1_STRING_cmp(a, b);

	if ((a->type & V_ASN1_NEG) != 0)
		return -ret;

	return ret;
}

int
asn1_aint_get_uint64(CBS *cbs, uint64_t *out_val)
{
	uint64_t val = 0;
	uint8_t u8;

	*out_val = 0;

	while (CBS_len(cbs) > 0) {
		if (!CBS_get_u8(cbs, &u8))
			return 0;
		if (val > (UINT64_MAX >> 8)) {
			ASN1error(ASN1_R_TOO_LARGE);
			return 0;
		}
		val = val << 8 | u8;
	}

	*out_val = val;

	return 1;
}

int
asn1_aint_set_uint64(uint64_t val, uint8_t **out_data, int *out_len)
{
	uint8_t *data = NULL;
	size_t data_len = 0;
	int started = 0;
	uint8_t u8;
	CBB cbb;
	int i;
	int ret = 0;

	if (!CBB_init(&cbb, sizeof(long)))
		goto err;

	if (out_data == NULL || out_len == NULL)
		goto err;
	if (*out_data != NULL || *out_len != 0)
		goto err;

	for (i = sizeof(uint64_t) - 1; i >= 0; i--) {
		u8 = (val >> (i * 8)) & 0xff;
		if (!started && i != 0 && u8 == 0)
			continue;
		if (!CBB_add_u8(&cbb, u8))
			goto err;
		started = 1;
	}

	if (!CBB_finish(&cbb, &data, &data_len))
		goto err;
	if (data_len > INT_MAX)
		goto err;

	*out_data = data;
	*out_len = (int)data_len;
	data = NULL;

	ret = 1;
 err:
	CBB_cleanup(&cbb);
	freezero(data, data_len);

	return ret;
}

int
asn1_aint_get_int64(CBS *cbs, int negative, int64_t *out_val)
{
	uint64_t val;

	if (!asn1_aint_get_uint64(cbs, &val))
		return 0;

	if (negative) {
		if (val > (uint64_t)INT64_MIN) {
			ASN1error(ASN1_R_TOO_SMALL);
			return 0;
		}
		*out_val = (int64_t)-val;
	} else {
		if (val > (uint64_t)INT64_MAX) {
			ASN1error(ASN1_R_TOO_LARGE);
			return 0;
		}
		*out_val = (int64_t)val;
	}

	return 1;
}

int
ASN1_INTEGER_get_uint64(uint64_t *out_val, const ASN1_INTEGER *aint)
{
	uint64_t val;
	CBS cbs;

	*out_val = 0;

	if (aint == NULL || aint->length < 0)
		return 0;

	if (aint->type == V_ASN1_NEG_INTEGER) {
		ASN1error(ASN1_R_ILLEGAL_NEGATIVE_VALUE);
		return 0;
	}
	if (aint->type != V_ASN1_INTEGER) {
		ASN1error(ASN1_R_WRONG_INTEGER_TYPE);
		return 0;
	}

	CBS_init(&cbs, aint->data, aint->length);

	if (!asn1_aint_get_uint64(&cbs, &val))
		return 0;

	*out_val = val;

	return 1;
}

int
ASN1_INTEGER_set_uint64(ASN1_INTEGER *aint, uint64_t val)
{
	asn1_aint_clear(aint);

	return asn1_aint_set_uint64(val, &aint->data, &aint->length);
}

int
ASN1_INTEGER_get_int64(int64_t *out_val, const ASN1_INTEGER *aint)
{
	CBS cbs;

	*out_val = 0;

	if (aint == NULL || aint->length < 0)
		return 0;

	if (aint->type != V_ASN1_INTEGER &&
	    aint->type != V_ASN1_NEG_INTEGER) {
		ASN1error(ASN1_R_WRONG_INTEGER_TYPE);
		return 0;
	}

	CBS_init(&cbs, aint->data, aint->length);

	return asn1_aint_get_int64(&cbs, (aint->type == V_ASN1_NEG_INTEGER),
	    out_val);
}

int
ASN1_INTEGER_set_int64(ASN1_INTEGER *aint, int64_t val)
{
	uint64_t uval;






	asn1_aint_clear(aint);





	uval = (uint64_t)val;


	if (val < 0) {

		aint->type = V_ASN1_NEG_INTEGER;
		uval = -uval;
	}











	return asn1_aint_set_uint64(uval, &aint->data, &aint->length);
}







long
ASN1_INTEGER_get(const ASN1_INTEGER *aint)
{
	int64_t val;


	if (aint == NULL)
		return 0;






	if (!ASN1_INTEGER_get_int64(&val, aint))
		return -1;
	if (val < LONG_MIN || val > LONG_MAX) {

		/* hmm... a bit ugly, return all ones */
		return -1;
	}

	return (long)val;
}




int


ASN1_INTEGER_set(ASN1_INTEGER *aint, long val)
{

	return ASN1_INTEGER_set_int64(aint, val);

}

ASN1_INTEGER *
BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
{
	ASN1_INTEGER *ret;
	int len, j;
388
389
390
391
392
393
394
395
396
397


398
399
400
401
402




403
404
405
406
407
408
409
410

411
412
413

414
415
416
417
418





419
420
421
422

423
424
425

426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449


450
451

452








453
454
455

456
457
458

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478

479
480







481

482
483


484
485
486
487




488
489


490


491
492





493
494
495
496

497


498
499
500
501
502
503

504
505
506
507
508
509
510
511
512
513
514
515

516
517

518
519



520

521
522
523
524



525



526
527

528
529



530
531



532
533




534



535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552

553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570






571
572
573
574
575
576
577
578


579
580
581
582


583


584







585





586













587
588
589
590
591
592
593
 err_sl:
	ASN1error(ASN1_R_SHORT_LINE);
 err:
	free(s);
	return (ret);
}

/*
 * This converts an ASN1 INTEGER into its content encoding.
 * The internal representation is an ASN1_STRING whose data is a big endian


 * representation of the value, ignoring the sign. The sign is determined by
 * the type: V_ASN1_INTEGER for positive and V_ASN1_NEG_INTEGER for negative.
 *
 * Positive integers are no problem: they are almost the same as the DER
 * encoding, except if the first byte is >= 0x80 we need to add a zero pad.




 *
 * Negative integers are a bit trickier...
 * The DER representation of negative integers is in 2s complement form.
 * The internal form is converted by complementing each octet and finally
 * adding one to the result. This can be done less messily with a little trick.
 * If the internal form has trailing zeroes then they will become FF by the
 * complement and 0 by the add one (due to carry) so just copy as many trailing
 * zeros to the destination as there are in the source. The carry will add one

 * to the last none zero octet: so complement this octet and add one and finally
 * complement any left over until you get to the start of the string.
 *

 * Padding is a little trickier too. If the first bytes is > 0x80 then we pad
 * with 0xff. However if the first byte is 0x80 and one of the following bytes
 * is non-zero we pad with 0xff. The reason for this distinction is that 0x80
 * followed by optional zeros isn't padded.
 */






int
i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
{

	int pad = 0, ret, i, neg;
	unsigned char *p, *n, pb = 0;


	if (!ASN1_INTEGER_valid(a))
		return 0;

	neg = a->type & V_ASN1_NEG;
	if (a->length == 0)
		ret = 1;
	else {
		ret = a->length;
		i = a->data[0];
		if (!neg && (i > 127)) {
			pad = 1;
			pb = 0;
		} else if (neg) {
			if (i > 128) {
				pad = 1;
				pb = 0xFF;
			} else if (i == 128) {
				/*
				 * Special case: if any other bytes non zero we pad:
				 * otherwise we don't.
				 */
				for (i = 1; i < a->length; i++) if (a->data[i]) {
					pad = 1;
					pb = 0xFF;


					break;
				}

			}








		}
		ret += pad;
	}

	if (pp == NULL)
		return (ret);
	p= *pp;


	if (pad)
		*(p++) = pb;
	if (a->length == 0)
		*(p++) = 0;
	else if (!neg)
		memcpy(p, a->data, a->length);
	else {
		/* Begin at the end of the encoding */
		n = a->data + a->length - 1;
		p += a->length - 1;
		i = a->length;
		/* Copy zeros to destination as long as source is zero */
		while (!*n) {
			*(p--) = 0;
			n--;
			i--;
		}
		/* Complement and increment next octet */
		*(p--) = ((*(n--)) ^ 0xff) + 1;

		i--;
		/* Complement any octets left */







		for (; i > 0; i--)

			*(p--) = *(n--) ^ 0xff;
	}



	*pp += ret;
	return (ret);
}





/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */





ASN1_INTEGER *
c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long len)





{
	ASN1_INTEGER *ret = NULL;
	const unsigned char *p, *pend;
	unsigned char *to, *s;

	int i;



	if ((a == NULL) || ((*a) == NULL)) {
		if ((ret = ASN1_INTEGER_new()) == NULL)
			return (NULL);
	} else
		ret = (*a);


	if (!ASN1_INTEGER_valid(ret)) {
		/*
		 * XXX using i for an alert is confusing,
		 * we should call this al
		 */
		i = ERR_R_ASN1_LENGTH_MISMATCH;
		goto err;
	}

	p = *pp;
	pend = p + len;


	/* We must malloc stuff, even for 0 bytes otherwise it

	 * signifies a missing NULL parameter. */
	if (len < 0 || len > INT_MAX) {



		i = ERR_R_ASN1_LENGTH_MISMATCH;

		goto err;
	}
	s = malloc(len + 1);
	if (s == NULL) {



		i = ERR_R_MALLOC_FAILURE;



		goto err;
	}

	to = s;
	if (!len) {



		/* Strictly speaking this is an illegal INTEGER but we
		 * tolerate it.



		 */
		ret->type = V_ASN1_INTEGER;




	} else if (*p & 0x80) /* a negative number */ {



		ret->type = V_ASN1_NEG_INTEGER;
		if ((*p == 0xff) && (len != 1)) {
			p++;
			len--;
		}
		i = len;
		p += i - 1;
		to += i - 1;
		while((!*p) && i) {
			*(to--) = 0;
			i--;
			p--;
		}
		/* Special case: if all zeros then the number will be of
		 * the form FF followed by n zero bytes: this corresponds to
		 * 1 followed by n zero bytes. We've already written n zeros
		 * so we just append an extra one and set the first byte to
		 * a 1. This is treated separately because it is the only case

		 * where the number of bytes is larger than len.
		 */
		if (!i) {
			*s = 1;
			s[len] = 0;
			len++;
		} else {
			*(to--) = (*(p--) ^ 0xff) + 1;
			i--;
			for (; i > 0; i--)
				*(to--) = *(p--) ^ 0xff;
		}
	} else {
		ret->type = V_ASN1_INTEGER;
		if ((*p == 0) && (len != 1)) {
			p++;
			len--;
		}






		memcpy(s, p, len);
	}

	free(ret->data);
	ret->data = s;
	ret->length = (int)len;
	if (a != NULL)
		(*a) = ret;


	*pp = pend;
	return (ret);

 err:


	ASN1error(i);


	if (a == NULL || *a != ret)







		ASN1_INTEGER_free(ret);





	return (NULL);













}

int
i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_INTEGER_it);
}







<
<
|
>
>
|
|
|
|
|
>
>
>
>
|
|
<
<
<
<
|
<
>
|
<
|
>
|
|
|
|
|
>
>
>
>
>
|
|
<
<
>
<
<

>
|
<
|
|
|
|
<
|
<
<
|
|
|
|
<
<
|
<
<
<
<
|
|
|
>
>
|
|
>
|
>
>
>
>
>
>
>
>
|
<
|
>
|
|
|
>
|
|
<
<
<
|
<
|
|
<
<
<
<
<
|
<
|
|
|
|
>
|
|
>
>
>
>
>
>
>
|
>
|
|
>
>

<
|

>
>
>
>
|
|
>
>

>
>
|
<
>
>
>
>
>
|
|
<
<
>
|
>
>
|
|
|
|
|
|
>

|
<
<
<
<
<
<
|

<
|
>
|
<
>
|
|
>
>
>
|
>

|
<
|
>
>
>
|
>
>
>


>
|
|
>
>
>
|
<
>
>
>
|
<
>
>
>
>
|
>
>
>
|
<
<
|
|
<
<
<
<
<
<
<

<
<
<
<
<
>
|
<
|
|
<
|
|
<
<
<
<
|
<
|
<
<
|
|
>
>
>
>
>
>
|


<
|
|
|
|
>
>
|
|


>
>
|
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>







506
507
508
509
510
511
512


513
514
515
516
517
518
519
520
521
522
523
524
525
526




527

528
529

530
531
532
533
534
535
536
537
538
539
540
541
542
543


544


545
546
547

548
549
550
551

552


553
554
555
556


557




558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575

576
577
578
579
580
581
582
583



584

585
586





587

588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608

609
610
611
612
613
614
615
616
617
618
619
620
621
622

623
624
625
626
627
628
629


630
631
632
633
634
635
636
637
638
639
640
641
642






643
644

645
646
647

648
649
650
651
652
653
654
655
656
657

658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674

675
676
677
678

679
680
681
682
683
684
685
686
687


688
689







690





691
692

693
694

695
696




697

698


699
700
701
702
703
704
705
706
707
708
709

710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
 err_sl:
	ASN1error(ASN1_R_SHORT_LINE);
 err:
	free(s);
	return (ret);
}



static void
asn1_aint_twos_complement(uint8_t *data, size_t data_len)
{
	uint8_t carry = 1;
	ssize_t i;

	for (i = data_len - 1; i >= 0; i--) {
		data[i] = (data[i] ^ 0xff) + carry;
		if (data[i] != 0)
			carry = 0;
	}
}

static int




asn1_aint_keep_twos_padding(const uint8_t *data, size_t data_len)

{
	size_t i;


	/*
	 * If a two's complement value has a padding byte (0xff) and the rest
	 * of the value is all zeros, the padding byte cannot be removed as when
	 * converted from two's complement this becomes 0x01 (in the place of
	 * the padding byte) followed by the same number of zero bytes.
	 */
	if (data_len <= 1 || data[0] != 0xff)
		return 0;
	for (i = 1; i < data_len; i++) {
		if (data[i] != 0)
			return 0;
	}
	return 1;


}



static int
i2c_ASN1_INTEGER_cbb(ASN1_INTEGER *aint, CBB *cbb)

{
	uint8_t *data = NULL;
	size_t data_len = 0;
	uint8_t padding, val;

	uint8_t msb;


	CBS cbs;
	int ret = 0;

	if (aint->length < 0)


		goto err;




	if (aint->data == NULL && aint->length != 0)
		goto err;

	if ((aint->type & ~V_ASN1_NEG) != V_ASN1_ENUMERATED &&
	    (aint->type & ~V_ASN1_NEG) != V_ASN1_INTEGER)
		goto err;

	CBS_init(&cbs, aint->data, aint->length);

	/* Find the first non-zero byte. */
	while (CBS_len(&cbs) > 0) {
		if (!CBS_peek_u8(&cbs, &val))
			goto err;
		if (val != 0)
			break;
		if (!CBS_skip(&cbs, 1))
			goto err;
	}


	/* A zero value is encoded as a single octet. */
	if (CBS_len(&cbs) == 0) {
		if (!CBB_add_u8(cbb, 0))
			goto err;
		goto done;
	}




	if (!CBS_stow(&cbs, &data, &data_len))

		goto err;






	if ((aint->type & V_ASN1_NEG) != 0)

		asn1_aint_twos_complement(data, data_len);

	/* Topmost bit indicates sign, padding is all zeros or all ones. */
	msb = (data[0] >> 7);
	padding = (msb - 1) & 0xff;

	/* See if we need a padding octet to avoid incorrect sign. */
	if (((aint->type & V_ASN1_NEG) == 0 && msb == 1) ||
	    ((aint->type & V_ASN1_NEG) != 0 && msb == 0)) {
		if (!CBB_add_u8(cbb, padding))
			goto err;
	}
	if (!CBB_add_bytes(cbb, data, data_len))
		goto err;

 done:
	ret = 1;

 err:
	freezero(data, data_len);


	return ret;
}

int
i2c_ASN1_INTEGER(ASN1_INTEGER *aint, unsigned char **pp)
{
	uint8_t *data = NULL;
	size_t data_len = 0;
	CBB cbb;
	int ret = -3;

	if (!CBB_init(&cbb, 0))
		goto err;
	if (!i2c_ASN1_INTEGER_cbb(aint, &cbb))

		goto err;
	if (!CBB_finish(&cbb, &data, &data_len))
		goto err;
	if (data_len > INT_MAX)
		goto err;

	if (pp != NULL) {


		if ((uintptr_t)*pp > UINTPTR_MAX - data_len)
			goto err;
		memcpy(*pp, data, data_len);
		*pp += data_len;
	}

	ret = data_len;

 err:
	freezero(data, data_len);
	CBB_cleanup(&cbb);

	return ret;






}


int
c2i_ASN1_INTEGER_cbs(ASN1_INTEGER **out_aint, CBS *cbs)
{

	ASN1_INTEGER *aint = NULL;
	uint8_t *data = NULL;
	size_t data_len = 0;
	uint8_t padding, val;
	uint8_t negative;
	int ret = 0;

	if (out_aint == NULL)
		goto err;


	if (*out_aint != NULL) {
		ASN1_INTEGER_free(*out_aint);
		*out_aint = NULL;
	}

	if (CBS_len(cbs) == 0) {
		/* XXX INVALID ENCODING? */
		ASN1error(ERR_R_ASN1_LENGTH_MISMATCH);
		goto err;
	}
	if (!CBS_peek_u8(cbs, &val))
		goto err;

	/* Topmost bit indicates sign, padding is all zeros or all ones. */
	negative = (val >> 7);
	padding = ~(negative - 1) & 0xff;


	/*
	 * Ensure that the first 9 bits are not all zero or all one, as per
	 * X.690 section 8.3.2. Remove the padding octet if possible.
	 */

	if (CBS_len(cbs) > 1 && val == padding) {
		if (!asn1_aint_keep_twos_padding(CBS_data(cbs), CBS_len(cbs))) {
			if (!CBS_get_u8(cbs, &padding))
				goto err;
			if (!CBS_peek_u8(cbs, &val))
				goto err;
			if ((val >> 7) == (padding >> 7)) {
				/* XXX INVALID ENCODING? */
				ASN1error(ERR_R_ASN1_LENGTH_MISMATCH);


				goto err;
			}







		}





	}


	if (!CBS_stow(cbs, &data, &data_len))
		goto err;

	if (data_len > INT_MAX)
		goto err;






	if ((aint = ASN1_INTEGER_new()) == NULL)


		goto err;

	/*
	 * Negative integers are handled as a separate type - convert from
	 * two's complement for internal representation.
	 */
	if (negative) {
		aint->type = V_ASN1_NEG_INTEGER;
		asn1_aint_twos_complement(data, data_len);
	}


	aint->data = data;
	aint->length = (int)data_len;
	data = NULL;

	*out_aint = aint;
	aint = NULL;

	ret = 1;

 err:
	ASN1_INTEGER_free(aint);
	freezero(data, data_len);

	return ret;
}

ASN1_INTEGER *
c2i_ASN1_INTEGER(ASN1_INTEGER **out_aint, const unsigned char **pp, long len)
{
	ASN1_INTEGER *aint = NULL;
	CBS content;

	if (out_aint != NULL) {
		ASN1_INTEGER_free(*out_aint);
		*out_aint = NULL;
	}

	if (len < 0) {
		ASN1error(ASN1_R_LENGTH_ERROR);
		return NULL;
	}

	CBS_init(&content, *pp, len);

	if (!c2i_ASN1_INTEGER_cbs(&aint, &content))
		return NULL;

	*pp = CBS_data(&content);

	if (out_aint != NULL)
		*out_aint = aint;

	return aint;
}

int
i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_INTEGER_it);
}
Changes to jni/libressl/crypto/asn1/a_object.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: a_object.c,v 1.46.2.1 2022/05/14 15:06:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: a_object.c,v 1.48 2022/05/13 16:32:10 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
525
526
527
528
529
530
531
532
533





534
535
536
537
538
539
540
c2i_ASN1_OBJECT_cbs(ASN1_OBJECT **out_aobj, CBS *content)
{
	ASN1_OBJECT *aobj = NULL;
	uint8_t *data = NULL;
	size_t data_len;
	CBS cbs;

	if (out_aobj == NULL || *out_aobj != NULL)
		goto err;






	/* Parse and validate OID encoding per X.690 8.19.2. */
	CBS_dup(content, &cbs);
	if (CBS_len(&cbs) == 0) {
		ASN1error(ASN1_R_INVALID_OBJECT_ENCODING);
		goto err;
	}







|

>
>
>
>
>







525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
c2i_ASN1_OBJECT_cbs(ASN1_OBJECT **out_aobj, CBS *content)
{
	ASN1_OBJECT *aobj = NULL;
	uint8_t *data = NULL;
	size_t data_len;
	CBS cbs;

	if (out_aobj == NULL)
		goto err;

	if (*out_aobj != NULL) {
		ASN1_OBJECT_free(*out_aobj);
		*out_aobj = NULL;
	}

	/* Parse and validate OID encoding per X.690 8.19.2. */
	CBS_dup(content, &cbs);
	if (CBS_len(&cbs) == 0) {
		ASN1error(ASN1_R_INVALID_OBJECT_ENCODING);
		goto err;
	}
Changes to jni/libressl/crypto/asn1/a_string.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: a_string.c,v 1.7 2022/03/17 17:17:58 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: a_string.c,v 1.11 2022/05/20 08:04:21 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
	if (!(astr->flags & ASN1_STRING_FLAG_NDEF))
		freezero(astr->data, astr->length);

	astr->flags &= ~ASN1_STRING_FLAG_NDEF;
	astr->data = NULL;
	astr->length = 0;
}
 
void
ASN1_STRING_free(ASN1_STRING *astr)
{
	if (astr == NULL)
		return;

	ASN1_STRING_clear(astr);







|







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
	if (!(astr->flags & ASN1_STRING_FLAG_NDEF))
		freezero(astr->data, astr->length);

	astr->flags &= ~ASN1_STRING_FLAG_NDEF;
	astr->data = NULL;
	astr->length = 0;
}

void
ASN1_STRING_free(ASN1_STRING *astr)
{
	if (astr == NULL)
		return;

	ASN1_STRING_clear(astr);
272
273
274
275
276
277
278
279
280

281







282
283
284
285
286
287
288
289







290
291
292

293
294
295
296
297
298
299
300
301
302
303
304
/*
 * Utility function: convert any string type to UTF8, returns number of bytes
 * in output string or a negative error code
 */
int
ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in)
{
	ASN1_STRING stmp, *str = &stmp;
	int mbflag, ret;









	if (in == NULL)
		return -1;

	if ((mbflag = asn1_tag2charwidth(in->type)) == -1)
		return -1;

	mbflag |= MBSTRING_FLAG;








	stmp.data = NULL;
	stmp.length = 0;
	ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag,

	    B_ASN1_UTF8STRING);
	if (ret < 0)
		return ret;
	*out = stmp.data;
	return stmp.length;
}

int
i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *astr, int type)
{
	int i, n = 0;
	static const char h[] = "0123456789ABCDEF";







|
|
>

>
>
>
>
>
>
>

|


|



>
>
>
>
>
>
>
|
|
|
>
|
|
|
<
<







272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311


312
313
314
315
316
317
318
/*
 * Utility function: convert any string type to UTF8, returns number of bytes
 * in output string or a negative error code
 */
int
ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in)
{
	ASN1_STRING *astr = NULL;
	int mbflag;
	int ret = -1;

	/*
	 * XXX We can't fail on *out != NULL here since things like haproxy and
	 * grpc pass in a pointer to an uninitialized pointer on the stack.
	 */
	if (out == NULL)
		goto err;

	if (in == NULL)
		goto err;

	if ((mbflag = asn1_tag2charwidth(in->type)) == -1)
		goto err;

	mbflag |= MBSTRING_FLAG;

	if ((ret = ASN1_mbstring_copy(&astr, in->data, in->length, mbflag,
	    B_ASN1_UTF8STRING)) < 0)
		goto err;

	*out = astr->data;
	ret = astr->length;

	astr->data = NULL;
	astr->length = 0;

 err:
	ASN1_STRING_free(astr);

	return ret;


}

int
i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *astr, int type)
{
	int i, n = 0;
	static const char h[] = "0123456789ABCDEF";
Changes to jni/libressl/crypto/asn1/a_time.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: a_time.c,v 1.33 2021/12/25 07:48:09 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: a_time.c,v 1.34 2022/06/27 13:54:57 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

void
ASN1_TIME_free(ASN1_TIME *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_TIME_it);
}

/* Public API in OpenSSL. Kept internal for now. */
static int
ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm)
{
	time_t now;

	if (s != NULL)
		return ASN1_time_parse(s->data, s->length, tm, 0) != -1;








<
|







88
89
90
91
92
93
94

95
96
97
98
99
100
101
102

void
ASN1_TIME_free(ASN1_TIME *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ASN1_TIME_it);
}


int
ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm)
{
	time_t now;

	if (s != NULL)
		return ASN1_time_parse(s->data, s->length, tm, 0) != -1;

Changes to jni/libressl/crypto/asn1/a_time_tm.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
/* $OpenBSD: a_time_tm.c,v 1.19 2022/03/31 13:04:47 tb Exp $ */
/*
 * Copyright (c) 2015 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#include <openssl/asn1t.h>
#include <openssl/err.h>


#include "o_time.h"

#define RFC5280 0
#define GENTIME_LENGTH 15
#define UTCTIME_LENGTH 13

int
|















>









>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* $OpenBSD: a_time_tm.c,v 1.24 2022/07/04 14:39:43 tb Exp $ */
/*
 * Copyright (c) 2015 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#include <openssl/asn1t.h>
#include <openssl/err.h>

#include "bytestring.h"
#include "o_time.h"

#define RFC5280 0
#define GENTIME_LENGTH 15
#define UTCTIME_LENGTH 13

int
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

88

89
90
91
92









































93













94
95


96


97




98





99


100


101
102




103

104








105
106

107
108
109

110

111





















112
113
114







115






116

117


118



119
120
121



122






123


124




125




126




127




128




129














130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231

	if (ASN1_time_tm_cmp(tm, &broken_os_epoch_tm) == 1)
		memcpy(tm, &broken_os_epoch_tm, sizeof(*tm));
#endif
	return 1;
}

/* Format a time as an RFC 5280 format Generalized time */
char *
gentime_string_from_tm(struct tm *tm)
{
	char *ret = NULL;
	int year;

	year = tm->tm_year + 1900;
	if (year < 0 || year > 9999)
		return (NULL);



	if (asprintf(&ret, "%04u%02u%02u%02u%02u%02uZ", year,
	    tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min,
	    tm->tm_sec) == -1)
		ret = NULL;























































	return (ret);
}





/* Format a time as an RFC 5280 format UTC time */




char *





utctime_string_from_tm(struct tm *tm)


{


	char *ret = NULL;





	if (tm->tm_year >= 150 || tm->tm_year < 50)

		return (NULL);









	if (asprintf(&ret, "%02u%02u%02u%02u%02u%02uZ",

	    tm->tm_year % 100,  tm->tm_mon + 1, tm->tm_mday,
	    tm->tm_hour, tm->tm_min, tm->tm_sec) == -1)
		ret = NULL;



	return (ret);





















}

/* Format a time correctly for an X509 object as per RFC 5280 */







char *






rfc5280_string_from_tm(struct tm *tm)

{


	char *ret = NULL;



	int year;

	year = tm->tm_year + 1900;



	if (year < 1950 || year > 9999)






		return (NULL);







	if (year < 2050)




		ret = utctime_string_from_tm(tm);




	else




		ret = gentime_string_from_tm(tm);



















	return (ret);
}

/*
 * Parse an RFC 5280 format ASN.1 time string.
 *
 * mode must be:
 * 0 if we expect to parse a time as specified in RFC 5280 for an X509 object.
 * V_ASN1_UTCTIME if we wish to parse an RFC5280 format UTC time.
 * V_ASN1_GENERALIZEDTIME if we wish to parse an RFC5280 format Generalized time.
 *
 * Returns:
 * -1 if the string was invalid.
 * V_ASN1_UTCTIME if the string validated as a UTC time string.
 * V_ASN1_GENERALIZEDTIME if the string validated as a Generalized time string.
 *
 * Fills in *tm with the corresponding time if tm is non NULL.
 */
#define	ATOI2(ar)	((ar) += 2, ((ar)[-2] - '0') * 10 + ((ar)[-1] - '0'))
int
ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode)
{
	size_t i;
	int type = 0;
	struct tm ltm;
	struct tm *lt;
	const char *p;

	if (bytes == NULL)
		return (-1);

	/* Constrain to valid lengths. */
	if (len != UTCTIME_LENGTH && len != GENTIME_LENGTH)
		return (-1);

	lt = tm;
	if (lt == NULL)
		lt = &ltm;
	memset(lt, 0, sizeof(*lt));

	/* Timezone is required and must be GMT (Zulu). */
	if (bytes[len - 1] != 'Z')
		return (-1);

	/* Make sure everything else is digits. */
	for (i = 0; i < len - 1; i++) {
		if (isdigit((unsigned char)bytes[i]))
			continue;
		return (-1);
	}

	/*
	 * Validate and convert the time
	 */
	p = bytes;
	switch (len) {
	case GENTIME_LENGTH:
		if (mode == V_ASN1_UTCTIME)
			return (-1);
		lt->tm_year = (ATOI2(p) * 100) - 1900;	/* cc */
		type = V_ASN1_GENERALIZEDTIME;
		/* FALLTHROUGH */
	case UTCTIME_LENGTH:
		if (type == 0) {
			if (mode == V_ASN1_GENERALIZEDTIME)
				return (-1);
			type = V_ASN1_UTCTIME;
		}
		lt->tm_year += ATOI2(p);		/* yy */
		if (type == V_ASN1_UTCTIME) {
			if (lt->tm_year < 50)
				lt->tm_year += 100;
		}
		lt->tm_mon = ATOI2(p) - 1;		/* mm */
		if (lt->tm_mon < 0 || lt->tm_mon > 11)
			return (-1);
		lt->tm_mday = ATOI2(p);			/* dd */
		if (lt->tm_mday < 1 || lt->tm_mday > 31)
			return (-1);
		lt->tm_hour = ATOI2(p);			/* HH */
		if (lt->tm_hour < 0 || lt->tm_hour > 23)
			return (-1);
		lt->tm_min = ATOI2(p);			/* MM */
		if (lt->tm_min < 0 || lt->tm_min > 59)
			return (-1);
		lt->tm_sec = ATOI2(p);			/* SS */
		/* Leap second 60 is not accepted. Reconsider later? */
		if (lt->tm_sec < 0 || lt->tm_sec > 59)
			return (-1);
		break;
	default:
		return (-1);
	}

	return (type);
}

/*
 * ASN1_TIME generic functions.
 */

static int







|
|
|

|



|
|
>
|
>
|

|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>

>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
|
>
>
|

>
>
>
>
|
>
|
>
>
>
>
>
>
>
>

|
>
|
<
|
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
|
>
>
|
>
>
>
|
|
|
>
>
>
|
>
>
>
>
>
>
|
>
>

>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
|

















<



|

<
<
|




<
<
<
|
<
<
<
<

<
<
<
|
<
<
<
<
<
<
|
<
<
<
<
<
|
<
<
<

<
<
<
|
<
<
<
<
<
|
<
<
<
<
|
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<


|







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322

323
324
325
326
327


328
329
330
331
332



333




334



335






336





337



338



339





340




341


342













343
344
345
346
347
348
349
350
351
352

	if (ASN1_time_tm_cmp(tm, &broken_os_epoch_tm) == 1)
		memcpy(tm, &broken_os_epoch_tm, sizeof(*tm));
#endif
	return 1;
}

/* Convert time to GeneralizedTime, X.690, 11.7. */
ASN1_TIME *
tm_to_gentime(struct tm *tm, ASN1_TIME *atime)
{
	char *time_str = NULL;
	int year;

	year = tm->tm_year + 1900;
	if (year < 0 || year > 9999) {
		ASN1error(ASN1_R_ILLEGAL_TIME_VALUE);
		goto err;
	}

	if (asprintf(&time_str, "%04u%02u%02u%02u%02u%02uZ", year,
	    tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min,
	    tm->tm_sec) == -1) {
		time_str = NULL;
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	if (atime == NULL)
		atime = ASN1_TIME_new();
	if (atime == NULL) {
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	free(atime->data);
	atime->data = time_str;
	atime->length = GENTIME_LENGTH;
	atime->type = V_ASN1_GENERALIZEDTIME;

	return (atime);

 err:
	free(time_str);

	return (NULL);
}

/* Convert time to UTCTime, X.690, 11.8. */
ASN1_TIME *
tm_to_utctime(struct tm *tm, ASN1_TIME *atime)
{
	char *time_str = NULL;

	if (tm->tm_year >= 150 || tm->tm_year < 50) {
		ASN1error(ASN1_R_ILLEGAL_TIME_VALUE);
		goto err;
	}

	if (asprintf(&time_str, "%02u%02u%02u%02u%02u%02uZ",
	    tm->tm_year % 100,  tm->tm_mon + 1, tm->tm_mday,
	    tm->tm_hour, tm->tm_min, tm->tm_sec) == -1) {
		time_str = NULL;
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	if (atime == NULL)
		atime = ASN1_TIME_new();
	if (atime == NULL) {
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	free(atime->data);
	atime->data = time_str;
	atime->length = UTCTIME_LENGTH;
	atime->type = V_ASN1_UTCTIME;

	return (atime);

 err:
	free(time_str);

	return (NULL);
}

ASN1_TIME *
tm_to_rfc5280_time(struct tm *tm, ASN1_TIME *atime)
{
	int year;

	year = tm->tm_year + 1900;
	if (year < 1950 || year > 9999) {
		ASN1error(ASN1_R_ILLEGAL_TIME_VALUE);
		return (NULL);
	}

	if (year < 2050)
		return (tm_to_utctime(tm, atime));

	return (tm_to_gentime(tm, atime));
}


static int
cbs_get_two_digit_value(CBS *cbs, int *out)
{
	uint8_t first_digit, second_digit;

	if (!CBS_get_u8(cbs, &first_digit))
		return 0;
	if (!isdigit(first_digit))
		return 0;
	if (!CBS_get_u8(cbs, &second_digit))
		return 0;
	if (!isdigit(second_digit))
		return 0;

	*out = (first_digit - '0') * 10 + (second_digit - '0');

	return 1;
}


static int
is_valid_day(int year, int month, int day)
{
	if (day < 1)
		return 0;
	switch (month) {
	case 1:
	case 3:
	case 5:
	case 7:
	case 8:
	case 10:
	case 12:
		return day <= 31;
	case 4:
	case 6:
	case 9:
	case 11:
		return day <= 30;
	case 2:
		if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
			return day <= 29;
		 else
			return day <= 28;
	default:
		return 0;
	}
}

/*
 * asn1_time_parse_cbs returns one if |cbs| is a valid DER-encoded, ASN.1 Time
 * body within the limitations imposed by RFC 5280, or zero otherwise. The time
 * is expected to parse as a Generalized Time if is_gentime is true, and as a
 * UTC Time otherwise. If |out_tm| is non-NULL, |*out_tm| will be zeroed, and
 * then set to the corresponding time in UTC. This function does not compute
 * |out_tm->tm_wday| or |out_tm->tm_yday|. |cbs| is not consumed.
 */
int
asn1_time_parse_cbs(const CBS *cbs, int is_gentime, struct tm *out_tm)
{
	int year, month, day, hour, min, sec, val;
	CBS copy;
	uint8_t tz;

	CBS_dup(cbs, &copy);

	if (is_gentime) {
		if (!cbs_get_two_digit_value(&copy, &val))
			return 0;
		year = val * 100;
		if (!cbs_get_two_digit_value(&copy, &val))
			return 0;
		year += val;
	} else {
		year = 1900;
		if (!cbs_get_two_digit_value(&copy, &val))
			return 0;
		year += val;
		if (year < 1950)
			year += 100;
		if (year >= 2050)
			return 0;  /* A Generalized time must be used. */
	}

	if (!cbs_get_two_digit_value(&copy, &month))
		return 0;
	if (month < 1 || month > 12)
		return 0; /* Reject invalid months. */

	if (!cbs_get_two_digit_value(&copy, &day))
		return 0;
	if (!is_valid_day(year, month, day))
		return 0; /* Reject invalid days. */

	if (!cbs_get_two_digit_value(&copy, &hour))
		return 0;
	if (hour > 23)
		return 0; /* Reject invalid hours. */

	if (!cbs_get_two_digit_value(&copy, &min))
		return 0;
	if (min > 59)
		return 0; /* Reject invalid minutes. */

	if (!cbs_get_two_digit_value(&copy, &sec))
		return 0;
	if (sec > 59)
		return 0; /* Reject invalid seconds. Leap seconds are invalid. */

	if (!CBS_get_u8(&copy, &tz))
		return 0;
	if (tz != 'Z')
		return 0; /* Reject anything but Z on the end. */

	if (CBS_len(&copy) != 0)
		return 0;  /* Reject invalid lengths. */

	if (out_tm != NULL) {
		memset(out_tm, 0, sizeof(*out_tm));
		/* Fill in the tm fields corresponding to what we validated. */
		out_tm->tm_year = year - 1900;
		out_tm->tm_mon = month - 1;
		out_tm->tm_mday = day;
		out_tm->tm_hour = hour;
		out_tm->tm_min = min;
		out_tm->tm_sec = sec;
	}

	return 1;
}

/*
 * Parse an RFC 5280 format ASN.1 time string.
 *
 * mode must be:
 * 0 if we expect to parse a time as specified in RFC 5280 for an X509 object.
 * V_ASN1_UTCTIME if we wish to parse an RFC5280 format UTC time.
 * V_ASN1_GENERALIZEDTIME if we wish to parse an RFC5280 format Generalized time.
 *
 * Returns:
 * -1 if the string was invalid.
 * V_ASN1_UTCTIME if the string validated as a UTC time string.
 * V_ASN1_GENERALIZEDTIME if the string validated as a Generalized time string.
 *
 * Fills in *tm with the corresponding time if tm is non NULL.
 */

int
ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode)
{
	struct tm tml, *tmp = tm ? tm : &tml;
	int type = 0;


	CBS cbs;

	if (bytes == NULL)
		return (-1);




	CBS_init(&cbs, bytes, len);








	if (CBS_len(&cbs) == UTCTIME_LENGTH)






		type = V_ASN1_UTCTIME;





	if (CBS_len(&cbs) == GENTIME_LENGTH)



		type = V_ASN1_GENERALIZEDTIME;



	if (asn1_time_parse_cbs(&cbs, type == V_ASN1_GENERALIZEDTIME, tmp)) {





		if (mode != 0 && mode != type)




			return -1;


		return type;













	}

	return -1;
}

/*
 * ASN1_TIME generic functions.
 */

static int
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
	return (1);
}

static ASN1_TIME *
ASN1_TIME_adj_internal(ASN1_TIME *s, time_t t, int offset_day, long offset_sec,
    int mode)
{
	int allocated = 0;
	struct tm tm;
	size_t len;
	char *p;

	if (gmtime_r(&t, &tm) == NULL)
		return (NULL);

	if (offset_day || offset_sec) {
		if (!OPENSSL_gmtime_adj(&tm, offset_day, offset_sec))
			return (NULL);
	}

	switch (mode) {
	case V_ASN1_UTCTIME:
		p = utctime_string_from_tm(&tm);
		break;
	case V_ASN1_GENERALIZEDTIME:
		p = gentime_string_from_tm(&tm);
		break;
	case RFC5280:
		p = rfc5280_string_from_tm(&tm);
		break;
	default:
		return (NULL);
	}
	if (p == NULL) {
		ASN1error(ASN1_R_ILLEGAL_TIME_VALUE);
		return (NULL);
	}

	if (s == NULL) {
		if ((s = ASN1_TIME_new()) == NULL) {
			free(p);
			return (NULL);
		}
		allocated = 1;
	}

	len = strlen(p);
	switch (len) {
	case GENTIME_LENGTH:
		s->type = V_ASN1_GENERALIZEDTIME;
		break;
	case UTCTIME_LENGTH:
		s->type = V_ASN1_UTCTIME;
		break;
	default:
		if (allocated)
			ASN1_TIME_free(s);
		free(p);
		return (NULL);
	}
	free(s->data);
	s->data = p;
	s->length = len;
	return (s);
}

ASN1_TIME *
ASN1_TIME_set(ASN1_TIME *s, time_t t)
{
	return (ASN1_TIME_adj(s, t, 0, 0));
}







<

<
<




|






|
<

|
<

<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
<
<


<
<
<
<







373
374
375
376
377
378
379

380


381
382
383
384
385
386
387
388
389
390
391
392

393
394

395



396






















397



398
399




400
401
402
403
404
405
406
	return (1);
}

static ASN1_TIME *
ASN1_TIME_adj_internal(ASN1_TIME *s, time_t t, int offset_day, long offset_sec,
    int mode)
{

	struct tm tm;



	if (gmtime_r(&t, &tm) == NULL)
		return (NULL);

	if (offset_day != 0 || offset_sec != 0) {
		if (!OPENSSL_gmtime_adj(&tm, offset_day, offset_sec))
			return (NULL);
	}

	switch (mode) {
	case V_ASN1_UTCTIME:
		return (tm_to_utctime(&tm, s));

	case V_ASN1_GENERALIZEDTIME:
		return (tm_to_gentime(&tm, s));

	case RFC5280:



		return (tm_to_rfc5280_time(&tm, s));






















	default:



		return (NULL);
	}




}

ASN1_TIME *
ASN1_TIME_set(ASN1_TIME *s, time_t t)
{
	return (ASN1_TIME_adj(s, t, 0, 0));
}
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382























































383
384
385
386
387
388
389
		return (0);
	return (t->type == ASN1_time_parse(t->data, t->length, NULL, t->type));
}

ASN1_GENERALIZEDTIME *
ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, ASN1_GENERALIZEDTIME **out)
{
	ASN1_GENERALIZEDTIME *tmp = NULL;
	struct tm tm;
	char *str;

	if (t->type != V_ASN1_GENERALIZEDTIME && t->type != V_ASN1_UTCTIME)
		return (NULL);

	if (t->type != ASN1_time_parse(t->data, t->length, &tm, t->type))
		return (NULL);
	if ((str = gentime_string_from_tm(&tm)) == NULL)
		return (NULL);

	if (out != NULL)
		tmp = *out;
	if (tmp == NULL && (tmp = ASN1_GENERALIZEDTIME_new()) == NULL) {
		free(str);
		return (NULL);
	}
	if (out != NULL)
		*out = tmp;

	free(tmp->data);
	tmp->data = str;
	tmp->length = strlen(str);
	return (tmp);
}

int
ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
{
	return (ASN1_TIME_set_string_internal(s, str, 0));
}
























































/*
 * ASN1_UTCTIME wrappers
 */

int
ASN1_UTCTIME_check(const ASN1_UTCTIME *d)







|

<






<
<


|
|
<

<

|

<
<
<
|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







428
429
430
431
432
433
434
435
436

437
438
439
440
441
442


443
444
445
446

447

448
449
450



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
		return (0);
	return (t->type == ASN1_time_parse(t->data, t->length, NULL, t->type));
}

ASN1_GENERALIZEDTIME *
ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, ASN1_GENERALIZEDTIME **out)
{
	ASN1_GENERALIZEDTIME *agt = NULL;
	struct tm tm;


	if (t->type != V_ASN1_GENERALIZEDTIME && t->type != V_ASN1_UTCTIME)
		return (NULL);

	if (t->type != ASN1_time_parse(t->data, t->length, &tm, t->type))
		return (NULL);



	if (out != NULL)
		agt = *out;
	if ((agt = tm_to_gentime(&tm, agt)) == NULL)

		return (NULL);

	if (out != NULL)
		*out = agt;




	return (agt);
}

int
ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
{
	return (ASN1_TIME_set_string_internal(s, str, 0));
}

static int
ASN1_TIME_cmp_time_t_internal(const ASN1_TIME *s, time_t t2, int mode)
{
	struct tm tm1, tm2;

	/*
	 * This function has never handled failure conditions properly
	 * The OpenSSL version used to simply follow NULL pointers on failure.
	 * BoringSSL and OpenSSL now make it return -2 on failure.
	 *
	 * The danger is that users of this function will not differentiate the
	 * -2 failure case from s < t2. Callers must be careful. Sadly this is
	 * one of those pervasive things from OpenSSL we must continue with.
	 */

	if (ASN1_time_parse(s->data, s->length, &tm1, mode) == -1)
		return -2;

	if (gmtime_r(&t2, &tm2) == NULL)
		return -2;

	return ASN1_time_tm_cmp(&tm1, &tm2);
}

int
ASN1_TIME_compare(const ASN1_TIME *t1, const ASN1_TIME *t2)
{
	struct tm tm1, tm2;

	if (t1->type != V_ASN1_UTCTIME && t1->type != V_ASN1_GENERALIZEDTIME)
		return -2;

	if (t2->type != V_ASN1_UTCTIME && t2->type != V_ASN1_GENERALIZEDTIME)
		return -2;

	if (ASN1_time_parse(t1->data, t1->length, &tm1, t1->type) == -1)
		return -2;

	if (ASN1_time_parse(t1->data, t2->length, &tm2, t2->type) == -1)
		return -2;

	return ASN1_time_tm_cmp(&tm1, &tm2);
}

int
ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t)
{
	if (s->type == V_ASN1_UTCTIME)
		return ASN1_TIME_cmp_time_t_internal(s, t, V_ASN1_UTCTIME);
	if (s->type == V_ASN1_GENERALIZEDTIME)
		return ASN1_TIME_cmp_time_t_internal(s, t,
		    V_ASN1_GENERALIZEDTIME);
	return -2;
}

/*
 * ASN1_UTCTIME wrappers
 */

int
ASN1_UTCTIME_check(const ASN1_UTCTIME *d)
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, int offset_day, long offset_sec)
{
	return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
	    V_ASN1_UTCTIME));
}

int
ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t2)
{
	struct tm tm1, tm2;

	/*
	 * This function has never handled failure conditions properly
	 * and should be deprecated. The OpenSSL version used to
	 * simply follow NULL pointers on failure. BoringSSL and
	 * OpenSSL now make it return -2 on failure.
	 *
	 * The danger is that users of this function will not
	 * differentiate the -2 failure case from t1 < t2.
	 */
	if (ASN1_time_parse(s->data, s->length, &tm1, V_ASN1_UTCTIME) == -1)
		return (-2); /* XXX */

	if (gmtime_r(&t2, &tm2) == NULL)
		return (-2); /* XXX */

	return ASN1_time_tm_cmp(&tm1, &tm2);
}

/*
 * ASN1_GENERALIZEDTIME wrappers
 */

int







|

<
|
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<







542
543
544
545
546
547
548
549
550

551











552

553


554
555
556
557
558
559
560
ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, int offset_day, long offset_sec)
{
	return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
	    V_ASN1_UTCTIME));
}

int
ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
{

	if (s->type == V_ASN1_UTCTIME)











		return ASN1_TIME_cmp_time_t_internal(s, t, V_ASN1_UTCTIME);

	return -2;


}

/*
 * ASN1_GENERALIZEDTIME wrappers
 */

int
466
467
468
469
470
471
472
















ASN1_GENERALIZEDTIME *
ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day,
    long offset_sec)
{
	return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
	    V_ASN1_GENERALIZEDTIME));
}























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
ASN1_GENERALIZEDTIME *
ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day,
    long offset_sec)
{
	return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
	    V_ASN1_GENERALIZEDTIME));
}

int
ASN1_TIME_normalize(ASN1_TIME *t)
{
	struct tm tm;

	if (!ASN1_TIME_to_tm(t, &tm))
		return 0;
	return tm_to_rfc5280_time(&tm, t) != NULL;
}

int
ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str)
{
	return ASN1_TIME_set_string_internal(s, str, RFC5280);
}
Changes to jni/libressl/crypto/asn1/ameth_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ameth_lib.c,v 1.25 2022/01/10 12:10:26 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ameth_lib.c,v 1.26 2022/06/27 12:36:05 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
425
426
427
428
429
430
431







432
433
434
435
436
437
438

void
EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2))
{
	ameth->pkey_ctrl = pkey_ctrl;
}








void
EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_check)(const EVP_PKEY *pk))
{
	ameth->pkey_check = pkey_check;
}







>
>
>
>
>
>
>







425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445

void
EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2))
{
	ameth->pkey_ctrl = pkey_ctrl;
}

void
EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_security_bits)(const EVP_PKEY *pkey))
{
	ameth->pkey_security_bits = pkey_security_bits;
}

void
EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_check)(const EVP_PKEY *pk))
{
	ameth->pkey_check = pkey_check;
}
Changes to jni/libressl/crypto/asn1/asn1_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_err.c,v 1.22 2020/12/08 15:06:42 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_err.c,v 1.25 2022/08/29 06:48:58 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/asn1.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason)

static ERR_STRING_DATA ASN1_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/asn1.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason)

static ERR_STRING_DATA ASN1_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
114
115
116
117
118
119
120

121
122
123
124
125
126
127
	{ERR_REASON(ASN1_R_ILLEGAL_BITSTRING_FORMAT), "illegal bitstring format"},
	{ERR_REASON(ASN1_R_ILLEGAL_BOOLEAN)      , "illegal boolean"},
	{ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS)   , "illegal characters"},
	{ERR_REASON(ASN1_R_ILLEGAL_FORMAT)       , "illegal format"},
	{ERR_REASON(ASN1_R_ILLEGAL_HEX)          , "illegal hex"},
	{ERR_REASON(ASN1_R_ILLEGAL_IMPLICIT_TAG) , "illegal implicit tag"},
	{ERR_REASON(ASN1_R_ILLEGAL_INTEGER)      , "illegal integer"},

	{ERR_REASON(ASN1_R_ILLEGAL_NESTED_TAGGING), "illegal nested tagging"},
	{ERR_REASON(ASN1_R_ILLEGAL_NULL)         , "illegal null"},
	{ERR_REASON(ASN1_R_ILLEGAL_NULL_VALUE)   , "illegal null value"},
	{ERR_REASON(ASN1_R_ILLEGAL_OBJECT)       , "illegal object"},
	{ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) , "illegal optional any"},
	{ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE), "illegal options on item template"},
	{ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY)   , "illegal tagged any"},







>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
	{ERR_REASON(ASN1_R_ILLEGAL_BITSTRING_FORMAT), "illegal bitstring format"},
	{ERR_REASON(ASN1_R_ILLEGAL_BOOLEAN)      , "illegal boolean"},
	{ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS)   , "illegal characters"},
	{ERR_REASON(ASN1_R_ILLEGAL_FORMAT)       , "illegal format"},
	{ERR_REASON(ASN1_R_ILLEGAL_HEX)          , "illegal hex"},
	{ERR_REASON(ASN1_R_ILLEGAL_IMPLICIT_TAG) , "illegal implicit tag"},
	{ERR_REASON(ASN1_R_ILLEGAL_INTEGER)      , "illegal integer"},
	{ERR_REASON(ASN1_R_ILLEGAL_NEGATIVE_VALUE), "illegal negative value"},
	{ERR_REASON(ASN1_R_ILLEGAL_NESTED_TAGGING), "illegal nested tagging"},
	{ERR_REASON(ASN1_R_ILLEGAL_NULL)         , "illegal null"},
	{ERR_REASON(ASN1_R_ILLEGAL_NULL_VALUE)   , "illegal null value"},
	{ERR_REASON(ASN1_R_ILLEGAL_OBJECT)       , "illegal object"},
	{ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) , "illegal optional any"},
	{ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE), "illegal options on item template"},
	{ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY)   , "illegal tagged any"},
173
174
175
176
177
178
179

180

181

182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
	{ERR_REASON(ASN1_R_SIG_INVALID_MIME_TYPE), "sig invalid mime type"},
	{ERR_REASON(ASN1_R_STREAMING_NOT_SUPPORTED), "streaming not supported"},
	{ERR_REASON(ASN1_R_STRING_TOO_LONG)      , "string too long"},
	{ERR_REASON(ASN1_R_STRING_TOO_SHORT)     , "string too short"},
	{ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH)   , "tag value too high"},
	{ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD), "the asn1 object identifier is not known for this md"},
	{ERR_REASON(ASN1_R_TIME_NOT_ASCII_FORMAT), "time not ascii format"},

	{ERR_REASON(ASN1_R_TOO_LONG)             , "too long"},

	{ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) , "type not constructed"},

	{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY), "unable to decode rsa key"},
	{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY), "unable to decode rsa private key"},
	{ERR_REASON(ASN1_R_UNEXPECTED_EOC)       , "unexpected eoc"},
	{ERR_REASON(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH), "universalstring is wrong length"},
	{ERR_REASON(ASN1_R_UNKNOWN_FORMAT)       , "unknown format"},
	{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM), "unknown message digest algorithm"},
	{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE)  , "unknown object type"},
	{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE), "unknown public key type"},
	{ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM), "unknown signature algorithm"},
	{ERR_REASON(ASN1_R_UNKNOWN_TAG)          , "unknown tag"},
	{ERR_REASON(ASN1_R_UNKOWN_FORMAT)        , "unknown format"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE), "unsupported any defined by type"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER)   , "unsupported cipher"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM), "unsupported encryption algorithm"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE), "unsupported public key type"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_TYPE)     , "unsupported type"},

	{ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE), "wrong public key type"},
	{ERR_REASON(ASN1_R_WRONG_TAG)            , "wrong tag"},
	{ERR_REASON(ASN1_R_WRONG_TYPE)           , "wrong type"},
	{0, NULL}
};

#endif

void
ERR_load_ASN1_strings(void)
{
#ifndef OPENSSL_NO_ERR
	if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) {
		ERR_load_strings(0, ASN1_str_functs);
		ERR_load_strings(0, ASN1_str_reasons);
	}
#endif
}







>

>

>
















>





<












168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

202
203
204
205
206
207
208
209
210
211
212
213
	{ERR_REASON(ASN1_R_SIG_INVALID_MIME_TYPE), "sig invalid mime type"},
	{ERR_REASON(ASN1_R_STREAMING_NOT_SUPPORTED), "streaming not supported"},
	{ERR_REASON(ASN1_R_STRING_TOO_LONG)      , "string too long"},
	{ERR_REASON(ASN1_R_STRING_TOO_SHORT)     , "string too short"},
	{ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH)   , "tag value too high"},
	{ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD), "the asn1 object identifier is not known for this md"},
	{ERR_REASON(ASN1_R_TIME_NOT_ASCII_FORMAT), "time not ascii format"},
	{ERR_REASON(ASN1_R_TOO_LARGE)            , "too large"},
	{ERR_REASON(ASN1_R_TOO_LONG)             , "too long"},
	{ERR_REASON(ASN1_R_TOO_SMALL)            , "too small"},
	{ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) , "type not constructed"},
	{ERR_REASON(ASN1_R_TYPE_NOT_PRIMITIVE)   , "type not primitive"},
	{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY), "unable to decode rsa key"},
	{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY), "unable to decode rsa private key"},
	{ERR_REASON(ASN1_R_UNEXPECTED_EOC)       , "unexpected eoc"},
	{ERR_REASON(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH), "universalstring is wrong length"},
	{ERR_REASON(ASN1_R_UNKNOWN_FORMAT)       , "unknown format"},
	{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM), "unknown message digest algorithm"},
	{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE)  , "unknown object type"},
	{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE), "unknown public key type"},
	{ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM), "unknown signature algorithm"},
	{ERR_REASON(ASN1_R_UNKNOWN_TAG)          , "unknown tag"},
	{ERR_REASON(ASN1_R_UNKOWN_FORMAT)        , "unknown format"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE), "unsupported any defined by type"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER)   , "unsupported cipher"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM), "unsupported encryption algorithm"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE), "unsupported public key type"},
	{ERR_REASON(ASN1_R_UNSUPPORTED_TYPE)     , "unsupported type"},
	{ERR_REASON(ASN1_R_WRONG_INTEGER_TYPE)   , "wrong integer type"},
	{ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE), "wrong public key type"},
	{ERR_REASON(ASN1_R_WRONG_TAG)            , "wrong tag"},
	{ERR_REASON(ASN1_R_WRONG_TYPE)           , "wrong type"},
	{0, NULL}
};

#endif

void
ERR_load_ASN1_strings(void)
{
#ifndef OPENSSL_NO_ERR
	if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) {
		ERR_load_strings(0, ASN1_str_functs);
		ERR_load_strings(0, ASN1_str_reasons);
	}
#endif
}
Changes to jni/libressl/crypto/asn1/asn1_gen.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_gen.c,v 1.18 2021/12/25 13:17:48 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2002 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_gen.c,v 1.19 2022/05/24 19:56:13 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2002 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
57
58
59
60
61
62
63


64
65
66
67
68
69
70
 */

#include <string.h>

#include <openssl/asn1.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>



#define ASN1_GEN_FLAG		0x10000
#define ASN1_GEN_FLAG_IMP	(ASN1_GEN_FLAG|1)
#define ASN1_GEN_FLAG_EXP	(ASN1_GEN_FLAG|2)
#define ASN1_GEN_FLAG_TAG	(ASN1_GEN_FLAG|3)
#define ASN1_GEN_FLAG_BITWRAP	(ASN1_GEN_FLAG|4)
#define ASN1_GEN_FLAG_OCTWRAP	(ASN1_GEN_FLAG|5)







>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 */

#include <string.h>

#include <openssl/asn1.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>

#include "asn1_locl.h"

#define ASN1_GEN_FLAG		0x10000
#define ASN1_GEN_FLAG_IMP	(ASN1_GEN_FLAG|1)
#define ASN1_GEN_FLAG_EXP	(ASN1_GEN_FLAG|2)
#define ASN1_GEN_FLAG_TAG	(ASN1_GEN_FLAG|3)
#define ASN1_GEN_FLAG_BITWRAP	(ASN1_GEN_FLAG|4)
#define ASN1_GEN_FLAG_OCTWRAP	(ASN1_GEN_FLAG|5)
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767

		} else {
			ASN1error(ASN1_R_ILLEGAL_BITSTRING_FORMAT);
			goto bad_form;
		}

		if ((utype == V_ASN1_BIT_STRING) && no_unused) {
			atmp->value.asn1_string->flags &=
			    ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
			atmp->value.asn1_string->flags |=
			    ASN1_STRING_FLAG_BITS_LEFT;
		}

		break;

	default:
		ASN1error(ASN1_R_UNSUPPORTED_TYPE);
		goto bad_str;







|
|
|
<







752
753
754
755
756
757
758
759
760
761

762
763
764
765
766
767
768

		} else {
			ASN1error(ASN1_R_ILLEGAL_BITSTRING_FORMAT);
			goto bad_form;
		}

		if ((utype == V_ASN1_BIT_STRING) && no_unused) {
			if (!asn1_abs_set_unused_bits(atmp->value.asn1_string,
			    0))
				goto bad_str;

		}

		break;

	default:
		ASN1error(ASN1_R_UNSUPPORTED_TYPE);
		goto bad_str;
Changes to jni/libressl/crypto/asn1/asn1_item.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_item.c,v 1.4 2022/01/14 08:38:05 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_item.c,v 1.5 2022/05/24 20:20:19 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
230
231
232
233
234
235
236

237
238
239

240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265

266
267
268
269
270
271
272
int
ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
    ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx)
{
	const EVP_MD *type;
	EVP_PKEY *pkey;
	unsigned char *buf_in = NULL, *buf_out = NULL;

	size_t inl = 0, outl = 0, outll = 0;
	int signid, paramtype;
	int rv;


	type = EVP_MD_CTX_md(ctx);
	pkey = EVP_PKEY_CTX_get0_pkey(ctx->pctx);

	if (!type || !pkey) {
		ASN1error(ASN1_R_CONTEXT_NOT_INITIALISED);
		return 0;
	}

	if (pkey->ameth->item_sign) {
		rv = pkey->ameth->item_sign(ctx, it, asn, algor1, algor2,
		    signature);
		if (rv == 1)
			outl = signature->length;
		/* Return value meanings:
		 * <=0: error.
		 *   1: method does everything.
		 *   2: carry on as normal.
		 *   3: ASN1 method sets algorithm identifiers: just sign.
		 */
		if (rv <= 0)
			ASN1error(ERR_R_EVP_LIB);
		if (rv <= 1)
			goto err;
	} else
		rv = 2;


	if (rv == 2) {
		if (!pkey->ameth ||
		    !OBJ_find_sigid_by_algs(&signid, EVP_MD_nid(type),
		    pkey->ameth->pkey_id)) {
			ASN1error(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
			return 0;







>
|

|
>













|










<
<
>







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265


266
267
268
269
270
271
272
273
int
ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
    ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx)
{
	const EVP_MD *type;
	EVP_PKEY *pkey;
	unsigned char *buf_in = NULL, *buf_out = NULL;
	size_t buf_out_len = 0;
	int in_len = 0, out_len = 0;
	int signid, paramtype;
	int rv = 2;
	int ret = 0;

	type = EVP_MD_CTX_md(ctx);
	pkey = EVP_PKEY_CTX_get0_pkey(ctx->pctx);

	if (!type || !pkey) {
		ASN1error(ASN1_R_CONTEXT_NOT_INITIALISED);
		return 0;
	}

	if (pkey->ameth->item_sign) {
		rv = pkey->ameth->item_sign(ctx, it, asn, algor1, algor2,
		    signature);
		if (rv == 1)
			out_len = signature->length;
		/* Return value meanings:
		 * <=0: error.
		 *   1: method does everything.
		 *   2: carry on as normal.
		 *   3: ASN1 method sets algorithm identifiers: just sign.
		 */
		if (rv <= 0)
			ASN1error(ERR_R_EVP_LIB);
		if (rv <= 1)
			goto err;


	}

	if (rv == 2) {
		if (!pkey->ameth ||
		    !OBJ_find_sigid_by_algs(&signid, EVP_MD_nid(type),
		    pkey->ameth->pkey_id)) {
			ASN1error(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
			return 0;
282
283
284
285
286
287
288
289




290
291


292
293
294
295
296
297

298
299
300
301
302
303
304




305

306
307
308
309
310
311
312

313


314
315
316
317

318
319
320
321
322
323
324
325
			    OBJ_nid2obj(signid), paramtype, NULL);
		if (algor2)
			X509_ALGOR_set0(algor2,
			    OBJ_nid2obj(signid), paramtype, NULL);

	}

	inl = ASN1_item_i2d(asn, &buf_in, it);




	outll = outl = EVP_PKEY_size(pkey);
	buf_out = malloc(outl);


	if ((buf_in == NULL) || (buf_out == NULL)) {
		outl = 0;
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}


	if (!EVP_DigestSignUpdate(ctx, buf_in, inl) ||
	    !EVP_DigestSignFinal(ctx, buf_out, &outl)) {
		outl = 0;
		ASN1error(ERR_R_EVP_LIB);
		goto err;
	}
	free(signature->data);




	signature->data = buf_out;

	buf_out = NULL;
	signature->length = outl;
	/* In the interests of compatibility, I'll make sure that
	 * the bit string has a 'not-used bits' value of 0
	 */
	signature->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
	signature->flags |= ASN1_STRING_FLAG_BITS_LEFT;




 err:
	EVP_MD_CTX_cleanup(ctx);
	freezero((char *)buf_in, inl);
	freezero((char *)buf_out, outll);

	return (outl);
}

int
ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
    ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey)
{
	EVP_MD_CTX ctx;







|
>
>
>
>
|
|
>
>
|
|




>
|
|
<



|
>
>
>
>
|
>

|
<
<
<
|
|
>
|
>
>


|
|
>
|







283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307

308
309
310
311
312
313
314
315
316
317
318
319



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
			    OBJ_nid2obj(signid), paramtype, NULL);
		if (algor2)
			X509_ALGOR_set0(algor2,
			    OBJ_nid2obj(signid), paramtype, NULL);

	}

	if ((in_len = ASN1_item_i2d(asn, &buf_in, it)) <= 0) {
		in_len = 0;
		goto err;
	}

	if ((out_len = EVP_PKEY_size(pkey)) <= 0) {
		out_len = 0;
		goto err;
	}

	if ((buf_out = malloc(out_len)) == NULL) {
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	buf_out_len = out_len;
	if (!EVP_DigestSignUpdate(ctx, buf_in, in_len) ||
	    !EVP_DigestSignFinal(ctx, buf_out, &buf_out_len)) {

		ASN1error(ERR_R_EVP_LIB);
		goto err;
	}

	if (buf_out_len > INT_MAX) {
		ASN1error(ASN1_R_TOO_LONG);
		goto err;
	}

	ASN1_STRING_set0(signature, buf_out, (int)buf_out_len);
	buf_out = NULL;




	if (!asn1_abs_set_unused_bits(signature, 0)) {
		ASN1error(ERR_R_ASN1_LIB);
		goto err;
	}

	ret = (int)buf_out_len;
 err:
	EVP_MD_CTX_cleanup(ctx);
	freezero(buf_in, in_len);
	freezero(buf_out, out_len);

	return ret;
}

int
ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
    ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey)
{
	EVP_MD_CTX ctx;
Changes to jni/libressl/crypto/asn1/asn1_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_lib.c,v 1.52 2022/03/26 14:47:58 jsing Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_lib.c,v 1.54 2022/05/05 19:18:56 jsing Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 */

#include <limits.h>
#include <stdlib.h>

#include "bytestring.h"

static int
asn1_get_identifier_cbs(CBS *cbs, int der_mode, uint8_t *out_class,
    int *out_constructed, uint32_t *out_tag_number)
{
	uint8_t tag_class, tag_val;
	int tag_constructed;
	uint32_t tag_number;








|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 */

#include <limits.h>
#include <stdlib.h>

#include "bytestring.h"

int
asn1_get_identifier_cbs(CBS *cbs, int der_mode, uint8_t *out_class,
    int *out_constructed, uint32_t *out_tag_number)
{
	uint8_t tag_class, tag_val;
	int tag_constructed;
	uint32_t tag_number;

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	*out_class = tag_class;
	*out_constructed = tag_constructed;
	*out_tag_number = tag_number;

	return 1;
}

static int
asn1_get_length_cbs(CBS *cbs, int der_mode, int *out_indefinite,
    uint32_t *out_length)
{
	uint8_t len_bytes;
	uint32_t length;
	uint8_t val;

	/*
	 * Decode ASN.1 length octets - see ITU-T X.690 section 8.1.3.
	 */

	*out_length = 0;







|

|


|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	*out_class = tag_class;
	*out_constructed = tag_constructed;
	*out_tag_number = tag_number;

	return 1;
}

int
asn1_get_length_cbs(CBS *cbs, int der_mode, int *out_indefinite,
    size_t *out_length)
{
	uint8_t len_bytes;
	size_t length;
	uint8_t val;

	/*
	 * Decode ASN.1 length octets - see ITU-T X.690 section 8.1.3.
	 */

	*out_length = 0;
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
	length = 0;

	while (len_bytes-- > 0) {
		if (!CBS_get_u8(cbs, &val))
			return 0;
		if (der_mode && length == 0 && val == 0)
			return 0;
		if (length > (UINT32_MAX >> 8))
			return 0;
		length = (length << 8) | val;
	}

	*out_length = length;

	return 1;
}

int
asn1_get_object_cbs(CBS *cbs, int der_mode, uint8_t *out_tag_class,
    int *out_constructed, uint32_t *out_tag_number, int *out_indefinite,
    uint32_t *out_length)
{
	int constructed, indefinite;
	uint32_t tag_number, length;
	uint8_t tag_class;


	*out_tag_class = 0;
	*out_constructed = 0;
	*out_tag_number = 0;
	*out_indefinite = 0;
	*out_length = 0;








|












|


|

>







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
	length = 0;

	while (len_bytes-- > 0) {
		if (!CBS_get_u8(cbs, &val))
			return 0;
		if (der_mode && length == 0 && val == 0)
			return 0;
		if (length > (SIZE_MAX >> 8))
			return 0;
		length = (length << 8) | val;
	}

	*out_length = length;

	return 1;
}

int
asn1_get_object_cbs(CBS *cbs, int der_mode, uint8_t *out_tag_class,
    int *out_constructed, uint32_t *out_tag_number, int *out_indefinite,
    size_t *out_length)
{
	int constructed, indefinite;
	uint32_t tag_number;
	uint8_t tag_class;
	size_t length;

	*out_tag_class = 0;
	*out_constructed = 0;
	*out_tag_number = 0;
	*out_indefinite = 0;
	*out_length = 0;

172
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
}

int
asn1_get_primitive(CBS *cbs, int der_mode, uint32_t *out_tag_number,
    CBS *out_content)
{
	int constructed, indefinite;
	uint32_t tag_number, length;
	uint8_t tag_class;


	*out_tag_number = 0;

	CBS_init(out_content, NULL, 0);

	if (!asn1_get_identifier_cbs(cbs, der_mode, &tag_class, &constructed,
	    &tag_number))







|

>







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
}

int
asn1_get_primitive(CBS *cbs, int der_mode, uint32_t *out_tag_number,
    CBS *out_content)
{
	int constructed, indefinite;
	uint32_t tag_number;
	uint8_t tag_class;
	size_t length;

	*out_tag_number = 0;

	CBS_init(out_content, NULL, 0);

	if (!asn1_get_identifier_cbs(cbs, der_mode, &tag_class, &constructed,
	    &tag_number))
Changes to jni/libressl/crypto/asn1/asn1_locl.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_locl.h,v 1.24 2022/03/26 14:47:58 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_locl.h,v 1.39 2022/09/11 17:22:52 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
108
109
110
111
112
113
114

115
116
117
118
119
120
121
	int (*priv_decode)(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
	int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
	int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
	    ASN1_PCTX *pctx);

	int (*pkey_size)(const EVP_PKEY *pk);
	int (*pkey_bits)(const EVP_PKEY *pk);


	int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder,
	    int derlen);
	int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
	int (*param_missing)(const EVP_PKEY *pk);
	int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
	int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);







>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
	int (*priv_decode)(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
	int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
	int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
	    ASN1_PCTX *pctx);

	int (*pkey_size)(const EVP_PKEY *pk);
	int (*pkey_bits)(const EVP_PKEY *pk);
	int (*pkey_security_bits)(const EVP_PKEY *pk);

	int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder,
	    int derlen);
	int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
	int (*param_missing)(const EVP_PKEY *pk);
	int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
	int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
167
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195




196
197
198
199
200
201


202
203











204
205
206
207











208
ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);

const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr);

int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);

void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);

int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);
int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it);

int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length);

/*
 * Unicode codepoint constants
 */
#define	UNICODE_MAX		0x10FFFF
#define	UNICODE_SURROGATE_MIN	0x00D800
#define	UNICODE_SURROGATE_MAX	0x00DFFF

#define	UNICODE_IS_SURROGATE(x) \
	((x) >= UNICODE_SURROGATE_MIN && (x) <= UNICODE_SURROGATE_MAX)

int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
int UTF8_putc(unsigned char *str, int len, unsigned long value);

int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);





int asn1_get_object_cbs(CBS *cbs, int der_mode, uint8_t *out_class,
    int *out_constructed, uint32_t *out_tag_number, int *out_indefinite,
    uint32_t *out_length);
int asn1_get_primitive(CBS *cbs, int der_mode, uint32_t *out_tag_number,
    CBS *out_content);



int asn1_tag2charwidth(int tag);












int i2t_ASN1_OBJECT_internal(const ASN1_OBJECT *aobj, char *buf, int buf_len,
    int no_name);
ASN1_OBJECT *t2i_ASN1_OBJECT_internal(const char *oid);












__END_HIDDEN_DECLS







|
>

<



















>
>
>
>


|



>
>


>
>
>
>
>
>
>
>
>
>
>




>
>
>
>
>
>
>
>
>
>
>

168
169
170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);

const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr);

int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);

void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
void asn1_enc_cleanup(ASN1_VALUE **pval, const ASN1_ITEM *it);
int asn1_enc_save(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it);
int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);


int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length);

/*
 * Unicode codepoint constants
 */
#define	UNICODE_MAX		0x10FFFF
#define	UNICODE_SURROGATE_MIN	0x00D800
#define	UNICODE_SURROGATE_MAX	0x00DFFF

#define	UNICODE_IS_SURROGATE(x) \
	((x) >= UNICODE_SURROGATE_MIN && (x) <= UNICODE_SURROGATE_MAX)

int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
int UTF8_putc(unsigned char *str, int len, unsigned long value);

int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);

int asn1_get_identifier_cbs(CBS *cbs, int der_mode, uint8_t *out_class,
    int *out_constructed, uint32_t *out_tag_number);
int asn1_get_length_cbs(CBS *cbs, int der_mode, int *out_indefinite,
    size_t *out_length);
int asn1_get_object_cbs(CBS *cbs, int der_mode, uint8_t *out_class,
    int *out_constructed, uint32_t *out_tag_number, int *out_indefinite,
    size_t *out_length);
int asn1_get_primitive(CBS *cbs, int der_mode, uint32_t *out_tag_number,
    CBS *out_content);

int asn1_must_be_constructed(int tag);
int asn1_must_be_primitive(int tag);
int asn1_tag2charwidth(int tag);

int asn1_abs_set_unused_bits(ASN1_BIT_STRING *abs, uint8_t unused_bits);
int c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs);

int c2i_ASN1_ENUMERATED_cbs(ASN1_ENUMERATED **out_aenum, CBS *cbs);

int asn1_aint_get_uint64(CBS *cbs, uint64_t *out_val);
int asn1_aint_set_uint64(uint64_t val, uint8_t **out_data, int *out_len);
int asn1_aint_get_int64(CBS *cbs, int negative, int64_t *out_val);
int c2i_ASN1_INTEGER_cbs(ASN1_INTEGER **out_aint, CBS *cbs);

int c2i_ASN1_OBJECT_cbs(ASN1_OBJECT **out_aobj, CBS *content);
int i2t_ASN1_OBJECT_internal(const ASN1_OBJECT *aobj, char *buf, int buf_len,
    int no_name);
ASN1_OBJECT *t2i_ASN1_OBJECT_internal(const char *oid);

int asn1_time_parse_cbs(const CBS *cbs, int is_gentime, struct tm *out_tm);

ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
    long length);
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp);
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
    const unsigned char **pp, long length);
int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp);
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
    long length);

__END_HIDDEN_DECLS
Changes to jni/libressl/crypto/asn1/asn1_old_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_old_lib.c,v 1.3 2022/01/14 07:57:17 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1_old_lib.c,v 1.4 2022/05/05 19:18:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
static void asn1_put_length(unsigned char **pp, int length);

int
ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
    int *pclass, long omax)
{
	int constructed, indefinite;
	uint32_t tag_number, length;
	uint8_t tag_class;

	CBS cbs;
	int ret = 0;

	*pclass = 0;
	*ptag = 0;
	*plength = 0;








|

>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
static void asn1_put_length(unsigned char **pp, int length);

int
ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
    int *pclass, long omax)
{
	int constructed, indefinite;
	uint32_t tag_number;
	uint8_t tag_class;
	size_t length;
	CBS cbs;
	int ret = 0;

	*pclass = 0;
	*ptag = 0;
	*plength = 0;

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	}

	/*
	 * API insanity ahead... in this case we add an error to the stack and
	 * signal an error by setting the 8th bit in the return value... but we
	 * still provide all of the decoded data.
	 */
	if (length > CBS_len(&cbs)) {
		ASN1error(ASN1_R_TOO_LONG);
		ret = 0x80;
	}

	*pclass = tag_class << 6;
	*ptag = tag_number;
	*plength = length;







|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	}

	/*
	 * API insanity ahead... in this case we add an error to the stack and
	 * signal an error by setting the 8th bit in the return value... but we
	 * still provide all of the decoded data.
	 */
	if (length > CBS_len(&cbs) || length > LONG_MAX) {
		ASN1error(ASN1_R_TOO_LONG);
		ret = 0x80;
	}

	*pclass = tag_class << 6;
	*ptag = tag_number;
	*plength = length;
Changes to jni/libressl/crypto/asn1/asn1_types.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21



22
23
24
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

91
92
93
94
95
96

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

115
116
117
118
119
120

121
122
123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138

139
140
141
142
143
144
145
/* $OpenBSD: asn1_types.c,v 1.1 2021/12/14 17:35:21 jsing Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <stddef.h>

#include <openssl/asn1.h>




struct asn1_type {
	const char *name;
	uint32_t bit_value;
	int char_width;

};

/*
 * Universal class tag types - ITU X.680.
 */
static const struct asn1_type asn1_types[31] = {
	[0] = {
		/* Tag 0 (0x00) - Reserved for use by encoding rules */
		.name = "EOC",
		.bit_value = 0,
		.char_width = -1,
	},
	[1] = {
		/* Tag 1 (0x01) - Boolean */
		.name = "BOOLEAN",
		.bit_value = 0,
		.char_width = -1,

	},
	[2] = {
		/* Tag 2 (0x02) - Integer */
		.name = "INTEGER",
		.bit_value = 0,
		.char_width = -1,

	},
	[3] = {
		/* Tag 3 (0x03) - BitString */
		.name = "BIT STRING",
		.bit_value = B_ASN1_BIT_STRING,
		.char_width = -1,
	},
	[4] = {
		/* Tag 4 (0x04) - OctetString */
		.name = "OCTET STRING",
		.bit_value = B_ASN1_OCTET_STRING,
		.char_width = -1,
	},
	[5] = {
		/* Tag 5 (0x05) - Null */
		.name = "NULL",
		.bit_value = 0,
		.char_width = -1,

	},
	[6] = {
		/* Tag 6 (0x06) - Object Identifier */
		.name = "OBJECT",
		.bit_value = 0,
		.char_width = -1,

	},
	[7] = {
		/* Tag 7 (0x07) - Object Descriptor */
		.name = "OBJECT DESCRIPTOR",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[8] = {
		/* Tag 8 (0x08) - External */
		.name = "EXTERNAL",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[9] = {
		/* Tag 9 (0x09) - Real */
		.name = "REAL",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,

	},
	[10] = {
		/* Tag 10 (0x0a) - Enumerated */
		.name = "ENUMERATED",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,

	},
	[11] = {
		/* Tag 11 (0x0b) - Embedded PDV */
		.name = "<ASN1 11 EMBEDDED PDV>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[12] = {
		/* Tag 12 (0x0c) - UTF8String */
		.name = "UTF8STRING",
		.bit_value = B_ASN1_UTF8STRING,
		.char_width = 0,
	},
	[13] = {
		/* Tag 13 (0x0d) - Relative Object Identifier */
		.name = "<ASN1 13 RELATIVE OID>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,

	},
	[14] = {
		/* Tag 14 (0x0e) - Time */
		.name = "<ASN1 14 TIME>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,

	},
	[15] = {
		/* Tag 15 (0x0f) - Reserved */
		.name = "<ASN1 15 RESERVED>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[16] = {
		/* Tag 16 (0x10)- Sequence */
		.name = "SEQUENCE",
		.bit_value = B_ASN1_SEQUENCE,
		.char_width = -1,

	},
	[17] = {
		/* Tag 17 (0x11) - Set */
		.name = "SET",
		.bit_value = 0,
		.char_width = -1,

	},
	[18] = {
		/* Tag 18 (0x12) - NumericString */
		.name = "NUMERICSTRING",
		.bit_value = B_ASN1_NUMERICSTRING,
		.char_width = -1,
	},
|




















>
>
>




>

















>






>


















>






>


















>






>


















>






>












>






>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* $OpenBSD: asn1_types.c,v 1.2 2022/09/03 18:52:18 jsing Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <stddef.h>

#include <openssl/asn1.h>

#define ASN1_ENCODING_CONSTRUCTED_ONLY	1
#define ASN1_ENCODING_PRIMITIVE_ONLY	2

struct asn1_type {
	const char *name;
	uint32_t bit_value;
	int char_width;
	int encoding;
};

/*
 * Universal class tag types - ITU X.680.
 */
static const struct asn1_type asn1_types[31] = {
	[0] = {
		/* Tag 0 (0x00) - Reserved for use by encoding rules */
		.name = "EOC",
		.bit_value = 0,
		.char_width = -1,
	},
	[1] = {
		/* Tag 1 (0x01) - Boolean */
		.name = "BOOLEAN",
		.bit_value = 0,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[2] = {
		/* Tag 2 (0x02) - Integer */
		.name = "INTEGER",
		.bit_value = 0,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[3] = {
		/* Tag 3 (0x03) - BitString */
		.name = "BIT STRING",
		.bit_value = B_ASN1_BIT_STRING,
		.char_width = -1,
	},
	[4] = {
		/* Tag 4 (0x04) - OctetString */
		.name = "OCTET STRING",
		.bit_value = B_ASN1_OCTET_STRING,
		.char_width = -1,
	},
	[5] = {
		/* Tag 5 (0x05) - Null */
		.name = "NULL",
		.bit_value = 0,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[6] = {
		/* Tag 6 (0x06) - Object Identifier */
		.name = "OBJECT",
		.bit_value = 0,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[7] = {
		/* Tag 7 (0x07) - Object Descriptor */
		.name = "OBJECT DESCRIPTOR",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[8] = {
		/* Tag 8 (0x08) - External */
		.name = "EXTERNAL",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[9] = {
		/* Tag 9 (0x09) - Real */
		.name = "REAL",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[10] = {
		/* Tag 10 (0x0a) - Enumerated */
		.name = "ENUMERATED",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[11] = {
		/* Tag 11 (0x0b) - Embedded PDV */
		.name = "<ASN1 11 EMBEDDED PDV>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[12] = {
		/* Tag 12 (0x0c) - UTF8String */
		.name = "UTF8STRING",
		.bit_value = B_ASN1_UTF8STRING,
		.char_width = 0,
	},
	[13] = {
		/* Tag 13 (0x0d) - Relative Object Identifier */
		.name = "<ASN1 13 RELATIVE OID>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[14] = {
		/* Tag 14 (0x0e) - Time */
		.name = "<ASN1 14 TIME>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
		.encoding = ASN1_ENCODING_PRIMITIVE_ONLY,
	},
	[15] = {
		/* Tag 15 (0x0f) - Reserved */
		.name = "<ASN1 15 RESERVED>",
		.bit_value = B_ASN1_UNKNOWN,
		.char_width = -1,
	},
	[16] = {
		/* Tag 16 (0x10)- Sequence */
		.name = "SEQUENCE",
		.bit_value = B_ASN1_SEQUENCE,
		.char_width = -1,
		.encoding = ASN1_ENCODING_CONSTRUCTED_ONLY,
	},
	[17] = {
		/* Tag 17 (0x11) - Set */
		.name = "SET",
		.bit_value = 0,
		.char_width = -1,
		.encoding = ASN1_ENCODING_CONSTRUCTED_ONLY,
	},
	[18] = {
		/* Tag 18 (0x12) - NumericString */
		.name = "NUMERICSTRING",
		.bit_value = B_ASN1_NUMERICSTRING,
		.char_width = -1,
	},
221
222
223
224
225
226
227


























228
229
230
231
232
233
234
asn1_type_by_tag(int tag)
{
	if (tag < 0 || tag > 30)
		return NULL;

	return &asn1_types[tag];
}



























int
asn1_tag2charwidth(int tag)
{
	const struct asn1_type *at;

	if ((at = asn1_type_by_tag(tag)) != NULL)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
asn1_type_by_tag(int tag)
{
	if (tag < 0 || tag > 30)
		return NULL;

	return &asn1_types[tag];
}

int
asn1_must_be_constructed(int tag)
{
	const struct asn1_type *at;

	if (tag == V_ASN1_NEG_INTEGER || tag == V_ASN1_NEG_ENUMERATED)
		tag &= ~V_ASN1_NEG;
	if ((at = asn1_type_by_tag(tag)) != NULL)
		return at->encoding == ASN1_ENCODING_CONSTRUCTED_ONLY;

	return 0;
}

int
asn1_must_be_primitive(int tag)
{
	const struct asn1_type *at;

	if (tag == V_ASN1_NEG_INTEGER || tag == V_ASN1_NEG_ENUMERATED)
		tag &= ~V_ASN1_NEG;
	if ((at = asn1_type_by_tag(tag)) != NULL)
		return at->encoding == ASN1_ENCODING_PRIMITIVE_ONLY;

	return 0;
}

int
asn1_tag2charwidth(int tag)
{
	const struct asn1_type *at;

	if ((at = asn1_type_by_tag(tag)) != NULL)
Changes to jni/libressl/crypto/asn1/t_req.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: t_req.c,v 1.21 2021/12/25 13:17:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: t_req.c,v 1.23 2022/08/30 08:45:06 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
	unsigned long l;
	int i;
	const char *neg;
	X509_REQ_INFO *ri;
	EVP_PKEY *pkey;
	STACK_OF(X509_ATTRIBUTE) *sk;
	STACK_OF(X509_EXTENSION) *exts;
	char mlch = ' ';
	int nmindent = 0;

	if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
		mlch = '\n';
		nmindent = 12;
	}







|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
	unsigned long l;
	int i;
	const char *neg;
	X509_REQ_INFO *ri;
	EVP_PKEY *pkey;
	STACK_OF(X509_ATTRIBUTE) *sk;
	STACK_OF(X509_EXTENSION) *exts = NULL;
	char mlch = ' ';
	int nmindent = 0;

	if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
		mlch = '\n';
		nmindent = 12;
	}
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
			if (BIO_printf(bp, "%12sa0:00\n", "") <= 0)
				goto err;
		} else {
			for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) {
				ASN1_TYPE *at;
				X509_ATTRIBUTE *a;
				ASN1_BIT_STRING *bs = NULL;
				ASN1_TYPE *t;
				int j, type = 0, count = 1, ii = 0;

				a = sk_X509_ATTRIBUTE_value(sk, i);
				if (X509_REQ_extension_nid(
				    OBJ_obj2nid(a->object)))
					continue;
				if (BIO_printf(bp, "%12s", "") <= 0)
					goto err;
				if ((j = i2a_ASN1_OBJECT(bp, a->object)) > 0) {
					if (a->single) {
						t = a->value.single;
						type = t->type;
						bs = t->value.bit_string;
					} else {
						ii = 0;
						count = sk_ASN1_TYPE_num(
						    a->value.set);
 get_next:
						at = sk_ASN1_TYPE_value(
						    a->value.set, ii);
						type = at->type;
						bs = at->value.asn1_string;
					}
				}
				for (j = 25 - j; j > 0; j--)
					if (BIO_write(bp, " ", 1) != 1)
						goto err;
				if (BIO_puts(bp, ":") <= 0)
					goto err;
				if ((type == V_ASN1_PRINTABLESTRING) ||







<









<
<
<
<
<
|
|
<

|
<
|
|
<







172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187





188
189

190
191

192
193

194
195
196
197
198
199
200
			if (BIO_printf(bp, "%12sa0:00\n", "") <= 0)
				goto err;
		} else {
			for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) {
				ASN1_TYPE *at;
				X509_ATTRIBUTE *a;
				ASN1_BIT_STRING *bs = NULL;

				int j, type = 0, count = 1, ii = 0;

				a = sk_X509_ATTRIBUTE_value(sk, i);
				if (X509_REQ_extension_nid(
				    OBJ_obj2nid(a->object)))
					continue;
				if (BIO_printf(bp, "%12s", "") <= 0)
					goto err;
				if ((j = i2a_ASN1_OBJECT(bp, a->object)) > 0) {





					ii = 0;
					count = sk_ASN1_TYPE_num(a->set);

 get_next:
					at = sk_ASN1_TYPE_value(a->set, ii);

					type = at->type;
					bs = at->value.asn1_string;

				}
				for (j = 25 - j; j > 0; j--)
					if (BIO_write(bp, " ", 1) != 1)
						goto err;
				if (BIO_puts(bp, ":") <= 0)
					goto err;
				if ((type == V_ASN1_PRINTABLESTRING) ||
243
244
245
246
247
248
249

250
251
252
253
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268
269
					BIO_printf(bp, "%16s", "");
					ASN1_STRING_print(bp, ex->value);
				}
				if (BIO_write(bp, "\n", 1) <= 0)
					goto err;
			}
			sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);

		}
	}

	if (!(cflag & X509_FLAG_NO_SIGDUMP)) {
		if (!X509_signature_print(bp, x->sig_alg, x->signature))
			goto err;
	}

	return (1);

 err:

	X509error(ERR_R_BUF_LIB);
	return (0);
}

int
X509_REQ_print(BIO *bp, X509_REQ *x)
{
	return X509_REQ_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
}







>











>









234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
					BIO_printf(bp, "%16s", "");
					ASN1_STRING_print(bp, ex->value);
				}
				if (BIO_write(bp, "\n", 1) <= 0)
					goto err;
			}
			sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
			exts = NULL;
		}
	}

	if (!(cflag & X509_FLAG_NO_SIGDUMP)) {
		if (!X509_signature_print(bp, x->sig_alg, x->signature))
			goto err;
	}

	return (1);

 err:
	sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
	X509error(ERR_R_BUF_LIB);
	return (0);
}

int
X509_REQ_print(BIO *bp, X509_REQ *x)
{
	return X509_REQ_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
}
Changes to jni/libressl/crypto/asn1/t_x509.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: t_x509.c,v 1.37 2021/12/25 13:17:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: t_x509.c,v 1.40 2022/08/11 10:36:32 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139

140
141
142





143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161


162
163

164
165
166
167
168
169
170
	long l;
	int ret = 0, i;
	char *m = NULL, mlch = ' ';
	int nmindent = 0;
	X509_CINF *ci;
	ASN1_INTEGER *bs;
	EVP_PKEY *pkey = NULL;
	const char *neg;

	if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
		mlch = '\n';
		nmindent = 12;
	}

	if (nmflags == X509_FLAG_COMPAT)
		nmindent = 16;

	ci = x->cert_info;
	if (!(cflag & X509_FLAG_NO_HEADER)) {
		if (BIO_write(bp, "Certificate:\n", 13) <= 0)
			goto err;
		if (BIO_write(bp, "    Data:\n", 10) <= 0)
			goto err;
	}
	if (!(cflag & X509_FLAG_NO_VERSION)) {
		l = X509_get_version(x);

		if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n",
		    "", l + 1, l) <= 0)
			goto err;





	}
	if (!(cflag & X509_FLAG_NO_SERIAL)) {
		if (BIO_write(bp, "        Serial Number:", 22) <= 0)
			goto err;

		bs = X509_get_serialNumber(x);
		l = -1;
		if (bs->length <= (int)sizeof(long))
			l = ASN1_INTEGER_get(bs);
		if (l != -1) {
			if (bs->type == V_ASN1_NEG_INTEGER) {
				l = -l;
				neg = "-";
			} else
				neg = "";
			if (BIO_printf(bp, " %s%lu (%s0x%lx)\n",
			    neg, l, neg, l) <= 0)
				goto err;
		} else {


			neg = (bs->type == V_ASN1_NEG_INTEGER) ?
			    " (Negative)" : "";

			if (BIO_printf(bp, "\n%12s%s", "", neg) <= 0)
				goto err;
			for (i = 0; i < bs->length; i++) {
				if (BIO_printf(bp, "%02x%c", bs->data[i],
				    ((i + 1 == bs->length) ? '\n' : ':')) <= 0)
					goto err;
			}







<


















>
|
|
|
>
>
>
>
>









|
<
<
<
<
<
|
<


>
>
|
|
>







114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157





158

159
160
161
162
163
164
165
166
167
168
169
170
171
172
	long l;
	int ret = 0, i;
	char *m = NULL, mlch = ' ';
	int nmindent = 0;
	X509_CINF *ci;
	ASN1_INTEGER *bs;
	EVP_PKEY *pkey = NULL;


	if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
		mlch = '\n';
		nmindent = 12;
	}

	if (nmflags == X509_FLAG_COMPAT)
		nmindent = 16;

	ci = x->cert_info;
	if (!(cflag & X509_FLAG_NO_HEADER)) {
		if (BIO_write(bp, "Certificate:\n", 13) <= 0)
			goto err;
		if (BIO_write(bp, "    Data:\n", 10) <= 0)
			goto err;
	}
	if (!(cflag & X509_FLAG_NO_VERSION)) {
		l = X509_get_version(x);
		if (l >= 0 && l <= 2) {
			if (BIO_printf(bp, "%8sVersion: %ld (0x%lx)\n",
			    "", l + 1, l) <= 0)
				goto err;
		} else {
			if (BIO_printf(bp, "%8sVersion: unknown (%ld)\n",
			    "", l) <= 0)
				goto err;
		}
	}
	if (!(cflag & X509_FLAG_NO_SERIAL)) {
		if (BIO_write(bp, "        Serial Number:", 22) <= 0)
			goto err;

		bs = X509_get_serialNumber(x);
		l = -1;
		if (bs->length <= (int)sizeof(long))
			l = ASN1_INTEGER_get(bs);
		if (l >= 0) {





			if (BIO_printf(bp, " %ld (0x%lx)\n", l, l) <= 0)

				goto err;
		} else {
			const char *neg = "";

			if (bs->type == V_ASN1_NEG_INTEGER)
				neg = " (Negative)";

			if (BIO_printf(bp, "\n%12s%s", "", neg) <= 0)
				goto err;
			for (i = 0; i < bs->length; i++) {
				if (BIO_printf(bp, "%02x%c", bs->data[i],
				    ((i + 1 == bs->length) ? '\n' : ':')) <= 0)
					goto err;
			}
464
465
466
467
468
469
470

471
472
473
474
475
476
477
478
479
480
	return (0);
}

int
X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
{
	char *s, *c, *b;

	int ret = 0, l, i;

	l = 80 - 2 - obase;

	b = X509_NAME_oneline(name, NULL, 0);
	if (b == NULL)
		return 0;
	if (*b == '\0') {
		free(b);
		return 1;







>
|
<
<







466
467
468
469
470
471
472
473
474


475
476
477
478
479
480
481
	return (0);
}

int
X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
{
	char *s, *c, *b;
	int i;
	int ret = 0;



	b = X509_NAME_oneline(name, NULL, 0);
	if (b == NULL)
		return 0;
	if (*b == '\0') {
		free(b);
		return 1;
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
			if (BIO_write(bp, c, i) != i)
				goto err;
			c = s + 1;	/* skip following slash */
			if (*s != '\0') {
				if (BIO_write(bp, ", ", 2) != 2)
					goto err;
			}
			l--;
		}
		if (*s == '\0')
			break;
		s++;
		l--;
	}

	ret = 1;
	if (0) {
 err:
		X509error(ERR_R_BUF_LIB);
	}
	free(b);
	return (ret);
}







<




<










492
493
494
495
496
497
498

499
500
501
502

503
504
505
506
507
508
509
510
511
512
			if (BIO_write(bp, c, i) != i)
				goto err;
			c = s + 1;	/* skip following slash */
			if (*s != '\0') {
				if (BIO_write(bp, ", ", 2) != 2)
					goto err;
			}

		}
		if (*s == '\0')
			break;
		s++;

	}

	ret = 1;
	if (0) {
 err:
		X509error(ERR_R_BUF_LIB);
	}
	free(b);
	return (ret);
}
Changes to jni/libressl/crypto/asn1/tasn_dec.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_dec.c,v 1.49 2022/03/13 14:58:14 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_dec.c,v 1.83 2022/09/03 19:15:23 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

130

131
132
133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218

219
220

221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309

310
311
312

313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373

374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391

392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448




449

450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504

505
506
507
508
509
510
511
512

513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541

542
543
544
545
546
547
548
549
550
551
552

553
554
555
556
557

558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580

581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600

601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651

652


653
654

655
656


657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776

777
778
779

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837

838
839
840
841
842
843
844
845



846
847
848
849





850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887







888
889



890
891
892
893




894


895


















896







897
898

899

900
901
902

903
904





905



906







907























908





















































909
910
911
912


913


914



















915
916


917





918
919
















920

921
922
923
924



925



926
927

928



929














930



931

932







933

934
935
936
937
938


939




940

941
942
943
944

945
946



947



948









949
950


951


952








953




954




955




956











957



958



959



960






961




962


963

964


965
966




967
968
969
970















971

972


973

974

975
976

977
978
979





980









981




982








983
984
985



986



987
988
989
990
991
992
993
994
995

996
997
998
999


1000


1001


1002

1003









1004








1005



1006
1007
1008


1009
1010



1011


1012






1013


1014



1015
1016
1017




1018


1019

1020


1021



1022



1023

1024


1025
1026




1027
1028

1029








1030

1031
1032
1033
1034
1035


1036
1037

1038
1039


1040


1041
1042




1043


1044



1045
1046



















1047



1048



1049



1050




1051

1052

1053


1054

1055
1056
1057








1058
1059



1060


1061









1062
1063

1064

1065


1066


1067
1068

1069



1070
1071


1072


1073





1074







1075


1076



1077
1078







1079






1080
1081



1082
1083
1084
1085
1086



1087

1088
1089



1090


1091
1092
1093
1094
1095
1096



1097


1098






1099
1100
1101
1102



1103


1104




1105
1106








1107

1108





1109

























1110
1111
1112
1113



1114
1115





1116

1117

1118

1119


1120
1121
1122






1123


1124

1125



1126




1127

1128




1129



1130






1131
1132

1133
1134


1135
1136


1137
1138





1139


1140


1141

1142
1143
#include <openssl/buffer.h>
#include <openssl/err.h>
#include <openssl/objects.h>

#include "asn1_locl.h"
#include "bytestring.h"


/* Constructed types with a recursive definition (such as can be found in PKCS7)
 * could eventually exceed the stack given malicious input with excessive
 * recursion. Therefore we limit the stack depth.
 */
#define ASN1_MAX_CONSTRUCTED_NEST 30

static int asn1_check_eoc(const unsigned char **in, long len);
static int asn1_find_end(const unsigned char **in, long len, char inf);

static int asn1_collect(CBB *cbb, const unsigned char **in, long len,
    char inf, int tag, int aclass, int depth);

static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
    char *inf, char *cst, const unsigned char **in, long len, int exptag,
    int expclass, char opt, ASN1_TLC *ctx);

static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
    long len, const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx,
    int depth);
static int asn1_template_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
    long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx, int depth);
static int asn1_template_noexp_d2i(ASN1_VALUE **val, const unsigned char **in,
    long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx, int depth);
static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in,
    long len, const ASN1_ITEM *it, int tag, int aclass, char opt,
    ASN1_TLC *ctx);
static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *content, int len,
    int utype, const ASN1_ITEM *it);

static void
asn1_tlc_invalidate(ASN1_TLC *ctx)
{
	if (ctx != NULL)
		ctx->valid = 0;
}

ASN1_VALUE *
ASN1_item_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
    const ASN1_ITEM *it)
{
	ASN1_VALUE *ptmpval = NULL;
	ASN1_TLC ctx;

	asn1_tlc_invalidate(&ctx);

	if (pval == NULL)
		pval = &ptmpval;
	if (asn1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &ctx, 0) <= 0)
		return NULL;

	return *pval;
}

int
ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
    const ASN1_TEMPLATE *tt)
{
	ASN1_TLC ctx;



	asn1_tlc_invalidate(&ctx);

	return asn1_template_ex_d2i(pval, in, len, tt, 0, &ctx, 0);
}


/* Decode an item, taking care of IMPLICIT tagging, if any.
 * If 'opt' set and tag mismatch return -1 to handle OPTIONAL
 */

static int
asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
    const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx,
    int depth)
{
	const ASN1_TEMPLATE *tt, *errtt = NULL;
	const ASN1_EXTERN_FUNCS *ef;
	const ASN1_AUX *aux = it->funcs;
	ASN1_aux_cb *asn1_cb = NULL;
	const unsigned char *p = NULL, *q;
	unsigned char oclass;
	char seq_eoc, seq_nolen, cst, isopt;
	long tmplen;
	int i;
	int otag;
	int ret = 0;
	ASN1_VALUE **pchptr;
	int combine;

	combine = aclass & ASN1_TFLG_COMBINE;
	aclass &= ~ASN1_TFLG_COMBINE;

	if (!pval)
		return 0;

	if (aux && aux->asn1_cb)
		asn1_cb = aux->asn1_cb;

	if (++depth > ASN1_MAX_CONSTRUCTED_NEST) {
		ASN1error(ASN1_R_NESTED_TOO_DEEP);
		goto err;
	}

	switch (it->itype) {
	case ASN1_ITYPE_PRIMITIVE:
		if (it->templates) {
			/* tagging or OPTIONAL is currently illegal on an item
			 * template because the flags can't get passed down.
			 * In practice this isn't a problem: we include the
			 * relevant flags from the item template in the
			 * template itself.
			 */
			if ((tag != -1) || opt) {
				ASN1error(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
				goto err;
			}
			return asn1_template_ex_d2i(pval, in, len,
			    it->templates, opt, ctx, depth);
		}
		return asn1_d2i_ex_primitive(pval, in, len, it,
		    tag, aclass, opt, ctx);
		break;

	case ASN1_ITYPE_MSTRING:
		/*
		 * It never makes sense for multi-strings to have implicit
		 * tagging, so if tag != -1, then this looks like an error in
		 * the template.
		 */
		if (tag != -1) {
			ASN1error(ASN1_R_BAD_TEMPLATE);
			goto err;
		}

		p = *in;
		/* Just read in tag and class */
		ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
		    &p, len, -1, 0, 1, ctx);
		if (!ret) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		}

		/* Must be UNIVERSAL class */
		if (oclass != V_ASN1_UNIVERSAL) {
			/* If OPTIONAL, assume this is OK */
			if (opt)
				return -1;
			ASN1error(ASN1_R_MSTRING_NOT_UNIVERSAL);

			goto err;
		}

		/* Check tag matches bit map */
		if (!(ASN1_tag2bit(otag) & it->utype)) {
			/* If OPTIONAL, assume this is OK */
			if (opt)
				return -1;
			ASN1error(ASN1_R_MSTRING_WRONG_TAG);
			goto err;
		}
		return asn1_d2i_ex_primitive(pval, in, len,
		    it, otag, 0, 0, ctx);

	case ASN1_ITYPE_EXTERN:
		/* Use new style d2i */
		ef = it->funcs;
		return ef->asn1_ex_d2i(pval, in, len,
		    it, tag, aclass, opt, ctx);

	case ASN1_ITYPE_CHOICE:
		/*
		 * It never makes sense for CHOICE types to have implicit
		 * tagging, so if tag != -1, then this looks like an error in
		 * the template.
		 */
		if (tag != -1) {
			ASN1error(ASN1_R_BAD_TEMPLATE);
			goto err;
		}

		if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
			goto auxerr;

		if (*pval) {
			/* Free up and zero CHOICE value if initialised */
			i = asn1_get_choice_selector(pval, it);
			if ((i >= 0) && (i < it->tcount)) {
				tt = it->templates + i;
				pchptr = asn1_get_field_ptr(pval, tt);
				ASN1_template_free(pchptr, tt);
				asn1_set_choice_selector(pval, -1, it);
			}
		} else if (!ASN1_item_ex_new(pval, it)) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		}
		/* CHOICE type, try each possibility in turn */
		p = *in;
		for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
			pchptr = asn1_get_field_ptr(pval, tt);
			/* We mark field as OPTIONAL so its absence
			 * can be recognised.
			 */
			ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx,
				depth);
			/* If field not present, try the next one */
			if (ret == -1)
				continue;
			/* If positive return, read OK, break loop */
			if (ret > 0)
				break;
			/* Otherwise must be an ASN1 parsing error */
			errtt = tt;
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		}

		/* Did we fall off the end without reading anything? */
		if (i == it->tcount) {
			/* If OPTIONAL, this is OK */
			if (opt) {
				/* Free and zero it */
				ASN1_item_ex_free(pval, it);
				return -1;
			}
			ASN1error(ASN1_R_NO_MATCHING_CHOICE_TYPE);
			goto err;
		}

		asn1_set_choice_selector(pval, i, it);
		*in = p;
		if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
			goto auxerr;
		return 1;

	case ASN1_ITYPE_NDEF_SEQUENCE:
	case ASN1_ITYPE_SEQUENCE:
		p = *in;
		tmplen = len;

		/* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */

		if (tag == -1) {
			tag = V_ASN1_SEQUENCE;
			aclass = V_ASN1_UNIVERSAL;

		}
		/* Get SEQUENCE length and update len, p */
		ret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst,
		    &p, len, tag, aclass, opt, ctx);
		if (!ret) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		} else if (ret == -1)
			return -1;
		if (aux && (aux->flags & ASN1_AFLG_BROKEN)) {
			len = tmplen - (p - *in);
			seq_nolen = 1;
		}
		/* If indefinite we don't do a length check */
		else
			seq_nolen = seq_eoc;
		if (!cst) {
			ASN1error(ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
			goto err;
		}

		if (!*pval && !ASN1_item_ex_new(pval, it)) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		}

		if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
			goto auxerr;

		/* Free up and zero any ADB found */
		for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
			if (tt->flags & ASN1_TFLG_ADB_MASK) {
				const ASN1_TEMPLATE *seqtt;
				ASN1_VALUE **pseqval;
				seqtt = asn1_do_adb(pval, tt, 1);
				if (!seqtt)
					goto err;
				pseqval = asn1_get_field_ptr(pval, seqtt);
				ASN1_template_free(pseqval, seqtt);
			}
		}

		/* Get each field entry */
		for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
			const ASN1_TEMPLATE *seqtt;
			ASN1_VALUE **pseqval;
			seqtt = asn1_do_adb(pval, tt, 1);
			if (!seqtt)
				goto err;
			pseqval = asn1_get_field_ptr(pval, seqtt);
			/* Have we ran out of data? */
			if (!len)
				break;
			q = p;
			if (asn1_check_eoc(&p, len)) {
				if (!seq_eoc) {
					ASN1error(ASN1_R_UNEXPECTED_EOC);
					goto err;
				}
				len -= p - q;
				seq_eoc = 0;

				q = p;
				break;
			}
			/* This determines the OPTIONAL flag value. The field
			 * cannot be omitted if it is the last of a SEQUENCE
			 * and there is still data to be read. This isn't
			 * strictly necessary but it increases efficiency in
			 * some cases.
			 */
			if (i == (it->tcount - 1))
				isopt = 0;
			else
				isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);
			/* attempt to read in field, allowing each to be
			 * OPTIONAL */

			ret = asn1_template_ex_d2i(pseqval, &p, len,
			    seqtt, isopt, ctx, depth);

			if (!ret) {
				errtt = seqtt;
				goto err;
			} else if (ret == -1) {
				/* OPTIONAL component absent.
				 * Free and zero the field.
				 */
				ASN1_template_free(pseqval, seqtt);
				continue;
			}
			/* Update length */
			len -= p - q;
		}

		/* Check for EOC if expecting one */
		if (seq_eoc && !asn1_check_eoc(&p, len)) {
			ASN1error(ASN1_R_MISSING_EOC);
			goto err;
		}
		/* Check all data read */
		if (!seq_nolen && len) {
			ASN1error(ASN1_R_SEQUENCE_LENGTH_MISMATCH);
			goto err;
		}

		/* If we get here we've got no more data in the SEQUENCE,
		 * however we may not have read all fields so check all
		 * remaining are OPTIONAL and clear any that are.
		 */
		for (; i < it->tcount; tt++, i++) {
			const ASN1_TEMPLATE *seqtt;
			seqtt = asn1_do_adb(pval, tt, 1);
			if (!seqtt)
				goto err;
			if (seqtt->flags & ASN1_TFLG_OPTIONAL) {
				ASN1_VALUE **pseqval;
				pseqval = asn1_get_field_ptr(pval, seqtt);
				ASN1_template_free(pseqval, seqtt);
			} else {
				errtt = seqtt;
				ASN1error(ASN1_R_FIELD_MISSING);
				goto err;
			}
		}
		/* Save encoding */
		if (!asn1_enc_save(pval, *in, p - *in, it)) {
			ASN1error(ERR_R_MALLOC_FAILURE);
			goto auxerr;
		}
		*in = p;
		if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
			goto auxerr;
		return 1;

	default:
		return 0;
	}






 auxerr:
	ASN1error(ASN1_R_AUX_ERROR);
 err:
	if (combine == 0)
		ASN1_item_ex_free(pval, it);
	if (errtt)
		ERR_asprintf_error_data("Field=%s, Type=%s", errtt->field_name,
		    it->sname);
	else
		ERR_asprintf_error_data("Type=%s", it->sname);
	return 0;
}

int
ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
    const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx)
{
	return asn1_item_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0);
}

/* Templates are handled with two separate functions.
 * One handles any EXPLICIT tag and the other handles the rest.
 */

static int
asn1_template_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long inlen,
    const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx, int depth)
{
	int flags, aclass;
	int ret;
	long len;
	const unsigned char *p, *q;
	char exp_eoc;

	if (!val)
		return 0;
	flags = tt->flags;
	aclass = flags & ASN1_TFLG_TAG_CLASS;

	p = *in;

	/* Check if EXPLICIT tag expected */
	if (flags & ASN1_TFLG_EXPTAG) {
		char cst;
		/* Need to work out amount of data available to the inner
		 * content and where it starts: so read in EXPLICIT header to
		 * get the info.
		 */
		ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst,
		    &p, inlen, tt->tag, aclass, opt, ctx);
		q = p;
		if (!ret) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;
		} else if (ret == -1)

			return -1;
		if (!cst) {
			ASN1error(ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
			return 0;
		}
		/* We've found the field so it can't be OPTIONAL now */
		ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx, depth);
		if (!ret) {

			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;
		}
		/* We read the field in OK so update length */
		len -= p - q;
		if (exp_eoc) {
			/* If NDEF we must have an EOC here */
			if (!asn1_check_eoc(&p, len)) {
				ASN1error(ASN1_R_MISSING_EOC);
				goto err;
			}
		} else {
			/* Otherwise we must hit the EXPLICIT tag end or its
			 * an error */
			if (len) {
				ASN1error(ASN1_R_EXPLICIT_LENGTH_MISMATCH);
				goto err;
			}
		}
	} else
		return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx,
			depth);

	*in = p;
	return 1;

 err:
	ASN1_template_free(val, tt);
	return 0;

}

static int
asn1_template_noexp_d2i(ASN1_VALUE **val, const unsigned char **in, long len,
    const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx, int depth)
{
	int flags, aclass;
	int ret;
	const unsigned char *p, *q;

	if (!val)

		return 0;
	flags = tt->flags;
	aclass = flags & ASN1_TFLG_TAG_CLASS;

	p = *in;

	q = p;

	if (flags & ASN1_TFLG_SK_MASK) {
		/* SET OF, SEQUENCE OF */
		int sktag, skaclass;
		char sk_eoc;
		/* First work out expected inner tag value */
		if (flags & ASN1_TFLG_IMPTAG) {
			sktag = tt->tag;
			skaclass = aclass;
		} else {
			skaclass = V_ASN1_UNIVERSAL;
			if (flags & ASN1_TFLG_SET_OF)
				sktag = V_ASN1_SET;
			else
				sktag = V_ASN1_SEQUENCE;
		}
		/* Get the tag */
		ret = asn1_check_tlen(&len, NULL, NULL, &sk_eoc, NULL,
		    &p, len, sktag, skaclass, opt, ctx);
		if (!ret) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;

		} else if (ret == -1)
			return -1;
		if (!*val)
			*val = (ASN1_VALUE *)sk_new_null();
		else {
			/* We've got a valid STACK: free up any items present */
			STACK_OF(ASN1_VALUE) *sktmp =
			    (STACK_OF(ASN1_VALUE) *)*val;
			ASN1_VALUE *vtmp;
			while (sk_ASN1_VALUE_num(sktmp) > 0) {
				vtmp = sk_ASN1_VALUE_pop(sktmp);
				ASN1_item_ex_free(&vtmp,
				    tt->item);
			}
		}

		if (!*val) {
			ASN1error(ERR_R_MALLOC_FAILURE);
			goto err;
		}


		/* Read as many items as we can */
		while (len > 0) {
			ASN1_VALUE *skfield;
			q = p;
			/* See if EOC found */
			if (asn1_check_eoc(&p, len)) {
				if (!sk_eoc) {
					ASN1error(ASN1_R_UNEXPECTED_EOC);
					goto err;
				}
				len -= p - q;
				sk_eoc = 0;
				break;
			}
			skfield = NULL;
			if (!asn1_item_ex_d2i(&skfield, &p, len,
			    tt->item, -1, 0, 0, ctx, depth)) {
				ASN1error(ERR_R_NESTED_ASN1_ERROR);
				goto err;
			}
			len -= p - q;
			if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val,
			    skfield)) {
				ASN1error(ERR_R_MALLOC_FAILURE);
				goto err;
			}
		}
		if (sk_eoc) {
			ASN1error(ASN1_R_MISSING_EOC);
			goto err;
		}
	} else if (flags & ASN1_TFLG_IMPTAG) {
		/* IMPLICIT tagging */
		ret = asn1_item_ex_d2i(val, &p, len,
		    tt->item, tt->tag, aclass, opt, ctx, depth);
		if (!ret) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		} else if (ret == -1)
			return -1;
	} else {
		/* Nothing special */
		ret = asn1_item_ex_d2i(val, &p, len, tt->item,
		    -1, tt->flags & ASN1_TFLG_COMBINE, opt, ctx, depth);
		if (!ret) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		} else if (ret == -1)
			return -1;
	}




	*in = p;
	return 1;


 err:


	ASN1_template_free(val, tt);
	return 0;
}

static int
asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in, long inlen,
    const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx)
{
	int ret = 0, utype;
	long plen;
	char cst, inf;
	const unsigned char *p;
	const unsigned char *content = NULL;
	uint8_t *data = NULL;
	size_t data_len = 0;
	CBB cbb;
	long len;

	memset(&cbb, 0, sizeof(cbb));

	if (!pval) {
		ASN1error(ASN1_R_ILLEGAL_NULL);
		return 0; /* Should never happen */
	}

	if (it->itype == ASN1_ITYPE_MSTRING) {
		utype = tag;
		tag = -1;
	} else
		utype = it->utype;

	if (utype == V_ASN1_ANY) {
		/* If type is ANY need to figure out type from tag */
		unsigned char oclass;
		if (tag >= 0) {
			ASN1error(ASN1_R_ILLEGAL_TAGGED_ANY);
			return 0;
		}
		if (opt) {
			ASN1error(ASN1_R_ILLEGAL_OPTIONAL_ANY);
			return 0;
		}
		p = *in;
		ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL,
		    &p, inlen, -1, 0, 0, ctx);
		if (!ret) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;
		}
		if (oclass != V_ASN1_UNIVERSAL)
			utype = V_ASN1_OTHER;
	}
	if (tag == -1) {
		tag = utype;
		aclass = V_ASN1_UNIVERSAL;
	}
	p = *in;
	/* Check header */
	ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst,
	    &p, inlen, tag, aclass, opt, ctx);
	if (!ret) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		return 0;
	} else if (ret == -1)
		return -1;
	ret = 0;
	/* SEQUENCE, SET and "OTHER" are left in encoded form */
	if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
	    (utype == V_ASN1_OTHER)) {
		/* Clear context cache for type OTHER because the auto clear
		 * when we have a exact match wont work
		 */
		if (utype == V_ASN1_OTHER) {
			asn1_tlc_invalidate(ctx);
		} else if (!cst) {
			/* SEQUENCE and SET must be constructed */
			ASN1error(ASN1_R_TYPE_NOT_CONSTRUCTED);
			return 0;
		}

		content = *in;
		/* If indefinite length constructed find the real end */
		if (inf) {
			if (!asn1_find_end(&p, plen, inf))
				goto err;
			len = p - content;
		} else {
			len = p - content + plen;
			p += plen;
		}
	} else if (cst) {
		/*
		 * Should really check the internal tags are correct but
		 * some things may get this wrong. The relevant specs
		 * say that constructed string types should be OCTET STRINGs
		 * internally irrespective of the type. So instead just check
		 * for UNIVERSAL class and ignore the tag.
		 */
		if (!CBB_init(&cbb, 0))
			goto err;
		if (!asn1_collect(&cbb, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0))
			goto err;
		if (!CBB_finish(&cbb, &data, &data_len))
			goto err;

		if (data_len > LONG_MAX)
			goto err;

		content = data;
		len = data_len;
	} else {
		content = p;
		len = plen;
		p += plen;
	}

	/* We now have content length and type: translate into a structure */
	if (!asn1_ex_c2i(pval, content, len, utype, it))
		goto err;


	*in = p;
	ret = 1;


 err:
	CBB_cleanup(&cbb);
	freezero(data, data_len);

	return ret;
}

/* Translate ASN1 content octets into a structure */

static int
asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *content, int len, int utype,
    const ASN1_ITEM *it)
{
	ASN1_VALUE **opval = NULL;
	ASN1_STRING *stmp;
	ASN1_TYPE *typ = NULL;
	ASN1_INTEGER **tint;
	int ret = 0;

	if (it->funcs != NULL) {
		const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
		char free_content = 0;

		if (pf->prim_c2i == NULL)
			return 0;
		return pf->prim_c2i(pval, content, len, utype, &free_content, it);
	}

	/* If ANY type clear type and set pointer to internal value */
	if (it->utype == V_ASN1_ANY) {
		if (!*pval) {
			typ = ASN1_TYPE_new();
			if (typ == NULL)
				goto err;
			*pval = (ASN1_VALUE *)typ;
		} else
			typ = (ASN1_TYPE *)*pval;

		if (utype != typ->type)
			ASN1_TYPE_set(typ, utype, NULL);
		opval = pval;
		pval = &typ->value.asn1_value;
	}
	switch (utype) {
	case V_ASN1_OBJECT:
		if (!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &content, len))
			goto err;
		break;

	case V_ASN1_NULL:
		if (len) {
			ASN1error(ASN1_R_NULL_IS_WRONG_LENGTH);
			goto err;
		}
		*pval = (ASN1_VALUE *)1;
		break;

	case V_ASN1_BOOLEAN:

		if (len != 1) {
			ASN1error(ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
			goto err;
		} else {
			ASN1_BOOLEAN *tbool;
			tbool = (ASN1_BOOLEAN *)pval;
			*tbool = *content;
		}



		break;

	case V_ASN1_BIT_STRING:
		if (!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &content, len))





			goto err;
		break;

	case V_ASN1_INTEGER:
	case V_ASN1_ENUMERATED:
		tint = (ASN1_INTEGER **)pval;
		if (!c2i_ASN1_INTEGER(tint, &content, len))
			goto err;
		/* Fixup type to match the expected form */
		(*tint)->type = utype | ((*tint)->type & V_ASN1_NEG);
		break;

	case V_ASN1_OCTET_STRING:
	case V_ASN1_NUMERICSTRING:
	case V_ASN1_PRINTABLESTRING:
	case V_ASN1_T61STRING:
	case V_ASN1_VIDEOTEXSTRING:
	case V_ASN1_IA5STRING:
	case V_ASN1_UTCTIME:
	case V_ASN1_GENERALIZEDTIME:
	case V_ASN1_GRAPHICSTRING:
	case V_ASN1_VISIBLESTRING:
	case V_ASN1_GENERALSTRING:
	case V_ASN1_UNIVERSALSTRING:
	case V_ASN1_BMPSTRING:
	case V_ASN1_UTF8STRING:
	case V_ASN1_OTHER:
	case V_ASN1_SET:
	case V_ASN1_SEQUENCE:
	default:
		if (utype == V_ASN1_BMPSTRING && (len & 1)) {
			ASN1error(ASN1_R_BMPSTRING_IS_WRONG_LENGTH);
			goto err;
		}
		if (utype == V_ASN1_UNIVERSALSTRING && (len & 3)) {
			ASN1error(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH);
			goto err;
		}







		/* All based on ASN1_STRING and handled the same way. */
		if (*pval == NULL) {



			if ((stmp = ASN1_STRING_type_new(utype)) == NULL) {
				ASN1error(ERR_R_MALLOC_FAILURE);
				goto err;
			}




			*pval = (ASN1_VALUE *)stmp;


		} else {


















			stmp = (ASN1_STRING *)*pval;







			stmp->type = utype;
		}

		if (!ASN1_STRING_set(stmp, content, len)) {

			ASN1_STRING_free(stmp);
			*pval = NULL;
			goto err;

		}
		break;





	}



	/* If ASN1_ANY and NULL type fix up value */







	if (typ && (utype == V_ASN1_NULL))























		typ->value.ptr = NULL;






















































	ret = 1;

 err:


	if (!ret) {


		ASN1_TYPE_free(typ);



















		if (opval)
			*opval = NULL;


	}





	return ret;
}


















/* This function finds the end of an ASN1 structure when passed its maximum
 * length, whether it is indefinite length and a pointer to the content.
 * This is more efficient than calling asn1_collect because it does not
 * recurse on each indefinite length header.



 */




static int

asn1_find_end(const unsigned char **in, long len, char inf)



{














	int expected_eoc;



	long plen;

	const unsigned char *p = *in, *q;









	/* If not indefinite length constructed just add length */
	if (inf == 0) {
		*in += len;
		return 1;
	}


	expected_eoc = 1;




	/* Indefinite length constructed form. Find the end when enough EOCs

	 * are found. If more indefinite length constructed headers
	 * are encountered increment the expected eoc count otherwise just
	 * skip to the end of the data.
	 */

	while (len > 0) {
		if (asn1_check_eoc(&p, len)) {



			expected_eoc--;



			if (expected_eoc == 0)









				break;
			len -= 2;


			continue;


		}








		q = p;




		/* Just read in a header: only care about the length */




		if (!asn1_check_tlen(&plen, NULL, NULL, &inf, NULL, &p, len,




		    -1, 0, 0, NULL)) {











			ASN1error(ERR_R_NESTED_ASN1_ERROR);



			return 0;



		}



		if (inf)






			expected_eoc++;




		else


			p += plen;

		len -= p - q;


	}
	if (expected_eoc) {




		ASN1error(ASN1_R_MISSING_EOC);
		return 0;
	}
	*in = p;















	return 1;

}


/* This function collects the asn1 data from a constructred string

 * type into a buffer. The values of 'in' and 'len' should refer

 * to the contents of the constructed type and 'inf' should be set
 * if it is indefinite length.

 */

#ifndef ASN1_MAX_STRING_NEST





/* This determines how many levels of recursion are permitted in ASN1









 * string types. If it is not limited stack overflows can occur. If set




 * to zero no recursion is allowed at all. Although zero should be adequate








 * examples exist that require a value of 1. So 5 should be more than enough.
 */
#define ASN1_MAX_STRING_NEST 5



#endif




static int
asn1_collect(CBB *cbb, const unsigned char **in, long len, char inf,
    int tag, int aclass, int depth)
{
	const unsigned char *p, *q;
	long plen;
	char cst, ininf;


	if (depth > ASN1_MAX_STRING_NEST) {
		ASN1error(ASN1_R_NESTED_ASN1_STRING);
		return 0;
	}





	p = *in;


	inf &= 1;











	while (len > 0) {








		q = p;



		/* Check for EOC */
		if (asn1_check_eoc(&p, len)) {
			/* EOC is illegal outside indefinite length


			 * constructed form */
			if (!inf) {



				ASN1error(ASN1_R_UNEXPECTED_EOC);


				return 0;






			}


			inf = 0;



			break;
		}





		if (!asn1_check_tlen(&plen, NULL, NULL, &ininf, &cst, &p,


		    len, tag, aclass, 0, NULL)) {

			ASN1error(ERR_R_NESTED_ASN1_ERROR);


			return 0;



		}





		/* If indefinite length constructed update max length */


		if (cst) {
			if (!asn1_collect(cbb, &p, plen, ininf, tag, aclass,




			    depth + 1))
				return 0;

		} else if (plen > 0) {








			if (!CBB_add_bytes(cbb, p, plen))

				return 0;
			p += plen;
		}
		len -= p - q;
	}


	if (inf) {
		ASN1error(ASN1_R_MISSING_EOC);

		return 0;
	}


	*in = p;


	return 1;
}







/* Check for ASN1 EOC and swallow it if found */




static int



















asn1_check_eoc(const unsigned char **in, long len)



{



	const unsigned char *p;








	if (len < 2)

		return 0;

	p = *in;


	if (!p[0] && !p[1]) {

		*in += 2;
		return 1;
	}








	return 0;
}






/* Check an ASN1 tag and length: a bit like ASN1_get_object









 * but it sets the length for indefinite length constructed
 * form, we don't know the exact length but we can set an

 * upper bound to the amount of data available minus the

 * header length just read.


 */



static int

asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf,



    char *cst, const unsigned char **in, long len, int exptag, int expclass,
    char opt, ASN1_TLC *ctx)


{


	int i;





	int ptag, pclass;







	long plen;


	const unsigned char *p, *q;




	p = *in;







	q = p;







	if (ctx && ctx->valid) {



		i = ctx->ret;
		plen = ctx->plen;
		pclass = ctx->pclass;
		ptag = ctx->ptag;
		p += ctx->hdrlen;



	} else {

		i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
		if (ctx) {



			ctx->ret = i;


			ctx->plen = plen;
			ctx->pclass = pclass;
			ctx->ptag = ptag;
			ctx->hdrlen = p - q;
			ctx->valid = 1;
			/* If definite length, and no error, length +



			 * header can't exceed total amount of data available.


			 */






			if (!(i & 0x81) && ((plen + ctx->hdrlen) > len)) {
				ASN1error(ASN1_R_TOO_LONG);
				asn1_tlc_invalidate(ctx);
				return 0;



			}


		}




	}









	if (i & 0x80) {

		ASN1error(ASN1_R_BAD_OBJECT_HEADER);





		asn1_tlc_invalidate(ctx);

























		return 0;
	}
	if (exptag >= 0) {
		if ((exptag != ptag) || (expclass != pclass)) {



			/* If type is OPTIONAL, not an error:
			 * indicate missing type.





			 */

			if (opt)

				return -1;

			asn1_tlc_invalidate(ctx);


			ASN1error(ASN1_R_WRONG_TAG);
			return 0;
		}






		/* We have a tag and class match:


		 * assume we are going to do something with it */

		asn1_tlc_invalidate(ctx);



	}






	if (i & 1)




		plen = len - (p - q);



	if (inf)






		*inf = i & 1;
	if (cst)

		*cst = i & V_ASN1_CONSTRUCTED;
	if (olen)


		*olen = plen;
	if (oclass)


		*oclass = pclass;
	if (otag)





		*otag = ptag;





	*in = p;

	return 1;
}







>
|





<
<
|
<
<
|
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
|
|
<
|
<
<
<
|
<

|
<
<
<
|
<
|
<
|
|
<

<
>

>
|
|
|
|
>
|
<
<
<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
|
<
<
|
<
<
<
<
<
<
<
|
|
<
<
|
<
<
<
<
<
|
<
<
<
|
<
|
<
<
<
|
<
|
<
<
<
<
|
<
<
<
|
|
|
<
<
|
<
<
<
|
<
<
<
|
<
<
>
<
|
>
|
|
<
<
|
<
<
|
<
<
|
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
|
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
<
|
|
<
<
|
|
<
<
|
<
|
|
<
<
<
<

<
>
|
|
<
>
|
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
|
<
<
|
<
<
<
|

<
<
|
<
<
<
<
|
<
<
|
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
>
|
<
|
<
<
<
<
<
<
|
|
<
<
<
<
|
<
<
>
|
|
<
|
<
<
<
<
<
<
|
|
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
|
>
>
>
>
|
>
|
<
|
|
<
<
<
<
<
<
<
|
|
<
|
<
<
<
<
|
<
<
<
|
<
<
<
|
<
<
<
<
<
|
<
<
<
<

<
|
<
<
<
<
<
<
<
|
<
<
|
|
|
<
>
|
<
<
<

<
<
|
>



<
<
<
<
<
<
<
|
<
<
<
|
<
<
<
<
<
<
<
|
<
<
|
<
<
|
>
|
<
<
<
<
<
<
<
<

|
>
|
<
<
|
<
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
|
|
|
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|

|
<
|
<
>
|
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
|
|
|
|
|
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>
|
|
>
|
<
>
>
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
|
<
|

<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
<
<
<
<
|
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
<
|
<
<
<
|
<
<
<
|
<
<
<
|
>
|
|

>
|
<
<

<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<

<
<
<
<
<


|




|







>
|


<
<
<
<

>
>
>



|
>
>
>
>
>




<
|
<

<
<




















|



|



>
>
>
>
>
>
>

|
>
>
>
|
|
|
|
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
|
>
|
>
|
|
|
>
|
|
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>

>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
|
<
<
<
>
>
>
|
>
>
>
|
|
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
|
>
|
>
>
>
>
>
>
>

>
|
|
<
|
|
>
>
|
>
>
>
>
|
>
|
<
<
<
>
|
|
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
|
|
>
>
|
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>

>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
|
>
|
>
>
|
|
>
>
>
>
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
|
>
|
>
|
|
>
|
|
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
|
<
|
>
>
>
|
>
>
>
|
<
<
<
|
|
|
<

>
|
|
|
|
>
>
|
>
>
|
>
>
|
>

>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
|
|
|
>
>
|
|
>
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
|
>
>
>
|


>
>
>
>
|
>
>
|
>
|
>
>
|
>
>
>
|
>
>
>

>
|
>
>
|
|
>
>
>
>
|
|
>
|
>
>
>
>
>
>
>
>
|
>
|
<
|
|
|
>
>
|
|
>
|
|
>
>
|
>
>
|

>
>
>
>
|
>
>
|
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>

>
>
>
>
|
>

>
|
>
>
|
>
|
|
|
>
>
>
>
>
>
>
>
|
|
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
|
|
>
|
>
|
>
>
|
>
>

|
>
|
>
>
>
|
|
>
>
|
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
|
>
>
>
|
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
|
>
>
>
|
<
<
<
<
>
>
>
|
>
|
|
>
>
>
|
>
>
|
|
|
|
|
|
>
>
>
|
>
>
|
>
>
>
>
>
>
|
<
|
|
>
>
>
|
>
>
|
>
>
>
>


>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|
|
>
>
>
|
|
>
>
>
>
>
|
>
|
>
|
>
|
>
>
|
|

>
>
>
>
>
>
|
>
>
|
>
|
>
>
>
|
>
>
>
>
|
>
|
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
|
|
>
|
|
>
>
|
|
>
>
|
|
>
>
>
>
>
|
>
>

>
>
|
>
|

65
66
67
68
69
70
71
72
73
74
75
76
77
78


79


80



81












82






83
84

85



86

87
88



89

90

91
92

93

94
95
96
97
98
99
100
101
102



103
104

















105


106


107







108
109


110





111



112

113



114

115




116



117
118
119


120



121



122


123

124
125
126
127


128


129


130





131










132


133
134












135


















136
137






138
139


140
141


142

143
144




145

146
147
148

149
150











151
152



153


154



155
156


157




158


159


160


















161


162
163

164






165
166




167


168
169
170

171






172
173

174




175

































176
177


178
179
180
181
182
183
184
185

186
187







188
189

190




191



192



193





194




195

196







197


198
199
200

201
202



203


204
205
206
207
208







209



210







211


212


213
214
215








216
217
218
219


220

221
222
223














224



225
226
227
228
229
230












231
232
233

234

235
236











237

238

239
240
241
242
243
244




245























246
247
248
249
250
251
252
253
254

255
256
257
258
259
260
261












262

263
264

265
266













267
268
269
270
271





































272





273



274














275


276



277



278



279
280
281
282
283
284
285


286


287


























288



289





290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308




309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

326

327


328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541

542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617

618
619
620
621
622
623
624
625
626
627
628
629



630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794

795
796
797
798
799
800
801
802
803



804
805
806

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921

922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093




1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126

1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
#include <openssl/buffer.h>
#include <openssl/err.h>
#include <openssl/objects.h>

#include "asn1_locl.h"
#include "bytestring.h"

/*
 * Constructed types with a recursive definition (such as can be found in PKCS7)
 * could eventually exceed the stack given malicious input with excessive
 * recursion. Therefore we limit the stack depth.
 */
#define ASN1_MAX_CONSTRUCTED_NEST 30



#ifndef ASN1_MAX_STRING_NEST


/*



 * This determines how many levels of recursion are permitted in ASN.1 string












 * types. If it is not limited stack overflows can occur. If set to zero no






 * recursion is allowed at all.
 */

#define ASN1_MAX_STRING_NEST 5



#endif


static int asn1_template_d2i(ASN1_VALUE **pval, CBS *cbs,



    const ASN1_TEMPLATE *at, int optional, int depth);



static int
asn1_check_eoc(CBS *cbs)

{

	uint16_t eoc;

	if (!CBS_peek_u16(cbs, &eoc))
		return 0;
	if (eoc != 0)
		return 0;

	return CBS_skip(cbs, 2);
}




static int

















asn1_check_tag(CBS *cbs, size_t *out_len, int *out_tag, uint8_t *out_class,


    int *out_indefinite, int *out_constructed, int expected_tag,


    int expected_class, int optional)







{
	int constructed, indefinite;


	uint32_t tag_number;





	uint8_t tag_class;



	size_t length;





	if (out_len != NULL)

		*out_len = 0;




	if (out_tag != NULL)



		*out_tag = 0;
	if (out_class != NULL)
		*out_class = 0;


	if (out_indefinite != NULL)



		*out_indefinite = 0;



	if (out_constructed != NULL)


		*out_constructed = 0;


	if (!asn1_get_identifier_cbs(cbs, 0, &tag_class, &constructed,
	    &tag_number)) {
		ASN1error(ASN1_R_BAD_OBJECT_HEADER);


		return 0;


	}


	if (expected_tag >= 0) {





		if (expected_tag != tag_number ||










		    expected_class != tag_class << 6) {


			/* Indicate missing type if this is OPTIONAL. */
			if (optional)












				return -1;



















			ASN1error(ASN1_R_WRONG_TAG);






			return 0;
		}


	}
	if (!asn1_get_length_cbs(cbs, 0, &indefinite, &length)) {


		ASN1error(ASN1_R_BAD_OBJECT_HEADER);

		return 0;
	}






	/* Indefinite length can only be used with constructed encoding. */
	if (indefinite && !constructed) {
		ASN1error(ASN1_R_BAD_OBJECT_HEADER);

		return 0;
	}












	if (!indefinite && CBS_len(cbs) < length) {



		ASN1error(ASN1_R_TOO_LONG);


		return 0;



	}



	if (tag_number > INT_MAX) {




		ASN1error(ASN1_R_TOO_LONG);


		return 0;


	}





















	if (indefinite)
		length = CBS_len(cbs);








	if (out_len != NULL)
		*out_len = length;




	if (out_tag != NULL)


		*out_tag = tag_number;
	if (out_class != NULL)
		*out_class = tag_class << 6;

	if (out_indefinite != NULL)






		*out_indefinite = indefinite;
	if (out_constructed != NULL)

		*out_constructed = constructed;






































	return 1;
}



/* Collect the contents from a constructed ASN.1 object. */
static int
asn1_collect(CBB *cbb, CBS *cbs, int indefinite, int expected_tag,
    int expected_class, int depth)
{
	int constructed;
	size_t length;

	CBS content;
	int need_eoc;








	if (depth > ASN1_MAX_STRING_NEST) {

		ASN1error(ASN1_R_NESTED_ASN1_STRING);




		return 0;



	}









	need_eoc = indefinite;






	while (CBS_len(cbs) > 0) {







		if (asn1_check_eoc(cbs)) {


			if (!need_eoc) {
				ASN1error(ASN1_R_UNEXPECTED_EOC);
				return 0;

			}
			return 1;



		}


		if (!asn1_check_tag(cbs, &length, NULL, NULL, &indefinite,
		    &constructed, expected_tag, expected_class, 0)) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;
		}











		if (constructed) {







			if (!asn1_collect(cbb, cbs, indefinite, expected_tag,


			    expected_class, depth + 1))


				return 0;
			continue;
		}









		if (!CBS_get_bytes(cbs, &content, length)) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;


		}

		if (!CBB_add_bytes(cbb, CBS_data(&content), CBS_len(&content)))
			return 0;
	}


















	if (need_eoc) {
		ASN1error(ASN1_R_MISSING_EOC);
		return 0;
	}

	return 1;












}

/* Find the end of an ASN.1 object. */

static int

asn1_find_end(CBS *cbs, size_t length, int indefinite)
{











	size_t eoc_count;



	if (!indefinite) {
		if (!CBS_skip(cbs, length)) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;
		}
		return 1;




	}
























	eoc_count = 1;

	while (CBS_len(cbs) > 0) {
		if (asn1_check_eoc(cbs)) {
			if (--eoc_count == 0)
				break;
			continue;
		}

		if (!asn1_check_tag(cbs, &length, NULL, NULL,
		    &indefinite, NULL, -1, 0, 0)) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			return 0;
		}
		if (indefinite) {
			eoc_count++;












			continue;

		}
		if (!CBS_skip(cbs, length))

			return 0;
	}














	if (eoc_count > 0) {
		ASN1error(ASN1_R_MISSING_EOC);
		return 0;
	}











































	return 1;



}

















static int



asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)



{



	ASN1_BOOLEAN *abool;
	ASN1_STRING *astr;
	uint8_t val;
	int ret = 0;

	if (it->funcs != NULL)
		goto err;





	if (CBS_len(content) > INT_MAX)


























		goto err;









	switch (utype) {
	case V_ASN1_OBJECT:
		if (!c2i_ASN1_OBJECT_cbs((ASN1_OBJECT **)pval, content))
			goto err;
		break;

	case V_ASN1_NULL:
		if (CBS_len(content) != 0) {
			ASN1error(ASN1_R_NULL_IS_WRONG_LENGTH);
			goto err;
		}
		*pval = (ASN1_VALUE *)1;
		break;

	case V_ASN1_BOOLEAN:
		abool = (ASN1_BOOLEAN *)pval;
		if (CBS_len(content) != 1) {
			ASN1error(ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
			goto err;




		}
		if (!CBS_get_u8(content, &val))
			goto err;
		*abool = val;
		break;

	case V_ASN1_BIT_STRING:
		if (!c2i_ASN1_BIT_STRING_cbs((ASN1_BIT_STRING **)pval, content))
			goto err;
		break;

	case V_ASN1_ENUMERATED:
		if (!c2i_ASN1_ENUMERATED_cbs((ASN1_ENUMERATED **)pval, content))
			goto err;
		break;

	case V_ASN1_INTEGER:

		if (!c2i_ASN1_INTEGER_cbs((ASN1_INTEGER **)pval, content))

			goto err;


		break;

	case V_ASN1_OCTET_STRING:
	case V_ASN1_NUMERICSTRING:
	case V_ASN1_PRINTABLESTRING:
	case V_ASN1_T61STRING:
	case V_ASN1_VIDEOTEXSTRING:
	case V_ASN1_IA5STRING:
	case V_ASN1_UTCTIME:
	case V_ASN1_GENERALIZEDTIME:
	case V_ASN1_GRAPHICSTRING:
	case V_ASN1_VISIBLESTRING:
	case V_ASN1_GENERALSTRING:
	case V_ASN1_UNIVERSALSTRING:
	case V_ASN1_BMPSTRING:
	case V_ASN1_UTF8STRING:
	case V_ASN1_OTHER:
	case V_ASN1_SET:
	case V_ASN1_SEQUENCE:
	default:
		if (utype == V_ASN1_BMPSTRING && (CBS_len(content) & 1)) {
			ASN1error(ASN1_R_BMPSTRING_IS_WRONG_LENGTH);
			goto err;
		}
		if (utype == V_ASN1_UNIVERSALSTRING && (CBS_len(content) & 3)) {
			ASN1error(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH);
			goto err;
		}
		if (utype == V_ASN1_UTCTIME || utype == V_ASN1_GENERALIZEDTIME) {
			if (!asn1_time_parse_cbs(content,
			    utype == V_ASN1_GENERALIZEDTIME, NULL))  {
				ASN1error(ASN1_R_INVALID_TIME_FORMAT);
				goto err;
			}
		}
		/* All based on ASN1_STRING and handled the same way. */
		if (*pval != NULL) {
			ASN1_STRING_free((ASN1_STRING *)*pval);
			*pval = NULL;
		}
		if ((astr = ASN1_STRING_type_new(utype)) == NULL) {
			ASN1error(ERR_R_MALLOC_FAILURE);
			goto err;
		}
		if (!ASN1_STRING_set(astr, CBS_data(content), CBS_len(content))) {
			ASN1_STRING_free(astr);
			goto err;
		}
		*pval = (ASN1_VALUE *)astr;
		break;
	}

	ret = 1;

 err:
	return ret;
}

static int
asn1_c2i_any(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
{
	ASN1_TYPE *atype;

	if (it->utype != V_ASN1_ANY || it->funcs != NULL)
		return 0;

	if (*pval != NULL) {
		ASN1_TYPE_free((ASN1_TYPE *)*pval);
		*pval = NULL;
	}

	if ((atype = ASN1_TYPE_new()) == NULL)
		return 0;

	if (!asn1_c2i_primitive(&atype->value.asn1_value, content, utype, it)) {
		ASN1_TYPE_free(atype);
		return 0;
	}
	atype->type = utype;

	/* Fix up value for ASN.1 NULL. */
	if (atype->type == V_ASN1_NULL)
		atype->value.ptr = NULL;

	*pval = (ASN1_VALUE *)atype;

	return 1;
}

static int
asn1_c2i(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
{
	if (CBS_len(content) > INT_MAX)
		return 0;

	if (it->funcs != NULL) {
		const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
		char free_content = 0;

		if (pf->prim_c2i == NULL)
			return 0;

		return pf->prim_c2i(pval, CBS_data(content), CBS_len(content),
		    utype, &free_content, it);
	}

	if (it->utype == V_ASN1_ANY)
		return asn1_c2i_any(pval, content, utype, it);

	return asn1_c2i_primitive(pval, content, utype, it);
}

/*
 * Decode ASN.1 content into a primitive type. There are three possible forms -
 * a SEQUENCE/SET/OTHER that is stored verbatim (including the ASN.1 tag and
 * length octets), constructed objects and non-constructed objects. In the
 * first two cases indefinite length is permitted, which we may need to handle.
 * When this function is called the *cbs should reference the start of the
 * ASN.1 object (i.e. the tag/length header), while *cbs_object should
 * reference the start of the object contents (i.e. after the tag/length
 * header. Additionally, the *cbs_object offset should be relative to the
 * ASN.1 object being parsed. On success the *cbs will point at the octet
 * after the object.
 */
static int
asn1_d2i_primitive_content(ASN1_VALUE **pval, CBS *cbs, CBS *cbs_object,
    int utype, int constructed, int indefinite, size_t length,
    const ASN1_ITEM *it)
{
	CBS cbs_content, cbs_initial;
	uint8_t *data = NULL;
	size_t data_len = 0;
	CBB cbb;
	int ret = 0;

	memset(&cbb, 0, sizeof(cbb));

	CBS_dup(cbs, &cbs_initial);
	CBS_init(&cbs_content, NULL, 0);

	if (asn1_must_be_constructed(utype) && !constructed) {
		ASN1error(ASN1_R_TYPE_NOT_CONSTRUCTED);
		goto err;
	}
	if (asn1_must_be_primitive(utype) && constructed) {
		ASN1error(ASN1_R_TYPE_NOT_PRIMITIVE);
		goto err;
	}

	/* SEQUENCE, SET and "OTHER" are left in encoded form. */
	if (utype == V_ASN1_SEQUENCE || utype == V_ASN1_SET ||
	    utype == V_ASN1_OTHER) {
		if (!asn1_find_end(cbs_object, length, indefinite))
			goto err;
		if (!CBS_get_bytes(&cbs_initial, &cbs_content,
		    CBS_offset(cbs_object)))
			goto err;
	} else if (constructed) {
		/*
		 * Should really check the internal tags are correct but
		 * some things may get this wrong. The relevant specs
		 * say that constructed string types should be OCTET STRINGs
		 * internally irrespective of the type. So instead just check
		 * for UNIVERSAL class and ignore the tag.
		 */
		if (!CBB_init(&cbb, 0))
			goto err;
		if (!asn1_collect(&cbb, cbs_object, indefinite, -1,
		    V_ASN1_UNIVERSAL, 0))
			goto err;
		if (!CBB_finish(&cbb, &data, &data_len))
			goto err;

		CBS_init(&cbs_content, data, data_len);
	} else {
		if (!CBS_get_bytes(cbs_object, &cbs_content, length))
			goto err;
	}

	if (!asn1_c2i(pval, &cbs_content, utype, it))
		goto err;

	if (!CBS_skip(cbs, CBS_offset(cbs_object)))
		goto err;

	ret = 1;

 err:
	CBB_cleanup(&cbb);
	freezero(data, data_len);

	return ret;
}

static int
asn1_d2i_any(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
    int tag_number, int tag_class, int optional)
{
	int constructed, indefinite;
	uint8_t object_class;
	int object_type;
	CBS cbs_object;
	size_t length;

	CBS_init(&cbs_object, CBS_data(cbs), CBS_len(cbs));

	if (it->utype != V_ASN1_ANY)
		return 0;

	if (tag_number >= 0) {
		ASN1error(ASN1_R_ILLEGAL_TAGGED_ANY);
		return 0;
	}
	if (optional) {

		ASN1error(ASN1_R_ILLEGAL_OPTIONAL_ANY);
		return 0;
	}

	/* Determine type from ASN.1 tag. */
	if (asn1_check_tag(&cbs_object, &length, &object_type, &object_class,
	    &indefinite, &constructed, -1, 0, 0) != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		return 0;
	}
	if (object_class != V_ASN1_UNIVERSAL)
		object_type = V_ASN1_OTHER;

	return asn1_d2i_primitive_content(pval, cbs, &cbs_object, object_type,
	    constructed, indefinite, length, it);
}

static int
asn1_d2i_mstring(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
    int tag_number, int tag_class, int optional)
{
	int constructed, indefinite;
	uint8_t object_class;
	int object_tag;
	CBS cbs_object;
	size_t length;

	CBS_init(&cbs_object, CBS_data(cbs), CBS_len(cbs));




	/*
	 * It never makes sense for multi-strings to have implicit tagging, so
	 * if tag_number != -1, then this looks like an error in the template.
	 */
	if (tag_number != -1) {
		ASN1error(ASN1_R_BAD_TEMPLATE);
		return 0;
	}

	if (asn1_check_tag(&cbs_object, &length, &object_tag, &object_class,
	    &indefinite, &constructed, -1, 0, 1) != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		return 0;
	}

	/* Class must be UNIVERSAL. */
	if (object_class != V_ASN1_UNIVERSAL) {
		if (optional)
			return -1;
		ASN1error(ASN1_R_MSTRING_NOT_UNIVERSAL);
		return 0;
	}
	/* Check tag matches bit map. */
	if ((ASN1_tag2bit(object_tag) & it->utype) == 0) {
		if (optional)
			return -1;
		ASN1error(ASN1_R_MSTRING_WRONG_TAG);
		return 0;
	}

	return asn1_d2i_primitive_content(pval, cbs, &cbs_object,
	    object_tag, constructed, indefinite, length, it);
}

static int
asn1_d2i_primitive(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
    int tag_number, int tag_class, int optional)
{
	CBS cbs_object;
	int constructed, indefinite;
	int utype = it->utype;
	size_t length;
	int ret;

	CBS_init(&cbs_object, CBS_data(cbs), CBS_len(cbs));

	if (it->itype == ASN1_ITYPE_MSTRING)

		return 0;

	if (it->utype == V_ASN1_ANY)
		return asn1_d2i_any(pval, cbs, it, tag_number, tag_class, optional);

	if (tag_number == -1) {
		tag_number = it->utype;
		tag_class = V_ASN1_UNIVERSAL;
	}

	ret = asn1_check_tag(&cbs_object, &length, NULL, NULL, &indefinite,
	    &constructed, tag_number, tag_class, optional);



	if (ret == -1)
		return -1;
	if (ret != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		return 0;
	}

	return asn1_d2i_primitive_content(pval, cbs, &cbs_object, utype,
	    constructed, indefinite, length, it);
}

static int
asn1_item_d2i_choice(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
    int tag_number, int tag_class, int optional, int depth)
{
	const ASN1_TEMPLATE *at, *errat = NULL;
	const ASN1_AUX *aux;
	ASN1_aux_cb *asn1_cb = NULL;
	ASN1_VALUE *achoice = NULL;
	ASN1_VALUE **pchptr;
	int i, ret;

	if ((aux = it->funcs) != NULL)
		asn1_cb = aux->asn1_cb;

	if (it->itype != ASN1_ITYPE_CHOICE)
		goto err;

	/*
	 * It never makes sense for CHOICE types to have implicit tagging, so
	 * if tag_number != -1, then this looks like an error in the template.
	 */
	if (tag_number != -1) {
		ASN1error(ASN1_R_BAD_TEMPLATE);
		goto err;
	}

	if (*pval != NULL) {
		ASN1_item_ex_free(pval, it);
		*pval = NULL;
	}

	if (!ASN1_item_ex_new(&achoice, it)) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		goto err;
	}

	if (asn1_cb != NULL && !asn1_cb(ASN1_OP_D2I_PRE, &achoice, it, NULL)) {
		ASN1error(ASN1_R_AUX_ERROR);
		goto err;
	}

	/* Try each possible CHOICE in turn. */
	for (i = 0; i < it->tcount; i++) {
		at = &it->templates[i];

		pchptr = asn1_get_field_ptr(&achoice, at);

		/* Mark field as OPTIONAL so its absence can be identified. */
		ret = asn1_template_d2i(pchptr, cbs, at, 1, depth);
		if (ret == -1)
			continue;
		if (ret != 1) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			errat = at;
			goto err;
		}

		/* We've successfully decoded an ASN.1 object. */
		asn1_set_choice_selector(&achoice, i, it);
		break;
	}

	/* Did we fall off the end without reading anything? */
	if (i == it->tcount) {
		if (optional) {
			ASN1_item_ex_free(&achoice, it);
			return -1;
		}
		ASN1error(ASN1_R_NO_MATCHING_CHOICE_TYPE);
		goto err;
	}

	if (asn1_cb != NULL && !asn1_cb(ASN1_OP_D2I_POST, &achoice, it, NULL)) {
		ASN1error(ASN1_R_AUX_ERROR);
		goto err;
	}

	*pval = achoice;
	achoice = NULL;

	return 1;

 err:
	ASN1_item_ex_free(&achoice, it);

	if (errat != NULL)
		ERR_asprintf_error_data("Field=%s, Type=%s", errat->field_name,
		    it->sname);
	else
		ERR_asprintf_error_data("Type=%s", it->sname);

	return 0;
}

static int
asn1_item_d2i_sequence(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
    int tag_number, int tag_class, int optional, int depth)
{
	CBS cbs_seq, cbs_seq_content, cbs_object;
	int constructed, indefinite, optional_field;
	const ASN1_TEMPLATE *errat = NULL;
	const ASN1_TEMPLATE *seqat, *at;
	ASN1_aux_cb *asn1_cb = NULL;
	const ASN1_AUX *aux;
	ASN1_VALUE *aseq = NULL;
	ASN1_VALUE **pseqval;
	int eoc_needed, i;
	size_t length;
	int ret = 0;

	CBS_init(&cbs_seq, CBS_data(cbs), CBS_len(cbs));

	if ((aux = it->funcs) != NULL)
		asn1_cb = aux->asn1_cb;

	if (it->itype != ASN1_ITYPE_NDEF_SEQUENCE &&
	    it->itype != ASN1_ITYPE_SEQUENCE)
		goto err;

	if (*pval != NULL) {
		ASN1_item_ex_free(pval, it);
		*pval = NULL;
	}

	/* If no IMPLICIT tagging use UNIVERSAL/SEQUENCE. */
	if (tag_number == -1) {
		tag_class = V_ASN1_UNIVERSAL;
		tag_number = V_ASN1_SEQUENCE;
	}

	/* Read ASN.1 SEQUENCE header. */
	ret = asn1_check_tag(&cbs_seq, &length, NULL, NULL, &indefinite,
	    &constructed, tag_number, tag_class, optional);
	if (ret == -1)
		return -1;
	if (ret != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		goto err;
	}

	if (!constructed) {
		ASN1error(ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
		goto err;
	}

	if (indefinite) {
		eoc_needed = 1;
		CBS_init(&cbs_seq_content, CBS_data(&cbs_seq), CBS_len(&cbs_seq));
	} else {
		eoc_needed = 0;
		if (!CBS_get_bytes(&cbs_seq, &cbs_seq_content, length))
			goto err;
	}


	if (!ASN1_item_ex_new(&aseq, it)) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		goto err;
	}

	if (asn1_cb != NULL && !asn1_cb(ASN1_OP_D2I_PRE, &aseq, it, NULL)) {
		ASN1error(ASN1_R_AUX_ERROR);
		goto err;
	}




	for (i = 0; i < it->tcount; i++) {
		at = &it->templates[i];


		if (asn1_check_eoc(&cbs_seq_content)) {
			if (!indefinite) {
				ASN1error(ASN1_R_UNEXPECTED_EOC);
				goto err;
			}
			eoc_needed = 0;
			break;
		}
		if (CBS_len(&cbs_seq_content) == 0)
			break;

		if ((seqat = asn1_do_adb(&aseq, at, 1)) == NULL)
			goto err;

		pseqval = asn1_get_field_ptr(&aseq, seqat);

		/*
		 * This was originally implemented to "increase efficiency",
		 * however it currently needs to remain since it papers over
		 * the use of ASN.1 ANY with OPTIONAL in SEQUENCEs (which
		 * asn1_d2i_primitive() currently rejects).
		 */
		optional_field = (seqat->flags & ASN1_TFLG_OPTIONAL) != 0;
		if (i == it->tcount - 1)
			optional_field = 0;

		ret = asn1_template_d2i(pseqval, &cbs_seq_content,
		    seqat, optional_field, depth);
		if (ret == -1) {
			/* Absent OPTIONAL component. */
			ASN1_template_free(pseqval, seqat);
			continue;
		}
		if (ret != 1) {
			errat = seqat;
			goto err;
		}
	}

	if (eoc_needed && !asn1_check_eoc(&cbs_seq_content)) {
		ASN1error(ASN1_R_MISSING_EOC);
		goto err;
	}

	if (indefinite) {
		if (!CBS_skip(&cbs_seq, CBS_offset(&cbs_seq_content)))
			goto err;
	} else if (CBS_len(&cbs_seq_content) != 0) {
		ASN1error(ASN1_R_SEQUENCE_LENGTH_MISMATCH);
		goto err;
	}

	/*
	 * There is no more data in the ASN.1 SEQUENCE, however we may not have
	 * populated all fields - check that any remaining are OPTIONAL.
	 */
	for (; i < it->tcount; i++) {
		at = &it->templates[i];

		if ((seqat = asn1_do_adb(&aseq, at, 1)) == NULL)
			goto err;

		if ((seqat->flags & ASN1_TFLG_OPTIONAL) == 0) {
			ASN1error(ASN1_R_FIELD_MISSING);
			errat = seqat;
			goto err;
		}

		/* XXX - this is probably unnecessary with earlier free. */
		pseqval = asn1_get_field_ptr(&aseq, seqat);
		ASN1_template_free(pseqval, seqat);
	}

	if (!CBS_get_bytes(cbs, &cbs_object, CBS_offset(&cbs_seq)))
		goto err;

	if (!asn1_enc_save(&aseq, &cbs_object, it)) {
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	if (asn1_cb != NULL && !asn1_cb(ASN1_OP_D2I_POST, &aseq, it, NULL)) {
		ASN1error(ASN1_R_AUX_ERROR);
		goto err;
	}

	*pval = aseq;
	aseq = NULL;

	return 1;

 err:
	ASN1_item_ex_free(&aseq, it);

	if (errat != NULL)
		ERR_asprintf_error_data("Field=%s, Type=%s", errat->field_name,
		    it->sname);
	else
		ERR_asprintf_error_data("Type=%s", it->sname);

	return 0;
}

static int
asn1_item_d2i_extern(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
    int tag_number, int tag_class, int optional)
{
	const ASN1_EXTERN_FUNCS *ef = it->funcs;
	const unsigned char *p = NULL;
	ASN1_TLC ctx = { 0 };
	int ret = 0;

	if (CBS_len(cbs) > LONG_MAX)
		return 0;


	p = CBS_data(cbs);

	if ((ret = ef->asn1_ex_d2i(pval, &p, (long)CBS_len(cbs), it,
	    tag_number, tag_class, optional, &ctx)) == 1) {
		if (!CBS_skip(cbs, p - CBS_data(cbs)))
			goto err;
	}
	return ret;

 err:
	ASN1_item_ex_free(pval, it);

	ERR_asprintf_error_data("Type=%s", it->sname);

	return 0;
}

static int
asn1_item_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
    int tag_number, int tag_class, int optional, int depth)
{
	if (pval == NULL)
		return 0;

	if (++depth > ASN1_MAX_CONSTRUCTED_NEST) {
		ASN1error(ASN1_R_NESTED_TOO_DEEP);
		goto err;
	}

	switch (it->itype) {
	case ASN1_ITYPE_PRIMITIVE:
		if (it->templates != NULL) {
			/*
			 * Tagging or OPTIONAL is currently illegal on an item
			 * template because the flags can't get passed down.
			 * In practice this isn't a problem: we include the
			 * relevant flags from the item template in the
			 * template itself.
			 */
			if (tag_number != -1 || optional) {
				ASN1error(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
				goto err;
			}
			return asn1_template_d2i(pval, cbs, it->templates,
			    optional, depth);
		}
		return asn1_d2i_primitive(pval, cbs, it, tag_number, tag_class,
		    optional);

	case ASN1_ITYPE_MSTRING:
		return asn1_d2i_mstring(pval, cbs, it, tag_number, tag_class,
		    optional);

	case ASN1_ITYPE_EXTERN:
		return asn1_item_d2i_extern(pval, cbs, it, tag_number,
		    tag_class, optional);

	case ASN1_ITYPE_CHOICE:
		return asn1_item_d2i_choice(pval, cbs, it, tag_number,
		    tag_class, optional, depth);

	case ASN1_ITYPE_NDEF_SEQUENCE:
	case ASN1_ITYPE_SEQUENCE:
		return asn1_item_d2i_sequence(pval, cbs, it, tag_number,
		    tag_class, optional, depth);

	default:
		return 0;
	}

 err:
	ASN1_item_ex_free(pval, it);

	ERR_asprintf_error_data("Type=%s", it->sname);

	return 0;
}

static void
asn1_template_stack_of_free(STACK_OF(ASN1_VALUE) *avals,
    const ASN1_TEMPLATE *at)
{
	ASN1_VALUE *aval;

	if (avals == NULL)
		return;

	while (sk_ASN1_VALUE_num(avals) > 0) {
		aval = sk_ASN1_VALUE_pop(avals);
		ASN1_item_ex_free(&aval, at->item);
	}
	sk_ASN1_VALUE_free(avals);
}

static int
asn1_template_stack_of_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *at,
    int optional, int depth)
{
	CBS cbs_object, cbs_object_content;
	STACK_OF(ASN1_VALUE) *avals = NULL;
	ASN1_VALUE *aval = NULL;
	int tag_number, tag_class;
	int eoc_needed;
	int indefinite;
	size_t length;
	int ret;

	CBS_init(&cbs_object, CBS_data(cbs), CBS_len(cbs));

	if (pval == NULL)
		return 0;

	asn1_template_stack_of_free((STACK_OF(ASN1_VALUE) *)*pval, at);
	*pval = NULL;

	tag_number = at->tag;
	tag_class = at->flags & ASN1_TFLG_TAG_CLASS;

	/* Determine the inner tag value for SET OF or SEQUENCE OF. */
	if ((at->flags & ASN1_TFLG_IMPTAG) == 0) {
		tag_number = V_ASN1_SEQUENCE;
		tag_class = V_ASN1_UNIVERSAL;
		if ((at->flags & ASN1_TFLG_SET_OF) != 0)
			tag_number = V_ASN1_SET;
	}

	ret = asn1_check_tag(&cbs_object, &length, NULL, NULL, &indefinite,
	    NULL, tag_number, tag_class, optional);
	if (ret == -1)
		return -1;
	if (ret != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		return 0;
	}

	if (indefinite) {
		eoc_needed = 1;
		CBS_init(&cbs_object_content, CBS_data(&cbs_object),
		    CBS_len(&cbs_object));
	} else {
		eoc_needed = 0;
		if (!CBS_get_bytes(&cbs_object, &cbs_object_content,
		    length))
			goto err;
	}

	if ((avals = sk_ASN1_VALUE_new_null()) == NULL) {
		ASN1error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	/* Read as many items as possible. */
	while (CBS_len(&cbs_object_content) > 0) {
		if (asn1_check_eoc(&cbs_object_content)) {
			if (!eoc_needed) {
				ASN1error(ASN1_R_UNEXPECTED_EOC);
				goto err;
			}
			eoc_needed = 0;
			break;
		}
		if (!asn1_item_d2i(&aval, &cbs_object_content, at->item, -1, 0,
		    0, depth)) {
			ASN1error(ERR_R_NESTED_ASN1_ERROR);
			goto err;
		}
		if (!sk_ASN1_VALUE_push(avals, aval)) {
			ASN1error(ERR_R_MALLOC_FAILURE);
			goto err;
		}
		aval = NULL;




	}
	if (eoc_needed) {
		ASN1error(ASN1_R_MISSING_EOC);
		goto err;
	}

	if (indefinite) {
		if (!CBS_skip(&cbs_object, CBS_offset(&cbs_object_content)))
			goto err;
	}

	if (!CBS_skip(cbs, CBS_offset(&cbs_object)))
		goto err;

	*pval = (ASN1_VALUE *)avals;
	avals = NULL;

	return 1;

 err:
	asn1_template_stack_of_free(avals, at);
	ASN1_item_ex_free(&aval, at->item);

	return 0;
}

static int
asn1_template_noexp_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *at,
    int optional, int depth)
{
	int tag_number, tag_class;
	int ret;


	if (pval == NULL)
		return 0;

	if ((at->flags & ASN1_TFLG_SK_MASK) != 0)
		return asn1_template_stack_of_d2i(pval, cbs, at, optional, depth);

	tag_number = -1;
	tag_class = V_ASN1_UNIVERSAL;

	/* See if we need to use IMPLICIT tagging. */
	if ((at->flags & ASN1_TFLG_IMPTAG) != 0) {
		tag_number = at->tag;
		tag_class = at->flags & ASN1_TFLG_TAG_CLASS;
	}

	ret = asn1_item_d2i(pval, cbs, at->item, tag_number, tag_class,
	    optional, depth);
	if (ret == -1)
		return -1;
	if (ret != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		goto err;
	}

	return 1;

 err:
	/* XXX - The called function should have freed already. */
	ASN1_template_free(pval, at);
	return 0;
}

static int
asn1_template_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *at,
    int optional, int depth)
{
	CBS cbs_exp, cbs_exp_content;
	int constructed, indefinite;
	size_t length;
	int ret;

	if (pval == NULL)
		return 0;

	/* Check if EXPLICIT tag is expected. */
	if ((at->flags & ASN1_TFLG_EXPTAG) == 0)
		return asn1_template_noexp_d2i(pval, cbs, at, optional, depth);

	CBS_init(&cbs_exp, CBS_data(cbs), CBS_len(cbs));

	/* Read ASN.1 header for EXPLICIT tagged object. */
	ret = asn1_check_tag(&cbs_exp, &length, NULL, NULL, &indefinite,
	    &constructed, at->tag, at->flags & ASN1_TFLG_TAG_CLASS, optional);
	if (ret == -1)
		return -1;
	if (ret != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		return 0;
	}

	if (!constructed) {
		ASN1error(ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
		return 0;
	}

	if (indefinite) {
		CBS_init(&cbs_exp_content, CBS_data(&cbs_exp), CBS_len(&cbs_exp));
	} else {
		if (!CBS_get_bytes(&cbs_exp, &cbs_exp_content, length))
			goto err;
	}

	if ((ret = asn1_template_noexp_d2i(pval, &cbs_exp_content, at, 0,
	    depth)) != 1) {
		ASN1error(ERR_R_NESTED_ASN1_ERROR);
		return 0;
	}

	if (indefinite) {
		if (!asn1_check_eoc(&cbs_exp_content)) {
			ASN1error(ASN1_R_MISSING_EOC);
			goto err;
		}
		if (!CBS_skip(&cbs_exp, CBS_offset(&cbs_exp_content)))
			goto err;
	} else if (CBS_len(&cbs_exp_content) != 0) {
		ASN1error(ASN1_R_SEQUENCE_LENGTH_MISMATCH);
		goto err;
	}

	if (!CBS_skip(cbs, CBS_offset(&cbs_exp)))
		goto err;

	return 1;

 err:
	ASN1_template_free(pval, at);
	return 0;
}

ASN1_VALUE *
ASN1_item_d2i(ASN1_VALUE **pval, const unsigned char **in, long inlen,
    const ASN1_ITEM *it)
{
	ASN1_VALUE *ptmpval = NULL;

	if (pval == NULL)
		pval = &ptmpval;
	if (ASN1_item_ex_d2i(pval, in, inlen, it, -1, 0, 0, NULL) <= 0)
		return NULL;

	return *pval;
}

int
ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long inlen,
    const ASN1_ITEM *it, int tag_number, int tag_class, char optional,
    ASN1_TLC *ctx)
{
	CBS cbs;
	int ret;

	if (inlen < 0)
		return 0;

	CBS_init(&cbs, *in, inlen);
	if ((ret = asn1_item_d2i(pval, &cbs, it, tag_number, tag_class,
	    (int)optional, 0)) == 1)
		*in = CBS_data(&cbs);

	return ret;
}

int
ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
    const ASN1_TEMPLATE *at)
{
	CBS cbs;
	int ret;

	if (len < 0)
		return 0;

	CBS_init(&cbs, *in, len);
	if ((ret = asn1_template_d2i(pval, &cbs, at, 0, 0)) == 1)
		*in = CBS_data(&cbs);

	return ret;
}
Changes to jni/libressl/crypto/asn1/tasn_enc.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_enc.c,v 1.24 2022/01/07 11:13:54 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_enc.c,v 1.25.2.1 2022/10/20 09:47:01 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
	return 1;
}

static int
asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
    const ASN1_ITEM *it, int tag, int aclass)
{
	int len;
	int utype;
	int usetag;
	int ndef = 0;

	utype = it->utype;

	/* Get length of content octets and maybe find
	 * out the underlying type.
	 */

	len = asn1_ex_i2c(pval, NULL, &utype, it);

	/* If SEQUENCE, SET or OTHER then header is
	 * included in pseudo content octets so don't
	 * include tag+length. We need to check here
	 * because the call to asn1_ex_i2c() could change
	 * utype.
	 */







|










|







490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
	return 1;
}

static int
asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
    const ASN1_ITEM *it, int tag, int aclass)
{
	int olen, len;
	int utype;
	int usetag;
	int ndef = 0;

	utype = it->utype;

	/* Get length of content octets and maybe find
	 * out the underlying type.
	 */

	olen = len = asn1_ex_i2c(pval, NULL, &utype, it);

	/* If SEQUENCE, SET or OTHER then header is
	 * included in pseudo content octets so don't
	 * include tag+length. We need to check here
	 * because the call to asn1_ex_i2c() could change
	 * utype.
	 */
524
525
526
527
528
529
530




531
532
533
534
535
536
537
538
539
540

541
542
543
544
545
546
547
		return 0;

	/* -2 return is special meaning use ndef */
	if (len == -2) {
		ndef = 2;
		len = 0;
	}





	/* If not implicitly tagged get tag from underlying type */
	if (tag == -1)
		tag = utype;

	/* Output tag+length followed by content octets */
	if (out) {
		if (usetag)
			ASN1_put_object(out, ndef, len, tag, aclass);
		asn1_ex_i2c(pval, *out, &utype, it);

		if (ndef)
			ASN1_put_eoc(out);
		else
			*out += len;
	}

	if (usetag)







>
>
>
>









|
>







524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
		return 0;

	/* -2 return is special meaning use ndef */
	if (len == -2) {
		ndef = 2;
		len = 0;
	}

	/* Treat any other negative value as an error. */
	if (len < 0)
		return -1;

	/* If not implicitly tagged get tag from underlying type */
	if (tag == -1)
		tag = utype;

	/* Output tag+length followed by content octets */
	if (out) {
		if (usetag)
			ASN1_put_object(out, ndef, len, tag, aclass);
		if (asn1_ex_i2c(pval, *out, &utype, it) != olen)
			return -1;
		if (ndef)
			ASN1_put_eoc(out);
		else
			*out += len;
	}

	if (usetag)
Changes to jni/libressl/crypto/asn1/tasn_fre.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_fre.c,v 1.18 2022/01/07 12:24:17 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_fre.c,v 1.20 2022/05/12 19:55:58 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <stddef.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>

#include "asn1_locl.h"

static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
    int combine);

/* Free up an ASN1 structure */

void
ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
{
	asn1_item_combine_free(&val, it, 0);
}

void
ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	asn1_item_combine_free(pval, it, 0);
}

static void
asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
{
	const ASN1_TEMPLATE *tt = NULL, *seqtt;
	const ASN1_EXTERN_FUNCS *ef;
	const ASN1_AUX *aux = it->funcs;
	ASN1_aux_cb *asn1_cb = NULL;
	int i;








|
<






|





|



|







60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <stddef.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>

#include "asn1_locl.h"

static void asn1_item_free(ASN1_VALUE **pval, const ASN1_ITEM *it);


/* Free up an ASN1 structure */

void
ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
{
	asn1_item_free(&val, it);
}

void
ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	asn1_item_free(pval, it);
}

static void
asn1_item_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	const ASN1_TEMPLATE *tt = NULL, *seqtt;
	const ASN1_EXTERN_FUNCS *ef;
	const ASN1_AUX *aux = it->funcs;
	ASN1_aux_cb *asn1_cb = NULL;
	int i;

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
			ASN1_VALUE **pchval;
			tt = it->templates + i;
			pchval = asn1_get_field_ptr(pval, tt);
			ASN1_template_free(pchval, tt);
		}
		if (asn1_cb)
			asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
		if (!combine) {
			free(*pval);
			*pval = NULL;
		}
		break;

	case ASN1_ITYPE_EXTERN:
		ef = it->funcs;
		if (ef && ef->asn1_ex_free)
			ef->asn1_ex_free(pval, it);
		break;

	case ASN1_ITYPE_NDEF_SEQUENCE:
	case ASN1_ITYPE_SEQUENCE:
		if (asn1_do_lock(pval, -1, it) > 0)
			return;
		if (asn1_cb) {
			i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
			if (i == 2)
				return;
		}
		asn1_enc_free(pval, it);
		/* If we free up as normal we will invalidate any
		 * ANY DEFINED BY field and we wont be able to
		 * determine the type of the field it defines. So
		 * free up in reverse order.
		 */
		tt = it->templates + it->tcount - 1;
		for (i = 0; i < it->tcount; tt--, i++) {
			ASN1_VALUE **pseqval;
			seqtt = asn1_do_adb(pval, tt, 0);
			if (!seqtt)
				continue;
			pseqval = asn1_get_field_ptr(pval, seqtt);
			ASN1_template_free(pseqval, seqtt);
		}
		if (asn1_cb)
			asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
		if (!combine) {
			free(*pval);
			*pval = NULL;
		}
		break;
	}
}

void
ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
	int i;
	if (tt->flags & ASN1_TFLG_SK_MASK) {
		STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
		for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
			ASN1_VALUE *vtmp;
			vtmp = sk_ASN1_VALUE_value(sk, i);
			asn1_item_combine_free(&vtmp, tt->item,
			    0);
		}
		sk_ASN1_VALUE_free(sk);
		*pval = NULL;
	} else
		asn1_item_combine_free(pval, tt->item,
		    tt->flags & ASN1_TFLG_COMBINE);
}

void
ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	int utype;








<
|
|
<

















|
















<
|
|
<













|
<




|
<







121
122
123
124
125
126
127

128
129

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

164
165

166
167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
183
184

185
186
187
188
189
190
191
			ASN1_VALUE **pchval;
			tt = it->templates + i;
			pchval = asn1_get_field_ptr(pval, tt);
			ASN1_template_free(pchval, tt);
		}
		if (asn1_cb)
			asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);

		free(*pval);
		*pval = NULL;

		break;

	case ASN1_ITYPE_EXTERN:
		ef = it->funcs;
		if (ef && ef->asn1_ex_free)
			ef->asn1_ex_free(pval, it);
		break;

	case ASN1_ITYPE_NDEF_SEQUENCE:
	case ASN1_ITYPE_SEQUENCE:
		if (asn1_do_lock(pval, -1, it) > 0)
			return;
		if (asn1_cb) {
			i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
			if (i == 2)
				return;
		}
		asn1_enc_cleanup(pval, it);
		/* If we free up as normal we will invalidate any
		 * ANY DEFINED BY field and we wont be able to
		 * determine the type of the field it defines. So
		 * free up in reverse order.
		 */
		tt = it->templates + it->tcount - 1;
		for (i = 0; i < it->tcount; tt--, i++) {
			ASN1_VALUE **pseqval;
			seqtt = asn1_do_adb(pval, tt, 0);
			if (!seqtt)
				continue;
			pseqval = asn1_get_field_ptr(pval, seqtt);
			ASN1_template_free(pseqval, seqtt);
		}
		if (asn1_cb)
			asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);

		free(*pval);
		*pval = NULL;

		break;
	}
}

void
ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
	int i;
	if (tt->flags & ASN1_TFLG_SK_MASK) {
		STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
		for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
			ASN1_VALUE *vtmp;
			vtmp = sk_ASN1_VALUE_value(sk, i);
			asn1_item_free(&vtmp, tt->item);

		}
		sk_ASN1_VALUE_free(sk);
		*pval = NULL;
	} else
		asn1_item_free(pval, tt->item);

}

void
ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	int utype;

Changes to jni/libressl/crypto/asn1/tasn_new.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_new.c,v 1.21 2022/01/07 12:24:17 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_new.c,v 1.22 2022/05/10 05:19:22 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <openssl/objects.h>
#include <openssl/err.h>
#include <openssl/asn1t.h>
#include <string.h>

#include "asn1_locl.h"

static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
    int combine);
static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);

ASN1_VALUE *
ASN1_item_new(const ASN1_ITEM *it)
{
	ASN1_VALUE *ret = NULL;
	if (ASN1_item_ex_new(&ret, it) > 0)
		return ret;
	return NULL;
}

/* Allocate an ASN1 structure */

int
ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	return asn1_item_ex_combine_new(pval, it, 0);
}

static int
asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
{
	const ASN1_TEMPLATE *tt = NULL;
	const ASN1_EXTERN_FUNCS *ef;
	const ASN1_AUX *aux = it->funcs;
	ASN1_aux_cb *asn1_cb = NULL;
	ASN1_VALUE **pseqval;
	int i;

	if (aux != NULL && aux->asn1_cb != NULL)
		asn1_cb = aux->asn1_cb;

	if (!combine)
		*pval = NULL;


	switch (it->itype) {
	case ASN1_ITYPE_EXTERN:
		ef = it->funcs;
		if (ef && ef->asn1_ex_new) {
			if (!ef->asn1_ex_new(pval, it))
				goto memerr;







|
<


















|



|











<
|
<







62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104

105
106
107
108
109
110
111
#include <openssl/objects.h>
#include <openssl/err.h>
#include <openssl/asn1t.h>
#include <string.h>

#include "asn1_locl.h"

static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);

static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);

ASN1_VALUE *
ASN1_item_new(const ASN1_ITEM *it)
{
	ASN1_VALUE *ret = NULL;
	if (ASN1_item_ex_new(&ret, it) > 0)
		return ret;
	return NULL;
}

/* Allocate an ASN1 structure */

int
ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	return asn1_item_ex_new(pval, it);
}

static int
asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	const ASN1_TEMPLATE *tt = NULL;
	const ASN1_EXTERN_FUNCS *ef;
	const ASN1_AUX *aux = it->funcs;
	ASN1_aux_cb *asn1_cb = NULL;
	ASN1_VALUE **pseqval;
	int i;

	if (aux != NULL && aux->asn1_cb != NULL)
		asn1_cb = aux->asn1_cb;


	*pval = NULL;


	switch (it->itype) {
	case ASN1_ITYPE_EXTERN:
		ef = it->funcs;
		if (ef && ef->asn1_ex_new) {
			if (!ef->asn1_ex_new(pval, it))
				goto memerr;
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
			i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
			if (!i)
				goto auxerr;
			if (i == 2) {
				return 1;
			}
		}
		if (!combine) {
			*pval = calloc(1, it->size);
			if (!*pval)
				goto memerr;
		}
		asn1_set_choice_selector(pval, -1, it);
		if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
			goto auxerr;
		break;

	case ASN1_ITYPE_NDEF_SEQUENCE:
	case ASN1_ITYPE_SEQUENCE:
		if (asn1_cb) {
			i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
			if (!i)
				goto auxerr;
			if (i == 2) {
				return 1;
			}
		}
		if (!combine) {
			*pval = calloc(1, it->size);
			if (!*pval)
				goto memerr;
			asn1_do_lock(pval, 0, it);
			asn1_enc_init(pval, it);
		}
		for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
			pseqval = asn1_get_field_ptr(pval, tt);
			if (!ASN1_template_new(pseqval, tt))
				goto memerr;
		}
		if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
			goto auxerr;







<
|
|
|
<















<
|
|
|
|
|
<







130
131
132
133
134
135
136

137
138
139

140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

155
156
157
158
159

160
161
162
163
164
165
166
			i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
			if (!i)
				goto auxerr;
			if (i == 2) {
				return 1;
			}
		}

		*pval = calloc(1, it->size);
		if (!*pval)
			goto memerr;

		asn1_set_choice_selector(pval, -1, it);
		if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
			goto auxerr;
		break;

	case ASN1_ITYPE_NDEF_SEQUENCE:
	case ASN1_ITYPE_SEQUENCE:
		if (asn1_cb) {
			i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
			if (!i)
				goto auxerr;
			if (i == 2) {
				return 1;
			}
		}

		*pval = calloc(1, it->size);
		if (!*pval)
			goto memerr;
		asn1_do_lock(pval, 0, it);
		asn1_enc_init(pval, it);

		for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
			pseqval = asn1_get_field_ptr(pval, tt);
			if (!ASN1_template_new(pseqval, tt))
				goto memerr;
		}
		if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
			goto auxerr;
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
			goto done;
		}
		*pval = (ASN1_VALUE *)skval;
		ret = 1;
		goto done;
	}
	/* Otherwise pass it back to the item routine */
	ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE);
 done:
	return ret;
}

static void
asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{







|







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
			goto done;
		}
		*pval = (ASN1_VALUE *)skval;
		ret = 1;
		goto done;
	}
	/* Otherwise pass it back to the item routine */
	ret = asn1_item_ex_new(pval, it);
 done:
	return ret;
}

static void
asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
Changes to jni/libressl/crypto/asn1/tasn_utl.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_utl.c,v 1.13 2021/12/25 13:17:48 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tasn_utl.c,v 1.17 2022/05/12 19:55:58 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
52
53
54
55
56
57
58

59
60

61
62
63
64


65
66
67
68
69
70
71
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */


#include <stddef.h>
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>
#include <openssl/err.h>



/* Utility functions for manipulating fields and offsets */

/* Add 'offset' to 'addr' */
#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)

/* Given an ASN1_ITEM CHOICE type return







>


>




>
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include <limits.h>
#include <stddef.h>
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>
#include <openssl/err.h>

#include "bytestring.h"

/* Utility functions for manipulating fields and offsets */

/* Add 'offset' to 'addr' */
#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)

/* Given an ASN1_ITEM CHOICE type return
119
120
121
122
123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141

142
143
144
145
146
147


148






149
150
151
152
153
154
155
156
157
158
159
160

161
162
163
164
165
166
167


168
169
170
171
172
173
174
175
176





177
178
179
180
181
182
183
184
185
186
187
188
189
190


191
192

193
194
195
196
197

198

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
	ret = CRYPTO_add(lck, op, aux->ref_lock);
	return ret;
}

static ASN1_ENCODING *
asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	const ASN1_AUX *aux;

	if (!pval || !*pval)
		return NULL;
	aux = it->funcs;
	if (!aux || !(aux->flags & ASN1_AFLG_ENCODING))
		return NULL;

	return offset2ptr(*pval, aux->enc_offset);
}

void
asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	ASN1_ENCODING *enc;

	enc = asn1_get_enc_ptr(pval, it);

	if (enc) {
		enc->enc = NULL;
		enc->len = 0;
		enc->modified = 1;
	}
}









void
asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	ASN1_ENCODING *enc;

	enc = asn1_get_enc_ptr(pval, it);
	if (enc) {
		free(enc->enc);
		enc->enc = NULL;
		enc->len = 0;
		enc->modified = 1;
	}

}

int
asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
    const ASN1_ITEM *it)
{
	ASN1_ENCODING *enc;



	enc = asn1_get_enc_ptr(pval, it);
	if (!enc)
		return 1;

	free(enc->enc);
	enc->enc = malloc(inlen);
	if (!enc->enc)
		return 0;





	memcpy(enc->enc, in, inlen);
	enc->len = inlen;
	enc->modified = 0;

	return 1;
}

int
asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
    const ASN1_ITEM *it)
{
	ASN1_ENCODING *enc;

	enc = asn1_get_enc_ptr(pval, it);


	if (!enc || enc->modified)
		return 0;

	if (out) {
		memcpy(*out, enc->enc, enc->len);
		*out += enc->len;
	}
	if (len)

		*len = enc->len;

	return 1;
}

/* Given an ASN1_TEMPLATE get a pointer to a field */
ASN1_VALUE **
asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
	ASN1_VALUE **pvaltmp;

	if (tt->flags & ASN1_TFLG_COMBINE)
		return pval;
	pvaltmp = offset2ptr(*pval, tt->offset);
	/* NOTE for BOOLEAN types the field is just a plain
 	 * int so we can't return int **, so settle for
	 * (int *).
	 */
	return pvaltmp;
}







|

|

|
|

>






|

|
>
|
|
|
|
|
|
>
>
|
>
>
>
>
>
>

|

|

|
<
|
<
<
<
|
>



|
<

|
>
>

|
<


|
|
|

>
>
>
>
>
|
|
|





|


|

|
>
>
|

>
|
|
|

|
>
|
>









<
<







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

169



170
171
172
173
174
175

176
177
178
179
180
181

182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228


229
230
231
232
233
234
235
	ret = CRYPTO_add(lck, op, aux->ref_lock);
	return ret;
}

static ASN1_ENCODING *
asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	const ASN1_AUX *aux = it->funcs;

	if (pval == NULL || *pval == NULL)
		return NULL;

	if (aux == NULL || (aux->flags & ASN1_AFLG_ENCODING) == 0)
		return NULL;

	return offset2ptr(*pval, aux->enc_offset);
}

void
asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	ASN1_ENCODING *aenc;

	if ((aenc = asn1_get_enc_ptr(pval, it)) == NULL)
		return;

	aenc->enc = NULL;
	aenc->len = 0;
	aenc->modified = 1;
}

static void
asn1_enc_clear(ASN1_ENCODING *aenc)
{
	freezero(aenc->enc, aenc->len);
	aenc->enc = NULL;
	aenc->len = 0;
	aenc->modified = 1;
}

void
asn1_enc_cleanup(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	ASN1_ENCODING *aenc;

	if ((aenc = asn1_get_enc_ptr(pval, it)) == NULL)

		return;




	asn1_enc_clear(aenc);
}

int
asn1_enc_save(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it)

{
	ASN1_ENCODING *aenc;
	uint8_t *data = NULL;
	size_t data_len = 0;

	if ((aenc = asn1_get_enc_ptr(pval, it)) == NULL)

		return 1;

	asn1_enc_clear(aenc);

	if (!CBS_stow(cbs, &data, &data_len))
		return 0;
	if (data_len > LONG_MAX) {
		freezero(data, data_len);
		return 0;
	}

	aenc->enc = data;
	aenc->len = (long)data_len;
	aenc->modified = 0;

	return 1;
}

int
asn1_enc_restore(int *out_len, unsigned char **out, ASN1_VALUE **pval,
    const ASN1_ITEM *it)
{
	ASN1_ENCODING *aenc;

	if ((aenc = asn1_get_enc_ptr(pval, it)) == NULL)
		return 0;

	if (aenc->modified)
		return 0;

	if (out != NULL) {
		memcpy(*out, aenc->enc, aenc->len);
		*out += aenc->len;
	}

	if (out_len != NULL)
		*out_len = aenc->len;

	return 1;
}

/* Given an ASN1_TEMPLATE get a pointer to a field */
ASN1_VALUE **
asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
	ASN1_VALUE **pvaltmp;



	pvaltmp = offset2ptr(*pval, tt->offset);
	/* NOTE for BOOLEAN types the field is just a plain
 	 * int so we can't return int **, so settle for
	 * (int *).
	 */
	return pvaltmp;
}
Changes to jni/libressl/crypto/asn1/x_attrib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x_attrib.c,v 1.16 2021/12/25 13:17:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x_attrib.c,v 1.17 2022/05/09 19:19:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

#include <openssl/asn1t.h>
#include <openssl/objects.h>
#include <openssl/x509.h>

#include "x509_lcl.h"

/* X509_ATTRIBUTE: this has the following form:
 *
 * typedef struct x509_attributes_st
 *	{
 *	ASN1_OBJECT *object;
 *	int single;
 *	union	{
 *		char		*ptr;
 * 		STACK_OF(ASN1_TYPE) *set;
 * 		ASN1_TYPE	*single;
 *		} value;
 *	} X509_ATTRIBUTE;
 *
 * this needs some extra thought because the CHOICE type is
 * merged with the main structure and because the value can
 * be anything at all we *must* try the SET OF first because
 * the ASN1_ANY type will swallow anything including the whole
 * SET OF structure.
 */

static const ASN1_TEMPLATE X509_ATTRIBUTE_SET_ch_tt[] = {
	{
		.flags = ASN1_TFLG_SET_OF,
		.tag = 0,
		.offset = offsetof(X509_ATTRIBUTE, value.set),
		.field_name = "value.set",
		.item = &ASN1_ANY_it,
	},
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(X509_ATTRIBUTE, value.single),
		.field_name = "value.single",
		.item = &ASN1_ANY_it,
	},
};

const ASN1_ITEM X509_ATTRIBUTE_SET_it = {
	.itype = ASN1_ITYPE_CHOICE,
	.utype = offsetof(X509_ATTRIBUTE, single),
	.templates = X509_ATTRIBUTE_SET_ch_tt,
	.tcount = sizeof(X509_ATTRIBUTE_SET_ch_tt) / sizeof(ASN1_TEMPLATE),
	.funcs = NULL,
	.size = sizeof(X509_ATTRIBUTE),
	.sname = "X509_ATTRIBUTE",
};

static const ASN1_TEMPLATE X509_ATTRIBUTE_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(X509_ATTRIBUTE, object),
		.field_name = "object",
		.item = &ASN1_OBJECT_it,
	},
	/* CHOICE type merged with parent */
	{
		.flags = 0 | ASN1_TFLG_COMBINE,
		.tag = 0,
		.offset = 0,
		.field_name = NULL,
		.item = &X509_ATTRIBUTE_SET_it,
	},
};

const ASN1_ITEM X509_ATTRIBUTE_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = X509_ATTRIBUTE_seq_tt,







|
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


|
|
|













<

|

|
|
|







60
61
62
63
64
65
66
67










68






69


















70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98
99
100

#include <openssl/asn1t.h>
#include <openssl/objects.h>
#include <openssl/x509.h>

#include "x509_lcl.h"

/*










 * XXX - remove X509_ATTRIBUTE_SET_it with next major bump.






 */


















const ASN1_ITEM X509_ATTRIBUTE_SET_it = {
	.itype = ASN1_ITYPE_CHOICE,
	.utype = 0,
	.templates = NULL,
	.tcount = 0,
	.funcs = NULL,
	.size = sizeof(X509_ATTRIBUTE),
	.sname = "X509_ATTRIBUTE",
};

static const ASN1_TEMPLATE X509_ATTRIBUTE_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(X509_ATTRIBUTE, object),
		.field_name = "object",
		.item = &ASN1_OBJECT_it,
	},

	{
		.flags = ASN1_TFLG_SET_OF,
		.tag = 0,
		.offset = offsetof(X509_ATTRIBUTE, set),
		.field_name = "set",
		.item = &ASN1_ANY_it,
	},
};

const ASN1_ITEM X509_ATTRIBUTE_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = X509_ATTRIBUTE_seq_tt,
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
	ASN1_OBJECT *oid;

	if ((oid = OBJ_nid2obj(nid)) == NULL)
		return (NULL);
	if ((ret = X509_ATTRIBUTE_new()) == NULL)
		return (NULL);
	ret->object = oid;
	ret->single = 0;
	if ((ret->value.set = sk_ASN1_TYPE_new_null()) == NULL)
		goto err;
	if ((val = ASN1_TYPE_new()) == NULL)
		goto err;
	if (!sk_ASN1_TYPE_push(ret->value.set, val))
		goto err;

	ASN1_TYPE_set(val, atrtype, value);
	return (ret);

 err:
	if (ret != NULL)
		X509_ATTRIBUTE_free(ret);
	if (val != NULL)
		ASN1_TYPE_free(val);
	return (NULL);
}







<
<
<


|












144
145
146
147
148
149
150



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	ASN1_OBJECT *oid;

	if ((oid = OBJ_nid2obj(nid)) == NULL)
		return (NULL);
	if ((ret = X509_ATTRIBUTE_new()) == NULL)
		return (NULL);
	ret->object = oid;



	if ((val = ASN1_TYPE_new()) == NULL)
		goto err;
	if (!sk_ASN1_TYPE_push(ret->set, val))
		goto err;

	ASN1_TYPE_set(val, atrtype, value);
	return (ret);

 err:
	if (ret != NULL)
		X509_ATTRIBUTE_free(ret);
	if (val != NULL)
		ASN1_TYPE_free(val);
	return (NULL);
}
Changes to jni/libressl/crypto/asn1/x_bignum.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x_bignum.c,v 1.10 2019/04/01 15:49:22 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x_bignum.c,v 1.12 2022/07/30 13:42:25 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
57
58
59
60
61
62
63



64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 */

#include <stdio.h>

#include <openssl/asn1t.h>
#include <openssl/bn.h>




/*
 * Custom primitive type for BIGNUM handling. This reads in an ASN1_INTEGER as a
 * BIGNUM directly. Currently it ignores the sign which isn't a problem since
 * all BIGNUMs used are non negative and anything that looks negative is
 * normally due to an encoding error.
 */

static int bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it);


static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
    const ASN1_ITEM *it);
static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
    int utype, char *free_cont, const ASN1_ITEM *it);
static int bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
    int indent, const ASN1_PCTX *pctx);

static ASN1_PRIMITIVE_FUNCS bignum_pf = {
	.app_data = NULL,
	.flags = 0,
	.prim_new = bn_new,
	.prim_free = bn_free,
	.prim_clear = NULL,	/* XXX */
	.prim_c2i = bn_c2i,
	.prim_i2c = bn_i2c,
	.prim_print = bn_print,
};

const ASN1_ITEM BIGNUM_it = {
        .itype = ASN1_ITYPE_PRIMITIVE,







>
>
>

|
<
<
<




>













|







57
58
59
60
61
62
63
64
65
66
67
68



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 */

#include <stdio.h>

#include <openssl/asn1t.h>
#include <openssl/bn.h>

#include "asn1_locl.h"
#include "bytestring.h"

/*
 * Custom primitive type for that reads an ASN.1 INTEGER into a BIGNUM.



 */

static int bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void bn_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);

static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
    const ASN1_ITEM *it);
static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
    int utype, char *free_cont, const ASN1_ITEM *it);
static int bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
    int indent, const ASN1_PCTX *pctx);

static ASN1_PRIMITIVE_FUNCS bignum_pf = {
	.app_data = NULL,
	.flags = 0,
	.prim_new = bn_new,
	.prim_free = bn_free,
	.prim_clear = bn_clear,
	.prim_c2i = bn_c2i,
	.prim_i2c = bn_i2c,
	.prim_print = bn_print,
};

const ASN1_ITEM BIGNUM_it = {
        .itype = ASN1_ITYPE_PRIMITIVE,
108
109
110
111
112
113
114
115
116
117
118
119







120
121
122
123
124
125
126
127
128
129
130
131
132
133


134
135
136
137
138

139
140
141
142
143
144
145
146
147
148

149

150
151
152
153
154
155
156
157

158


159
160
161
162





163


164
165

166
167

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
        .size = 0,
        .sname = "BIGNUM",
};

static int
bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	*pval = (ASN1_VALUE *)BN_new();
	if (*pval)
		return 1;
	else
		return 0;







}

static void
bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	if (*pval == NULL)
		return;
	BN_clear_free((BIGNUM *)*pval);
	*pval = NULL;
}

static int
bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it)
{


	BIGNUM *bn;
	int pad, len;

	if (*pval == NULL)
		return -1;

	bn = (BIGNUM *)*pval;
	/* If MSB set in an octet we need a padding byte */
	if (BN_num_bits(bn) & 0x7)
		pad = 0;
	else
		pad = 1;
	if (cont) {
		if (pad)
			*cont++ = 0;
		len = BN_bn2bin(bn, cont);

	} else

		len = BN_num_bytes(bn);
	return pad + len;
}

static int
bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype,
    char *free_cont, const ASN1_ITEM *it)
{

	BIGNUM *bn;



	if (*pval == NULL) {
		if (bn_new(pval, it) == 0)
			return 0;





	}


	bn = (BIGNUM *)*pval;
	if (!BN_bin2bn(cont, len, bn)) {

		bn_free(pval, it);
		return 0;

	}
	return 1;
}

static int
bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent,
    const ASN1_PCTX *pctx)
{
	BIGNUM *bn = (BIGNUM *)*pval;

	if (!BN_print(out, bn))
		return 0;
	if (BIO_printf(out, "\n") <= 0)
		return 0;

	return 1;
}







|
<
|
|
|
>
>
>
>
>
>
>







|
|



|

>
>
|
|



>
|
|
|
<
|
|
|
<
|
|
>
|
>
|
|



|
|

>

>
>

<
|
|
>
>
>
>
>
|
>
>
|
|
>
|
|
>
|
|






|








109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152
153
154

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
        .size = 0,
        .sname = "BIGNUM",
};

static int
bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	if ((*pval = (ASN1_VALUE *)BN_new()) == NULL)

		return 0;

	return 1;
}

static void
bn_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	BN_free((BIGNUM *)*pval);
	*pval = NULL;
}

static void
bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	if (*pval == NULL)
		return;

	bn_clear(pval, it);
}

static int
bn_i2c(ASN1_VALUE **pval, unsigned char *content, int *putype, const ASN1_ITEM *it)
{
	ASN1_INTEGER *aint = NULL;
	unsigned char **pp = NULL;
	const BIGNUM *bn;
	int ret;

	if (*pval == NULL)
		return -1;

	bn = (const BIGNUM *)*pval;

	if ((aint = BN_to_ASN1_INTEGER(bn, NULL)) == NULL)

		return -1;

	if (content != NULL)

		pp = &content;

	ret = i2c_ASN1_INTEGER(aint, pp);

	ASN1_INTEGER_free(aint);

	return ret;
}

static int
bn_c2i(ASN1_VALUE **pval, const unsigned char *content, int len, int utype,
    char *free_content, const ASN1_ITEM *it)
{
	ASN1_INTEGER *aint = NULL;
	BIGNUM *bn;
	CBS cbs;
	int ret = 0;


	bn_clear(pval, it);

	if (len < 0)
		goto err;
	CBS_init(&cbs, content, len);
	if (!c2i_ASN1_INTEGER_cbs(&aint, &cbs))
		goto err;

	if ((bn = ASN1_INTEGER_to_BN(aint, NULL)) == NULL)
		goto err;
	*pval = (ASN1_VALUE *)bn;

	ret = 1;

 err:
	ASN1_INTEGER_free(aint);

	return ret;
}

static int
bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent,
    const ASN1_PCTX *pctx)
{
	const BIGNUM *bn = (BIGNUM *)*pval;

	if (!BN_print(out, bn))
		return 0;
	if (BIO_printf(out, "\n") <= 0)
		return 0;

	return 1;
}
Changes to jni/libressl/crypto/asn1/x_long.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x_long.c,v 1.16 2019/04/20 11:13:15 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x_long.c,v 1.18 2022/07/02 18:14:35 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
52
53
54
55
56
57
58
59
60
61
62
63
64


65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include <stdio.h>
#include <string.h>

#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/err.h>



/*
 * Custom primitive type for long handling. This converts between an
 * ASN1_INTEGER and a long directly.
 */

static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it);


static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
    const ASN1_ITEM *it);
static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
    int utype, char *free_cont, const ASN1_ITEM *it);
static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
    int indent, const ASN1_PCTX *pctx);

static ASN1_PRIMITIVE_FUNCS long_pf = {
	.app_data = NULL,
	.flags = 0,
	.prim_new = long_new,
	.prim_free = long_free,
	.prim_clear = long_free,	/* Clear should set to initial value */
	.prim_c2i = long_c2i,
	.prim_i2c = long_i2c,
	.prim_print = long_print,
};

const ASN1_ITEM LONG_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,







|





>
>








>

|

|
|








|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include <limits.h>
#include <string.h>

#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/err.h>

#include "asn1_locl.h"

/*
 * Custom primitive type for long handling. This converts between an
 * ASN1_INTEGER and a long directly.
 */

static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void long_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);

static int long_i2c(ASN1_VALUE **pval, unsigned char *content, int *putype,
    const ASN1_ITEM *it);
static int long_c2i(ASN1_VALUE **pval, const unsigned char *content, int len,
    int utype, char *free_content, const ASN1_ITEM *it);
static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
    int indent, const ASN1_PCTX *pctx);

static ASN1_PRIMITIVE_FUNCS long_pf = {
	.app_data = NULL,
	.flags = 0,
	.prim_new = long_new,
	.prim_free = long_free,
	.prim_clear = long_clear,
	.prim_c2i = long_c2i,
	.prim_i2c = long_i2c,
	.prim_print = long_print,
};

const ASN1_ITEM LONG_it = {
	.itype = ASN1_ITYPE_PRIMITIVE,
104
105
106
107
108
109
110












111
112
113
114

115
116
117
118
119
120
121







122
123
124
125
126
127
128


129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

149


150
151
152
153
154

155
156
157

158
159
160
161
162
163
164
165

166


167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183




184
185
186
187
188

189



190
191
192
193
194
195
196
197
198
199
200




201
202





203
204


205
206
207
208
209
210
211
212




213
214
215
216
217
	.utype = V_ASN1_INTEGER,
	.templates = NULL,
	.tcount = 0,
	.funcs = &long_pf,
	.size = 0,
	.sname = "ZLONG",
};













static int
long_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{

	*(long *)pval = it->size;
	return 1;
}

static void
long_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{







	*(long *)pval = it->size;
}

static int
long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
    const ASN1_ITEM *it)
{


	long ltmp;
	unsigned long utmp;
	int clen, pad, i;
	/* this exists to bypass broken gcc optimization */
	char *cp = (char *)pval;

	/* use memcpy, because we may not be long aligned */
	memcpy(&ltmp, cp, sizeof(long));

	if (ltmp == it->size)
		return -1;
	/* Convert the long to positive: we subtract one if negative so
	 * we can cleanly handle the padding if only the MSB of the leading
	 * octet is set.
	 */
	if (ltmp < 0)
		utmp = -(ltmp + 1);
	else
		utmp = ltmp;
	clen = BN_num_bits_word(utmp);

	/* If MSB of leading octet set we need to pad */


	if (!(clen & 0x7))
		pad = 1;
	else
		pad = 0;


	/* Convert number of bits to number of octets */
	clen = (clen + 7) >> 3;


	if (cont) {
		if (pad)
			*cont++ = (ltmp < 0) ? 0xff : 0;
		for (i = clen - 1; i >= 0; i--) {
			cont[i] = (unsigned char)(utmp & 0xff);
			if (ltmp < 0)
				cont[i] ^= 0xff;
			utmp >>= 8;

		}


	}
	return clen + pad;
}

static int
long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype,
    char *free_cont, const ASN1_ITEM *it)
{
	int neg, i;
	long ltmp;
	unsigned long utmp = 0;
	char *cp = (char *)pval;
	if (len > (int)sizeof(long)) {
		ASN1error(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
		return 0;
	}
	/* Is it negative? */




	if (len && (cont[0] & 0x80))
		neg = 1;
	else
		neg = 0;
	utmp = 0;

	for (i = 0; i < len; i++) {



		utmp <<= 8;
		if (neg)
			utmp |= cont[i] ^ 0xff;
		else
			utmp |= cont[i];
	}
	ltmp = (long)utmp;
	if (neg) {
		ltmp = -ltmp;
		ltmp--;
	}




	if (ltmp == it->size) {
		ASN1error(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);





		return 0;
	}


	memcpy(cp, &ltmp, sizeof(long));
	return 1;
}

static int
long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent,
    const ASN1_PCTX *pctx)
{




	if (BIO_printf(out, "%ld\n", *(long *)pval) <= 0)
		return 0;

	return 1;
}







>
>
>
>
>
>
>
>
>
>
>
>




>
|






>
>
>
>
>
>
>
|



|


>
>
|
<
|
<
<

<
<
|
<
<
<
<
<
<
<
<
<
|
<
>
|
>
>
|
<
|
<

>
|
<
|
>
|
<
<
<
<
<
|
<
>
|
>
>
|
|



|
|

|
|
|
<
<
<
|
|
|
>
>
>
>
|
|
<
<
|
>
|
>
>
>
|
|
|
|
<

<
<
<
<
|
>
>
>
>
|

>
>
>
>
>
|
|
>
>
|
|






>
>
>
>
|




107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

155


156


157









158

159
160
161
162
163

164

165
166
167

168
169
170





171

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186



187
188
189
190
191
192
193
194
195


196
197
198
199
200
201
202
203
204
205

206




207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
	.utype = V_ASN1_INTEGER,
	.templates = NULL,
	.tcount = 0,
	.funcs = &long_pf,
	.size = 0,
	.sname = "ZLONG",
};

static void
long_get(ASN1_VALUE **pval, long *out_val)
{
	memcpy(out_val, pval, sizeof(long));
}

static void
long_set(ASN1_VALUE **pval, long val)
{
	memcpy(pval, &val, sizeof(long));
}

static int
long_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	long_clear(pval, it);

	return 1;
}

static void
long_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	long_clear(pval, it);
}

static void
long_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
	/* Zero value. */
	long_set(pval, it->size);
}

static int
long_i2c(ASN1_VALUE **pval, unsigned char *content, int *putype,
    const ASN1_ITEM *it)
{
	ASN1_INTEGER *aint;
	uint8_t **pp = NULL;
	long val;

	int ret = 0;





	long_get(pval, &val);











	/*
	 * The zero value for this type (stored in the overloaded it->size
	 * field) is considered to be invalid.
	 */
	if (val == it->size)

		return -1;


	if ((aint = ASN1_INTEGER_new()) == NULL)
		goto err;

	if (!ASN1_INTEGER_set_int64(aint, (int64_t)val))
		goto err;
	if (content != NULL)





		pp = &content;

	ret = i2c_ASN1_INTEGER(aint, pp);

 err:
	ASN1_INTEGER_free(aint);

	return ret;
}

static int
long_c2i(ASN1_VALUE **pval, const unsigned char *content, int len, int utype,
    char *free_content, const ASN1_ITEM *it)
{
	ASN1_INTEGER *aint = NULL;
	const uint8_t **pp = NULL;
	int64_t val = 0;



	int ret = 0;

	/*
	 * The original long_i2c() mishandled 0 values and encoded them as
	 * content with zero length, rather than a single zero byte. Permit
	 * zero length content here for backwards compatibility.
	 */
	if (len != 0) {
		if (content != NULL)


			pp = &content;
		if (!c2i_ASN1_INTEGER(&aint, pp, len))
			goto err;
		if (!ASN1_INTEGER_get_int64(&val, aint))
			goto err;
	}

	if (val < LONG_MIN || val > LONG_MAX) {
		ASN1error(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
		goto err;

	}





	/*
	 * The zero value for this type (stored in the overloaded it->size
	 * field) is considered to be invalid.
	 */
	if (val == (int64_t)it->size) {
		ASN1error(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
		goto err;
	}

	long_set(pval, (long)val);

	ret = 1;

 err:
	ASN1_INTEGER_free(aint);

	return ret;
}

static int
long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent,
    const ASN1_PCTX *pctx)
{
	long val;

	long_get(pval, &val);

	if (BIO_printf(out, "%ld\n", val) <= 0)
		return 0;

	return 1;
}
Changes to jni/libressl/crypto/asn1/x_pubkey.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x_pubkey.c,v 1.31 2021/12/25 13:17:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x_pubkey.c,v 1.32 2022/05/24 19:59:14 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
712
713
714
715
716
717
718

719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734

int
X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype,
    void *pval, unsigned char *penc, int penclen)
{
	if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval))
		return 0;

	if (penc) {
		free(pub->public_key->data);
		pub->public_key->data = penc;
		pub->public_key->length = penclen;
		/* Set number of unused bits to zero */
		pub->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
		pub->public_key->flags |= ASN1_STRING_FLAG_BITS_LEFT;
	}
	return 1;
}

int
X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned char **pk,
    int *ppklen, X509_ALGOR **pa, X509_PUBKEY *pub)
{
	if (ppkalg)







>
|
|
|
|
<
<
<
|
|







712
713
714
715
716
717
718
719
720
721
722
723



724
725
726
727
728
729
730
731
732

int
X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype,
    void *pval, unsigned char *penc, int penclen)
{
	if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval))
		return 0;

	if (penc == NULL)
		return 1;

	ASN1_STRING_set0(pub->public_key, penc, penclen);




	return asn1_abs_set_unused_bits(pub->public_key, 0);
}

int
X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned char **pk,
    int *ppklen, X509_ALGOR **pa, X509_PUBKEY *pub)
{
	if (ppkalg)
Changes to jni/libressl/crypto/bio/bio_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bio_err.c,v 1.18 2022/01/14 08:40:57 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bio_err.c,v 1.19 2022/07/12 14:42:48 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/bio.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BIO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason)

static ERR_STRING_DATA BIO_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/bio.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BIO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason)

static ERR_STRING_DATA BIO_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/bio/bio_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bio_lib.c,v 1.35 2022/01/14 08:40:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bio_lib.c,v 1.36 2022/08/15 10:48:45 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474

	return (ret);
}

int
BIO_gets(BIO *b, char *in, int inl)
{
	size_t readbytes;
	int ret;

	if (b == NULL || b->method == NULL || b->method->bgets == NULL) {
		BIOerror(BIO_R_UNSUPPORTED_METHOD);
		return (-2);
	}








|







460
461
462
463
464
465
466
467
468
469
470
471
472
473
474

	return (ret);
}

int
BIO_gets(BIO *b, char *in, int inl)
{
	size_t readbytes = 0;
	int ret;

	if (b == NULL || b->method == NULL || b->method->bgets == NULL) {
		BIOerror(BIO_R_UNSUPPORTED_METHOD);
		return (-2);
	}

Added jni/libressl/crypto/bn/bn_bpsw.c.


























































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
/*	$OpenBSD: bn_bpsw.c,v 1.7 2022/08/31 21:34:14 tb Exp $ */
/*
 * Copyright (c) 2022 Martin Grenouilloux <martin.grenouilloux@lse.epita.fr>
 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/bn.h>

#include "bn_lcl.h"
#include "bn_prime.h"

/*
 * For an odd n compute a / 2 (mod n). If a is even, we can do a plain
 * division, otherwise calculate (a + n) / 2. Then reduce (mod n).
 */

static int
bn_div_by_two_mod_odd_n(BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
{
	if (!BN_is_odd(n))
		return 0;

	if (BN_is_odd(a)) {
		if (!BN_add(a, a, n))
			return 0;
	}
	if (!BN_rshift1(a, a))
		return 0;
	if (!BN_mod_ct(a, a, n, ctx))
		return 0;

	return 1;
}

/*
 * Given the next binary digit of k and the current Lucas terms U and V, this
 * helper computes the next terms in the Lucas sequence defined as follows:
 *
 *   U' = U * V                  (mod n)
 *   V' = (V^2 + D * U^2) / 2    (mod n)
 *
 * If digit == 0, bn_lucas_step() returns U' and V'. If digit == 1, it returns
 *
 *   U'' = (U' + V') / 2         (mod n)
 *   V'' = (V' + D * U') / 2     (mod n)
 *
 * Compare with FIPS 186-4, Appendix C.3.3, step 6.
 */

static int
bn_lucas_step(BIGNUM *U, BIGNUM *V, int digit, const BIGNUM *D,
    const BIGNUM *n, BN_CTX *ctx)
{
	BIGNUM *tmp;
	int ret = 0;

	BN_CTX_start(ctx);

	if ((tmp = BN_CTX_get(ctx)) == NULL)
		goto err;

	/* Calculate D * U^2 before computing U'. */
	if (!BN_sqr(tmp, U, ctx))
		goto err;
	if (!BN_mul(tmp, D, tmp, ctx))
		goto err;

	/* U' = U * V (mod n). */
	if (!BN_mod_mul(U, U, V, n, ctx))
		goto err;

	/* V' = (V^2 + D * U^2) / 2 (mod n). */
	if (!BN_sqr(V, V, ctx))
		goto err;
	if (!BN_add(V, V, tmp))
		goto err;
	if (!bn_div_by_two_mod_odd_n(V, n, ctx))
		goto err;

	if (digit == 1) {
		/* Calculate D * U' before computing U''. */
		if (!BN_mul(tmp, D, U, ctx))
			goto err;

		/* U'' = (U' + V') / 2 (mod n). */
		if (!BN_add(U, U, V))
			goto err;
		if (!bn_div_by_two_mod_odd_n(U, n, ctx))
			goto err;

		/* V'' = (V' + D * U') / 2 (mod n). */
		if (!BN_add(V, V, tmp))
			goto err;
		if (!bn_div_by_two_mod_odd_n(V, n, ctx))
			goto err;
	}

	ret = 1;

 err:
	BN_CTX_end(ctx);

	return ret;
}

/*
 * Compute the Lucas terms U_k, V_k, see FIPS 186-4, Appendix C.3.3, steps 4-6.
 */

static int
bn_lucas(BIGNUM *U, BIGNUM *V, const BIGNUM *k, const BIGNUM *D,
    const BIGNUM *n, BN_CTX *ctx)
{
	int digit, i;
	int ret = 0;

	if (!BN_one(U))
		goto err;
	if (!BN_one(V))
		goto err;

	/*
	 * Iterate over the digits of k from MSB to LSB. Start at digit 2
	 * since the first digit is dealt with by setting U = 1 and V = 1.
	 */

	for (i = BN_num_bits(k) - 2; i >= 0; i--) {
		digit = BN_is_bit_set(k, i);

		if (!bn_lucas_step(U, V, digit, D, n, ctx))
			goto err;
	}

	ret = 1;

 err:
	return ret;
}

/*
 * This is a stronger variant of the Lucas test in FIPS 186-4, Appendix C.3.3.
 * Every strong Lucas pseudoprime n is also a Lucas pseudoprime since
 * U_{n+1} == 0 follows from U_k == 0 or V_{k * 2^r} == 0 for 0 <= r < s.
 */

static int
bn_strong_lucas_test(int *is_prime, const BIGNUM *n, const BIGNUM *D,
    BN_CTX *ctx)
{
	BIGNUM *k, *U, *V;
	int r, s;
	int ret = 0;

	BN_CTX_start(ctx);

	if ((k = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((U = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((V = BN_CTX_get(ctx)) == NULL)
		goto err;

	/*
	 * Factorize n + 1 = k * 2^s with odd k: shift away the s trailing ones
	 * of n and set the lowest bit of the resulting number k.
	 */

	s = 0;
	while (BN_is_bit_set(n, s))
		s++;
	if (!BN_rshift(k, n, s))
		goto err;
	if (!BN_set_bit(k, 0))
		goto err;

	/*
	 * Calculate the Lucas terms U_k and V_k. If either of them is zero,
	 * then n is a strong Lucas pseudoprime.
	 */

	if (!bn_lucas(U, V, k, D, n, ctx))
		goto err;

	if (BN_is_zero(U) || BN_is_zero(V)) {
		*is_prime = 1;
		goto done;
	}

	/*
	 * Calculate the Lucas terms U_{k * 2^r}, V_{k * 2^r} for 1 <= r < s.
	 * If any V_{k * 2^r} is zero then n is a strong Lucas pseudoprime.
	 */

	for (r = 1; r < s; r++) {
		if (!bn_lucas_step(U, V, 0, D, n, ctx))
			goto err;

		if (BN_is_zero(V)) {
			*is_prime = 1;
			goto done;
		}
	}

	/*
	 * If we got here, n is definitely composite.
	 */

	*is_prime = 0;

 done:
	ret = 1;

 err:
	BN_CTX_end(ctx);

	return ret;
}

/*
 * Test n for primality using the strong Lucas test with Selfridge's Method A.
 * Returns 1 if n is prime or a strong Lucas-Selfridge pseudoprime.
 * If it returns 0 then n is definitely composite.
 */

static int
bn_strong_lucas_selfridge(int *is_prime, const BIGNUM *n, BN_CTX *ctx)
{
	BIGNUM *D, *two;
	int is_perfect_square, jacobi_symbol, sign;
	int ret = 0;

	BN_CTX_start(ctx);

	/* If n is a perfect square, it is composite. */
	if (!bn_is_perfect_square(&is_perfect_square, n, ctx))
		goto err;
	if (is_perfect_square) {
		*is_prime = 0;
		goto done;
	}

	/*
	 * Find the first D in the Selfridge sequence 5, -7, 9, -11, 13, ...
	 * such that the Jacobi symbol (D/n) is -1.
	 */

	if ((D = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((two = BN_CTX_get(ctx)) == NULL)
		goto err;

	sign = 1;
	if (!BN_set_word(D, 5))
		goto err;
	if (!BN_set_word(two, 2))
		goto err;

	while (1) {
		/* For odd n the Kronecker symbol computes the Jacobi symbol. */
		if ((jacobi_symbol = BN_kronecker(D, n, ctx)) == -2)
			goto err;

		/* We found the value for D. */
		if (jacobi_symbol == -1)
			break;

		/* n and D have prime factors in common. */
		if (jacobi_symbol == 0) {
			*is_prime = 0;
			goto done;
		}

		sign = -sign;
		if (!BN_uadd(D, D, two))
			goto err;
		BN_set_negative(D, sign == -1);
	}

	if (!bn_strong_lucas_test(is_prime, n, D, ctx))
		goto err;

 done:
	ret = 1;

 err:
	BN_CTX_end(ctx);

	return ret;
}

/*
 * Miller-Rabin primality test for base 2.
 */

static int
bn_miller_rabin_base_2(int *is_prime, const BIGNUM *n, BN_CTX *ctx)
{
	BIGNUM *n_minus_one, *k, *x;
	int i, s;
	int ret = 0;

	BN_CTX_start(ctx);

	if ((n_minus_one = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((k = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((x = BN_CTX_get(ctx)) == NULL)
		goto err;

	if (BN_is_word(n, 2) || BN_is_word(n, 3)) {
		*is_prime = 1;
		goto done;
	}

	if (BN_cmp(n, BN_value_one()) <= 0 || !BN_is_odd(n)) {
		*is_prime = 0;
		goto done;
	}

	if (!BN_sub(n_minus_one, n, BN_value_one()))
		goto err;

	/*
	 * Factorize n - 1 = k * 2^s.
	 */

	s = 0;
	while (!BN_is_bit_set(n_minus_one, s))
		s++;
	if (!BN_rshift(k, n_minus_one, s))
		goto err;

	/*
	 * If 2^k is 1 or -1 (mod n) then n is a 2-pseudoprime.
	 */

	if (!BN_set_word(x, 2))
		goto err;
	if (!BN_mod_exp_ct(x, x, k, n, ctx))
		goto err;

	if (BN_is_one(x) || BN_cmp(x, n_minus_one) == 0) {
		*is_prime = 1;
		goto done;
	}

	/*
	 * If 2^{2^i k} == -1 (mod n) for some 1 <= i < s, then n is a
	 * 2-pseudoprime.
	 */

	for (i = 1; i < s; i++) {
		if (!BN_mod_sqr(x, x, n, ctx))
			goto err;
		if (BN_cmp(x, n_minus_one) == 0) {
			*is_prime = 1;
			goto done;
		}
	}

	/*
	 * If we got here, n is definitely composite.
	 */

	*is_prime = 0;

 done:
	ret = 1;

 err:
	BN_CTX_end(ctx);

	return ret;
}

/*
 * The Baillie-Pomerance-Selfridge-Wagstaff algorithm combines a Miller-Rabin
 * test for base 2 with a Strong Lucas pseudoprime test.
 */

int
bn_is_prime_bpsw(int *is_prime, const BIGNUM *n, BN_CTX *in_ctx)
{
	BN_CTX *ctx = NULL;
	BN_ULONG mod;
	int i;
	int ret = 0;

	if (BN_is_word(n, 2)) {
		*is_prime = 1;
		goto done;
	}

	if (BN_cmp(n, BN_value_one()) <= 0 || !BN_is_odd(n)) {
		*is_prime = 0;
		goto done;
	}

	/* Trial divisions with the first 2048 primes. */
	for (i = 0; i < NUMPRIMES; i++) {
		if ((mod = BN_mod_word(n, primes[i])) == (BN_ULONG)-1)
			goto err;
		if (mod == 0) {
			*is_prime = BN_is_word(n, primes[i]);
			goto done;
		}
	}

	if ((ctx = in_ctx) == NULL)
		ctx = BN_CTX_new();
	if (ctx == NULL)
		goto err;

	if (!bn_miller_rabin_base_2(is_prime, n, ctx))
		goto err;
	if (!*is_prime)
		goto done;

	/* XXX - Miller-Rabin for random bases? See FIPS 186-4, Table C.1. */

	if (!bn_strong_lucas_selfridge(is_prime, n, ctx))
		goto err;

 done:
	ret = 1;

 err:
	if (ctx != in_ctx)
		BN_CTX_free(ctx);

	return ret;
}
Changes to jni/libressl/crypto/bn/bn_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_err.c,v 1.14 2017/01/29 17:49:22 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_err.c,v 1.15 2022/07/12 14:42:48 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/bn.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BN,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason)

static ERR_STRING_DATA BN_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/bn.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BN,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason)

static ERR_STRING_DATA BN_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/bn/bn_exp.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_exp.c,v 1.31 2017/05/02 03:59:44 deraadt Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_exp.c,v 1.32 2022/04/20 13:32:34 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
274
275
276
277
278
279
280


281
282
283
284
285
286
287
288
289
290
291
292
293
294
			ret = 1;
			BN_zero(r);
		} else
			ret = BN_one(r);
		return ret;
	}



	BN_CTX_start(ctx);
	if ((aa = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((val[0] = BN_CTX_get(ctx)) == NULL)
		goto err;

	BN_RECP_CTX_init(&recp);
	if (m->neg) {
		/* ignore sign of 'm' */
		if (!BN_copy(aa, m))
			goto err;
		aa->neg = 0;
		if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0)
			goto err;







>
>






<







274
275
276
277
278
279
280
281
282
283
284
285
286
287
288

289
290
291
292
293
294
295
			ret = 1;
			BN_zero(r);
		} else
			ret = BN_one(r);
		return ret;
	}

	BN_RECP_CTX_init(&recp);

	BN_CTX_start(ctx);
	if ((aa = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((val[0] = BN_CTX_get(ctx)) == NULL)
		goto err;


	if (m->neg) {
		/* ignore sign of 'm' */
		if (!BN_copy(aa, m))
			goto err;
		aa->neg = 0;
		if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0)
			goto err;
Added jni/libressl/crypto/bn/bn_isqrt.c.


























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*	$OpenBSD: bn_isqrt.c,v 1.2 2022/07/13 11:20:00 tb Exp $ */
/*
 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <stddef.h>
#include <stdint.h>

#include <openssl/bn.h>
#include <openssl/err.h>

#include "bn_lcl.h"

#define CTASSERT(x)	extern char  _ctassert[(x) ? 1 : -1 ]   \
			    __attribute__((__unused__))

/*
 * Calculate integer square root of |n| using a variant of Newton's method.
 *
 * Returns the integer square root of |n| in the caller-provided |out_sqrt|;
 * |*out_perfect| is set to 1 if and only if |n| is a perfect square.
 * One of |out_sqrt| and |out_perfect| can be NULL; |in_ctx| can be NULL.
 *
 * Returns 0 on error, 1 on success.
 *
 * Adapted from pure Python describing cpython's math.isqrt(), without bothering
 * with any of the optimizations in the C code. A correctness proof is here:
 * https://github.com/mdickinson/snippets/blob/master/proofs/isqrt/src/isqrt.lean
 * The comments in the Python code also give a rather detailed proof.
 */

int
bn_isqrt(BIGNUM *out_sqrt, int *out_perfect, const BIGNUM *n, BN_CTX *in_ctx)
{
	BN_CTX *ctx = NULL;
	BIGNUM *a, *b;
	int c, d, e, s;
	int cmp, perfect;
	int ret = 0;

	if (out_perfect == NULL && out_sqrt == NULL) {
		BNerror(ERR_R_PASSED_NULL_PARAMETER);
		goto err;
	}

	if (BN_is_negative(n)) {
		BNerror(BN_R_INVALID_RANGE);
		goto err;
	}

	if ((ctx = in_ctx) == NULL)
		ctx = BN_CTX_new();
	if (ctx == NULL)
		goto err;

	BN_CTX_start(ctx);

	if ((a = BN_CTX_get(ctx)) == NULL)
		goto err;
	if ((b = BN_CTX_get(ctx)) == NULL)
		goto err;

	if (BN_is_zero(n)) {
		perfect = 1;
		if (!BN_zero(a))
			goto err;
		goto done;
	}

	if (!BN_one(a))
		goto err;

	c = (BN_num_bits(n) - 1) / 2;
	d = 0;

	/* Calculate s = floor(log(c)). */
	if (!BN_set_word(b, c))
		goto err;
	s = BN_num_bits(b) - 1;

	/*
	 * By definition, the loop below is run <= floor(log(log(n))) times.
	 * Comments in the cpython code establish the loop invariant that
	 *
	 *	(a - 1)^2 < n / 4^(c - d) < (a + 1)^2
	 *
	 * holds true in every iteration. Once this is proved via induction,
	 * correctness of the algorithm is easy.
	 *
	 * Roughly speaking, A = (a << (d - e)) is used for one Newton step
	 * "a = (A >> 1) + (m >> 1) / A" approximating m = (n >> 2 * (c - d)).
	 */

	for (; s >= 0; s--) {
		e = d;
		d = c >> s;

		if (!BN_rshift(b, n, 2 * c - d - e + 1))
			goto err;

		if (!BN_div_ct(b, NULL, b, a, ctx))
			goto err;

		if (!BN_lshift(a, a, d - e - 1))
			goto err;

		if (!BN_add(a, a, b))
			goto err;
	}

	/*
	 * The loop invariant implies that either a or a - 1 is isqrt(n).
	 * Figure out which one it is. The invariant also implies that for
	 * a perfect square n, a must be the square root.
	 */

	if (!BN_sqr(b, a, ctx))
		goto err;

	/* If a^2 > n, we must have isqrt(n) == a - 1. */
	if ((cmp = BN_cmp(b, n)) > 0) {
		if (!BN_sub_word(a, 1))
			goto err;
	}

	perfect = cmp == 0;

 done:
	if (out_perfect != NULL)
		*out_perfect = perfect;

	if (out_sqrt != NULL) {
		if (!BN_copy(out_sqrt, a))
			goto err;
	}

	ret = 1;

 err:
	BN_CTX_end(ctx);

	if (ctx != in_ctx)
		BN_CTX_free(ctx);

	return ret;
}

/*
 * is_square_mod_N[r % N] indicates whether r % N has a square root modulo N.
 * The tables are generated in regress/lib/libcrypto/bn/bn_isqrt.c.
 */

const uint8_t is_square_mod_11[] = {
	1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0,
};
CTASSERT(sizeof(is_square_mod_11) == 11);

const uint8_t is_square_mod_63[] = {
	1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,
	1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0,
	0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
	0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
};
CTASSERT(sizeof(is_square_mod_63) == 63);

const uint8_t is_square_mod_64[] = {
	1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
	1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
	0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
	0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
};
CTASSERT(sizeof(is_square_mod_64) == 64);

const uint8_t is_square_mod_65[] = {
	1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0,
	1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0,
	0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
	0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0,
	1,
};
CTASSERT(sizeof(is_square_mod_65) == 65);

/*
 * Determine whether n is a perfect square or not.
 *
 * Returns 1 on success and 0 on error. In case of success, |*out_perfect| is
 * set to 1 if and only if |n| is a perfect square.
 */

int
bn_is_perfect_square(int *out_perfect, const BIGNUM *n, BN_CTX *ctx)
{
	BN_ULONG r;

	*out_perfect = 0;

	if (BN_is_negative(n))
		return 1;

	/*
	 * Before performing an expensive bn_isqrt() operation, weed out many
	 * obvious non-squares. See H. Cohen, "A course in computational
	 * algebraic number theory", Algorithm 1.7.3.
	 *
	 * The idea is that a square remains a square when reduced modulo any
	 * number. The moduli are chosen in such a way that a non-square has
	 * probability < 1% of passing the four table lookups.
	 */

	/* n % 64 */
	r = BN_lsw(n) & 0x3f;

	if (!is_square_mod_64[r % 64])
		return 1;

	if ((r = BN_mod_word(n, 11 * 63 * 65)) == (BN_ULONG)-1)
		return 0;

	if (!is_square_mod_63[r % 63] ||
	    !is_square_mod_65[r % 65] ||
	    !is_square_mod_11[r % 11])
		return 1;

	return bn_isqrt(NULL, out_perfect, n, ctx);
}
Changes to jni/libressl/crypto/bn/bn_kron.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_kron.c,v 1.6 2015/02/09 15:49:22 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_kron.c,v 1.10 2022/07/12 16:08:19 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
51
52
53
54
55
56
57
58
59

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76



77
78
79
80
81

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

107

108

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129


130






131
132
133
134
135

136
137
138
139

140
141

142

143
144
145

146
147
148
149
150
151

152
153
154
155
156
157
158
159
160

161
162
163
164

165








166
167
168

169




170
171
172

173
174
175
176

177
178
179
180
181
182
183
184
185
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include "bn_lcl.h"

/* least significant word */
#define BN_lsw(n) (((n)->top == 0) ? (BN_ULONG) 0 : (n)->d[0])


/* Returns -2 for errors because both -1 and 0 are valid results. */
int
BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
	int i;
	int ret = -2; /* avoid 'uninitialized' warning */
	int err = 0;
	BIGNUM *A, *B, *tmp;

	/* In 'tab', only odd-indexed entries are relevant:
	 * For any odd BIGNUM n,
	 *     tab[BN_lsw(n) & 7]
	 * is $(-1)^{(n^2-1)/8}$ (using TeX notation).
	 * Note that the sign of n does not matter.
	 */
	static const int tab[8] = {0, 1, 0, -1, 0, -1, 0, 1};




	bn_check_top(a);
	bn_check_top(b);

	BN_CTX_start(ctx);

	if ((A = BN_CTX_get(ctx)) == NULL)
		goto end;
	if ((B = BN_CTX_get(ctx)) == NULL)
		goto end;

	err = !BN_copy(A, a);
	if (err)
		goto end;
	err = !BN_copy(B, b);
	if (err)
		goto end;

	/*
	 * Kronecker symbol, imlemented according to Henri Cohen,
	 * "A Course in Computational Algebraic Number Theory"
	 * (algorithm 1.4.10).
	 */

	/* Cohen's step 1: */

	if (BN_is_zero(B)) {
		ret = BN_abs_is_word(A, 1);
		goto end;
	}


	/* Cohen's step 2: */



	if (!BN_is_odd(A) && !BN_is_odd(B)) {
		ret = 0;
		goto end;
	}

	/* now  B  is non-zero */
	i = 0;
	while (!BN_is_bit_set(B, i))
		i++;
	err = !BN_rshift(B, B, i);
	if (err)
		goto end;
	if (i & 1) {
		/* i is odd */
		/* (thus  B  was even, thus  A  must be odd!)  */

		/* set 'ret' to $(-1)^{(A^2-1)/8}$ */
		ret = tab[BN_lsw(A) & 7];
	} else {
		/* i is even */
		ret = 1;


	}







	if (B->neg) {
		B->neg = 0;
		if (A->neg)
			ret = -ret;

	}

	/* now  B  is positive and odd, so what remains to be done is
	 * to compute the Jacobi symbol  (A/B)  and multiply it by 'ret' */


	while (1) {

		/* Cohen's step 3: */


		/*  B  is positive and odd */


		if (BN_is_zero(A)) {
			ret = BN_is_one(B) ? ret : 0;
			goto end;
		}

		/* now  A  is non-zero */

		i = 0;
		while (!BN_is_bit_set(A, i))
			i++;
		err = !BN_rshift(A, A, i);
		if (err)
			goto end;
		if (i & 1) {
			/* i is odd */
			/* multiply 'ret' by  $(-1)^{(B^2-1)/8}$ */

			ret = ret * tab[BN_lsw(B) & 7];
		}

		/* Cohen's step 4: */

		/* multiply 'ret' by  $(-1)^{(A-1)(B-1)/4}$ */








		if ((A->neg ? ~BN_lsw(A) : BN_lsw(A)) & BN_lsw(B) & 2)
			ret = -ret;


		/* (A, B) := (B mod |A|, |A|) */




		err = !BN_nnmod(B, B, A, ctx);
		if (err)
			goto end;

		tmp = A;
		A = B;
		B = tmp;
		tmp->neg = 0;

	}

end:
	BN_CTX_end(ctx);
	if (err)
		return -2;
	else
		return ret;
}







|
|
>
|
|
<
|
|
|
<
<
|
|
<
<
|
<
<
<

>
>
>

|
|


>
|

|


|
<

|
<



|
<
<


<
|
|
|



>
|
>

>
|




|
|
|
|
|
<

<
<
<

<
<
<
|
|
>
>
|
>
>
>
>
>
>

|
<
<
|
>
|
|
|
|
>


>
|
>

|

>
|
|



<
>
|
|
|
|
<

|
<
|
>
|
|
|
|
>
|
>
>
>
>
>
>
>
>
|
|

>
|
>
>
>
>
|
|

>
|
|
|
|
>


|

|
<
<
|

51
52
53
54
55
56
57
58
59
60
61
62

63
64
65


66
67


68



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

85
86

87
88
89
90


91
92

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

114



115



116
117
118
119
120
121
122
123
124
125
126
127
128


129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152
153
154

155
156

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195


196
197
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include "bn_lcl.h"

/*
 * Kronecker symbol, implemented according to Henri Cohen, "A Course in
 * Computational Algebraic Number Theory", Algorithm 1.4.10.
 *
 * Returns -1, 0, or 1 on success and -2 on error.

 */

int


BN_kronecker(const BIGNUM *A, const BIGNUM *B, BN_CTX *ctx)
{


	/* tab[BN_lsw(n) & 7] = (-1)^((n^2 - 1)) / 8) for odd values of n. */



	static const int tab[8] = {0, 1, 0, -1, 0, -1, 0, 1};
	BIGNUM *a, *b, *tmp;
	int k, v;
	int ret = -2;

	bn_check_top(A);
	bn_check_top(B);

	BN_CTX_start(ctx);

	if ((a = BN_CTX_get(ctx)) == NULL)
		goto end;
	if ((b = BN_CTX_get(ctx)) == NULL)
		goto end;

	if (BN_copy(a, A) == NULL)

		goto end;
	if (BN_copy(b, B) == NULL)

		goto end;

	/*
	 * Cohen's step 1:


	 */


	/* If b is zero, output 1 if |a| is 1, otherwise output 0. */
	if (BN_is_zero(b)) {
		ret = BN_abs_is_word(a, 1);
		goto end;
	}

	/*
	 * Cohen's step 2:
	 */

	/* If both are even, they have a factor in common, so output 0. */
	if (!BN_is_odd(a) && !BN_is_odd(b)) {
		ret = 0;
		goto end;
	}

	/* Factorize b = 2^v * u with odd u and replace b with u. */
	v = 0;
	while (!BN_is_bit_set(b, v))
		v++;
	if (!BN_rshift(b, b, v))

		goto end;







	/* If v is even set k = 1, otherwise set it to (-1)^((a^2 - 1) / 8). */
	k = 1;
	if (v % 2 != 0)
		k = tab[BN_lsw(a) & 7];

	/*
	 * If b is negative, replace it with -b and if a is also negative
	 * replace k with -k.
	 */
	if (BN_is_negative(b)) {
		BN_set_negative(b, 0);

		if (BN_is_negative(a))


			k = -k;
	}

	/*
	 * Now b is positive and odd, so compute the Jacobi symbol (a/b)
	 * and multiply it by k.
	 */

	while (1) {
		/*
		 * Cohen's step 3:
		 */

		/* b is positive and odd. */

		/* If a is zero output k if b is one, otherwise output 0. */
		if (BN_is_zero(a)) {
			ret = BN_is_one(b) ? k : 0;
			goto end;
		}


		/* Factorize a = 2^v * u with odd u and replace a with u. */
		v = 0;
		while (!BN_is_bit_set(a, v))
			v++;
		if (!BN_rshift(a, a, v))

			goto end;


		/* If v is odd, multiply k with (-1)^((b^2 - 1) / 8). */
		if (v % 2 != 0)
			k *= tab[BN_lsw(b) & 7];

		/*
		 * Cohen's step 4:
		 */

		/*
		 * Apply the reciprocity law: multiply k by (-1)^((a-1)(b-1)/4).
		 *
		 * This expression is -1 if and only if a and b are 3 (mod 4).
		 * In turn, this is the case if and only if their two's
		 * complement representations have the second bit set.
		 * a could be negative in the first iteration, b is positive.
		 */
		if ((BN_is_negative(a) ? ~BN_lsw(a) : BN_lsw(a)) & BN_lsw(b) & 2)
			k = -k;

		/*
		 * (a, b) := (b mod |a|, |a|)
		 *
		 * Once this is done, we know that 0 < a < b at the start of the
		 * loop. Since b is strictly decreasing, the loop terminates.
		 */

		if (!BN_nnmod(b, b, a, ctx))
			goto end;

		tmp = a;
		a = b;
		b = tmp;

		BN_set_negative(b, 0);
	}

 end:
	BN_CTX_end(ctx);



	return ret;
}
Changes to jni/libressl/crypto/bn/bn_lcl.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_lcl.h,v 1.31 2022/01/14 08:01:47 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_lcl.h,v 1.35 2022/07/15 06:10:00 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
489
490
491
492
493
494
495



496
497
498
499
500
501
502
	/* non-multiply part */ \
	l+=(c); if ((l&BN_MASK2) < (c)) h++; \
	(c)=h&BN_MASK2; \
	(r)=l&BN_MASK2; \
	}
#endif /* !BN_LLONG */




void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb);
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp);
void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a);
void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a);
int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n);







>
>
>







489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
	/* non-multiply part */ \
	l+=(c); if ((l&BN_MASK2) < (c)) h++; \
	(c)=h&BN_MASK2; \
	(r)=l&BN_MASK2; \
	}
#endif /* !BN_LLONG */

/* The least significant word of a BIGNUM. */
#define BN_lsw(n) (((n)->top == 0) ? (BN_ULONG) 0 : (n)->d[0])

void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb);
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp);
void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a);
void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a);
int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n);
648
649
650
651
652
653
654





655
656
657
    BN_CTX *ctx);
BIGNUM *BN_mod_inverse_nonct(BIGNUM *ret, const BIGNUM *a, const BIGNUM *n,
    BN_CTX *ctx);
int	BN_gcd_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
int	BN_gcd_nonct(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);

int	BN_swap_ct(BN_ULONG swap, BIGNUM *a, BIGNUM *b, size_t nwords);






__END_HIDDEN_DECLS
#endif







>
>
>
>
>



651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
    BN_CTX *ctx);
BIGNUM *BN_mod_inverse_nonct(BIGNUM *ret, const BIGNUM *a, const BIGNUM *n,
    BN_CTX *ctx);
int	BN_gcd_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
int	BN_gcd_nonct(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);

int	BN_swap_ct(BN_ULONG swap, BIGNUM *a, BIGNUM *b, size_t nwords);

int bn_isqrt(BIGNUM *out_sqrt, int *out_perfect, const BIGNUM *n, BN_CTX *ctx);
int bn_is_perfect_square(int *out_perfect, const BIGNUM *n, BN_CTX *ctx);

int bn_is_prime_bpsw(int *is_prime, const BIGNUM *n, BN_CTX *in_ctx);

__END_HIDDEN_DECLS
#endif
Changes to jni/libressl/crypto/bn/bn_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_lib.c,v 1.53 2021/12/27 15:12:22 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_lib.c,v 1.54 2022/06/27 12:25:49 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
1100
1101
1102
1103
1104
1105
1106































1107
1108
1109
1110
1111
1112
1113
}

int
BN_is_negative(const BIGNUM *a)
{
	return a->neg != 0;
}
































BN_GENCB *
BN_GENCB_new(void)
{
	BN_GENCB *cb;

	if ((cb = calloc(1, sizeof(*cb))) == NULL)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
}

int
BN_is_negative(const BIGNUM *a)
{
	return a->neg != 0;
}

/*
 * Bits of security, see SP800-57, section 5.6.11, table 2.
 */
int
BN_security_bits(int L, int N)
{
	int secbits, bits;

	if (L >= 15360)
		secbits = 256;
	else if (L >= 7680)
		secbits = 192;
	else if (L >= 3072)
		secbits = 128;
	else if (L >= 2048)
		secbits = 112;
	else if (L >= 1024)
		secbits = 80;
	else
		return 0;

	if (N == -1)
		return secbits;

	bits = N / 2;
	if (bits < 80)
		return 0;

	return bits >= secbits ? secbits : bits;
}

BN_GENCB *
BN_GENCB_new(void)
{
	BN_GENCB *cb;

	if ((cb = calloc(1, sizeof(*cb))) == NULL)
Changes to jni/libressl/crypto/bn/bn_nist.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_nist.c,v 1.19 2021/11/09 18:40:20 bcook Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project
 */
/* ====================================================================
 * Copyright (c) 1998-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_nist.c,v 1.22 2022/07/31 14:38:38 jsing Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project
 */
/* ====================================================================
 * Copyright (c) 1998-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
57
58
59
60
61
62
63



64
65
66
67
68
69
70
 */

#include <endian.h>
#include <stdint.h>
#include <string.h>

#include "bn_lcl.h"




#define BN_NIST_192_TOP	(192+BN_BITS2-1)/BN_BITS2
#define BN_NIST_224_TOP	(224+BN_BITS2-1)/BN_BITS2
#define BN_NIST_256_TOP	(256+BN_BITS2-1)/BN_BITS2
#define BN_NIST_384_TOP	(384+BN_BITS2-1)/BN_BITS2
#define BN_NIST_521_TOP	(521+BN_BITS2-1)/BN_BITS2








>
>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 */

#include <endian.h>
#include <stdint.h>
#include <string.h>

#include "bn_lcl.h"

#define CTASSERT(x)	extern char  _ctassert[(x) ? 1 : -1 ]   \
			    __attribute__((__unused__))

#define BN_NIST_192_TOP	(192+BN_BITS2-1)/BN_BITS2
#define BN_NIST_224_TOP	(224+BN_BITS2-1)/BN_BITS2
#define BN_NIST_256_TOP	(256+BN_BITS2-1)/BN_BITS2
#define BN_NIST_384_TOP	(384+BN_BITS2-1)/BN_BITS2
#define BN_NIST_521_TOP	(521+BN_BITS2-1)/BN_BITS2

280
281
282
283
284
285
286
287
288
289
290
291
292
293








294
295
296
297
298
299
300
301








302
303
304
305
306
307








308
309
310
311
312
313
314
315
316
317








318
319
320
321
322
323
324
325







326
327
328
329
330
331
332
	0xFFFFFFFF, 0xFFFFFFFF, 0x0003FFFF
};
#else
#error "unsupported BN_BITS2"
#endif

static const BIGNUM _bignum_nist_p_192 = {
	(BN_ULONG *)_nist_p_192[0],
	BN_NIST_192_TOP,
	BN_NIST_192_TOP,
	0,
	BN_FLG_STATIC_DATA
};









static const BIGNUM _bignum_nist_p_224 = {
	(BN_ULONG *)_nist_p_224[0],
	BN_NIST_224_TOP,
	BN_NIST_224_TOP,
	0,
	BN_FLG_STATIC_DATA
};









static const BIGNUM _bignum_nist_p_256 = {
	(BN_ULONG *)_nist_p_256[0],
	BN_NIST_256_TOP,
	BN_NIST_256_TOP,
	0,
	BN_FLG_STATIC_DATA








};

static const BIGNUM _bignum_nist_p_384 = {
	(BN_ULONG *)_nist_p_384[0],
	BN_NIST_384_TOP,
	BN_NIST_384_TOP,
	0,
	BN_FLG_STATIC_DATA
};









static const BIGNUM _bignum_nist_p_521 = {
	(BN_ULONG *)_nist_p_521,
	BN_NIST_521_TOP,
	BN_NIST_521_TOP,
	0,
	BN_FLG_STATIC_DATA
};









const BIGNUM *
BN_get0_nist_prime_192(void)
{
	return &_bignum_nist_p_192;
}








|
|
|
|
|


>
>
>
>
>
>
>
>

|
|
|
|
|


>
>
>
>
>
>
>
>

|
|
|
|
|
>
>
>
>
>
>
>
>



|
|
|
|
|


>
>
>
>
>
>
>
>

|
|
|
|
|


>
>
>
>
>
>
>







283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
	0xFFFFFFFF, 0xFFFFFFFF, 0x0003FFFF
};
#else
#error "unsupported BN_BITS2"
#endif

static const BIGNUM _bignum_nist_p_192 = {
	.d = (BN_ULONG *)_nist_p_192[0],
	.top = BN_NIST_192_TOP,
	.dmax = BN_NIST_192_TOP,
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_192_sqr = {
	.d = (BN_ULONG *)_nist_p_192_sqr,
	.top = sizeof(_nist_p_192_sqr) / sizeof(_nist_p_192_sqr[0]),
	.dmax = sizeof(_nist_p_192_sqr) / sizeof(_nist_p_192_sqr[0]),
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_224 = {
	.d = (BN_ULONG *)_nist_p_224[0],
	.top = BN_NIST_224_TOP,
	.dmax = BN_NIST_224_TOP,
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_224_sqr = {
	.d = (BN_ULONG *)_nist_p_224_sqr,
	.top = sizeof(_nist_p_224_sqr) / sizeof(_nist_p_224_sqr[0]),
	.dmax = sizeof(_nist_p_224_sqr) / sizeof(_nist_p_224_sqr[0]),
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_256 = {
	.d = (BN_ULONG *)_nist_p_256[0],
	.top = BN_NIST_256_TOP,
	.dmax = BN_NIST_256_TOP,
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_256_sqr = {
	.d = (BN_ULONG *)_nist_p_256_sqr,
	.top = sizeof(_nist_p_256_sqr) / sizeof(_nist_p_256_sqr[0]),
	.dmax = sizeof(_nist_p_256_sqr) / sizeof(_nist_p_256_sqr[0]),
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_384 = {
	.d = (BN_ULONG *)_nist_p_384[0],
	.top = BN_NIST_384_TOP,
	.dmax = BN_NIST_384_TOP,
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_384_sqr = {
	.d = (BN_ULONG *)_nist_p_384_sqr,
	.top = sizeof(_nist_p_384_sqr) / sizeof(_nist_p_384_sqr[0]),
	.dmax = sizeof(_nist_p_384_sqr) / sizeof(_nist_p_384_sqr[0]),
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_521 = {
	.d = (BN_ULONG *)_nist_p_521,
	.top = BN_NIST_521_TOP,
	.dmax = BN_NIST_521_TOP,
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

static const BIGNUM _bignum_nist_p_521_sqr = {
	.d = (BN_ULONG *)_nist_p_521_sqr,
	.top = sizeof(_nist_p_521_sqr) / sizeof(_nist_p_521_sqr[0]),
	.dmax = sizeof(_nist_p_521_sqr) / sizeof(_nist_p_521_sqr[0]),
	.neg = 0,
	.flags = BN_FLG_STATIC_DATA,
};

const BIGNUM *
BN_get0_nist_prime_192(void)
{
	return &_bignum_nist_p_192;
}

418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438

439
440
441
442
443
444
445
446
447
448
	bn_cp_64(to, 1, from, (a2) - 3) \
	bn_cp_64(to, 2, from, (a1) - 3) \
	}

int
BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{
	int top = a->top, i;
	int carry;
	BN_ULONG *r_d, *a_d = a->d;
	union {
		BN_ULONG bn[BN_NIST_192_TOP];
		unsigned int ui[BN_NIST_192_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
	} buf;
	BN_ULONG c_d[BN_NIST_192_TOP], *res;
	uintptr_t mask;
	static const BIGNUM _bignum_nist_p_192_sqr = {
		(BN_ULONG *)_nist_p_192_sqr,
		sizeof(_nist_p_192_sqr) / sizeof(_nist_p_192_sqr[0]),
		sizeof(_nist_p_192_sqr) / sizeof(_nist_p_192_sqr[0]),

		0,
		BN_FLG_STATIC_DATA
	};

	field = &_bignum_nist_p_192; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_192_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);







<
<
<
<
|
|
|
<
|

<
<
<
<
>
|
<
<







460
461
462
463
464
465
466




467
468
469

470
471




472
473


474
475
476
477
478
479
480
	bn_cp_64(to, 1, from, (a2) - 3) \
	bn_cp_64(to, 2, from, (a1) - 3) \
	}

int
BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{




	BN_ULONG bnbuf[BN_NIST_192_TOP] = { 0 };
	BN_ULONG c_d[BN_NIST_192_TOP] = { 0 };
	BN_ULONG *a_d = a->d;

	BN_ULONG *r_d, *res;
	uintptr_t mask;




	int top = a->top;
	int carry, i;



	field = &_bignum_nist_p_192; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_192_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);
456
457
458
459
460
461
462
463
464
465
466
467
468
469



470














471
472
473
474
475
476
477
		if (!bn_wexpand(r, BN_NIST_192_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_192_TOP);
	} else
		r_d = a_d;

	nist_cp_bn_0(buf.bn, a_d + BN_NIST_192_TOP, top - BN_NIST_192_TOP,
	    BN_NIST_192_TOP);

#if defined(NIST_INT64)
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int *rp = (unsigned int *)r_d;



		const unsigned int *bp = (const unsigned int *)buf.ui;















		acc = rp[0];
		acc += bp[3 * 2 - 6];
		acc += bp[5 * 2 - 6];
		rp[0] = (unsigned int)acc;
		acc >>= 32;








|





|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
		if (!bn_wexpand(r, BN_NIST_192_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_192_TOP);
	} else
		r_d = a_d;

	nist_cp_bn_0(bnbuf, a_d + BN_NIST_192_TOP, top - BN_NIST_192_TOP,
	    BN_NIST_192_TOP);

#if defined(NIST_INT64)
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int bbuf[BN_NIST_192_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		unsigned int rbuf[BN_NIST_192_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		const unsigned int *bp = bbuf;
		unsigned int *rp = rbuf;

		CTASSERT(sizeof(bbuf) == sizeof(bnbuf));
		CTASSERT(sizeof(rbuf) == sizeof(bnbuf));

		/*
		 * Avoid strict aliasing violations by copying from an unsigned
		 * long array to an unsigned int array, then copying back the
		 * result. Any sensible compiler will omit the copies, while
		 * avoiding undefined behaviour that would result from unsafe
		 * type punning via pointer type casting.
		 */
		memcpy(bbuf, bnbuf, sizeof(bbuf));
		memcpy(rbuf, r_d, sizeof(rbuf));

		acc = rp[0];
		acc += bp[3 * 2 - 6];
		acc += bp[5 * 2 - 6];
		rp[0] = (unsigned int)acc;
		acc >>= 32;

502
503
504
505
506
507
508


509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
		acc >>= 32;

		acc += rp[5];
		acc += bp[4 * 2 - 5];
		acc += bp[5 * 2 - 5];
		rp[5] = (unsigned int)acc;



		carry = (int)(acc >> 32);
	}
#else
	{
		BN_ULONG t_d[BN_NIST_192_TOP] = {0};

		nist_set_192(t_d, buf.bn, 0, 3, 3);
		carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
		nist_set_192(t_d, buf.bn, 4, 4, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
		nist_set_192(t_d, buf.bn, 5, 5, 5)
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
	}
#endif
	if (carry > 0)
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_192[carry - 1],
		    BN_NIST_192_TOP);
	else







>
>






|

|

|







551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
		acc >>= 32;

		acc += rp[5];
		acc += bp[4 * 2 - 5];
		acc += bp[5 * 2 - 5];
		rp[5] = (unsigned int)acc;

		memcpy(r_d, rbuf, sizeof(rbuf));

		carry = (int)(acc >> 32);
	}
#else
	{
		BN_ULONG t_d[BN_NIST_192_TOP] = {0};

		nist_set_192(t_d, bnbuf, 0, 3, 3);
		carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
		nist_set_192(t_d, bnbuf, 4, 4, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
		nist_set_192(t_d, bnbuf, 5, 5, 5)
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
	}
#endif
	if (carry > 0)
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_192[carry - 1],
		    BN_NIST_192_TOP);
	else
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572

573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
	bn_cp_32(to, 5, from, (a2) - 7) \
	bn_cp_32(to, 6, from, (a1) - 7) \
	}

int
BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{
	int top = a->top, i;
	int carry;
	BN_ULONG *r_d, *a_d = a->d;
	union {
		BN_ULONG bn[BN_NIST_224_TOP];
		unsigned int ui[BN_NIST_224_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
	} buf;
	BN_ULONG c_d[BN_NIST_224_TOP], *res;

	uintptr_t mask;
	union {
		bn_addsub_f f;
		uintptr_t p;
	} u;
	static const BIGNUM _bignum_nist_p_224_sqr = {
		(BN_ULONG *)_nist_p_224_sqr,
		sizeof(_nist_p_224_sqr) / sizeof(_nist_p_224_sqr[0]),
		sizeof(_nist_p_224_sqr) / sizeof(_nist_p_224_sqr[0]),
		0,
		BN_FLG_STATIC_DATA
	};

	field = &_bignum_nist_p_224; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_224_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);







<
<
<
<
|
<
<
<
|
>
|
<
|
|
|
<
<
<
<
|
<
<







608
609
610
611
612
613
614




615



616
617
618

619
620
621




622


623
624
625
626
627
628
629
	bn_cp_32(to, 5, from, (a2) - 7) \
	bn_cp_32(to, 6, from, (a1) - 7) \
	}

int
BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{




	BN_ULONG bnbuf[BN_NIST_224_TOP] = { 0 };



	BN_ULONG c_d[BN_NIST_224_TOP] = { 0 };
	BN_ULONG *a_d = a->d;
	BN_ULONG *r_d, *res;

	bn_addsub_f addsubf;
	uintptr_t mask;
	int top = a->top;




	int carry, i;



	field = &_bignum_nist_p_224; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_224_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624



625














626
627
628
629
630
631
632
		if (!bn_wexpand(r, BN_NIST_224_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_224_TOP);
	} else
		r_d = a_d;

	memset(&buf, 0, sizeof(buf));

#if BN_BITS2==64
	/* copy upper 256 bits of 448 bit number ... */
	nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP - 1),
	    top - (BN_NIST_224_TOP - 1), BN_NIST_224_TOP);
	/* ... and right shift by 32 to obtain upper 224 bits */
	nist_set_224(buf.bn, c_d, 14, 13, 12, 11, 10, 9, 8);
	/* truncate lower part to 224 bits too */
	r_d[BN_NIST_224_TOP - 1] &= BN_MASK2l;
#else
	nist_cp_bn_0(buf.bn, a_d + BN_NIST_224_TOP,
	    top - BN_NIST_224_TOP, BN_NIST_224_TOP);
#endif

#if defined(NIST_INT64) && BN_BITS2!=64
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int *rp = (unsigned int *)r_d;



		const unsigned int *bp = (const unsigned int *)buf.ui;















		acc = rp[0];
		acc -= bp[7 - 7];
		acc -= bp[11 - 7];
		rp[0] = (unsigned int)acc;
		acc >>= 32;








|






|



|






|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
		if (!bn_wexpand(r, BN_NIST_224_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_224_TOP);
	} else
		r_d = a_d;

	memset(&bnbuf, 0, sizeof(bnbuf));

#if BN_BITS2==64
	/* copy upper 256 bits of 448 bit number ... */
	nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP - 1),
	    top - (BN_NIST_224_TOP - 1), BN_NIST_224_TOP);
	/* ... and right shift by 32 to obtain upper 224 bits */
	nist_set_224(bnbuf, c_d, 14, 13, 12, 11, 10, 9, 8);
	/* truncate lower part to 224 bits too */
	r_d[BN_NIST_224_TOP - 1] &= BN_MASK2l;
#else
	nist_cp_bn_0(bnbuf, a_d + BN_NIST_224_TOP,
	    top - BN_NIST_224_TOP, BN_NIST_224_TOP);
#endif

#if defined(NIST_INT64) && BN_BITS2!=64
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int bbuf[BN_NIST_224_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		unsigned int rbuf[BN_NIST_224_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		const unsigned int *bp = bbuf;
		unsigned int *rp = rbuf;

		CTASSERT(sizeof(bbuf) == sizeof(bnbuf));
		CTASSERT(sizeof(rbuf) == sizeof(bnbuf));

		/*
		 * Avoid strict aliasing violations by copying from an unsigned
		 * long array to an unsigned int array, then copying back the
		 * result. Any sensible compiler will omit the copies, while
		 * avoiding undefined behaviour that would result from unsafe
		 * type punning via pointer type casting.
		 */
		memcpy(bbuf, bnbuf, sizeof(bbuf));
		memcpy(rbuf, r_d, sizeof(rbuf));

		acc = rp[0];
		acc -= bp[7 - 7];
		acc -= bp[11 - 7];
		rp[0] = (unsigned int)acc;
		acc >>= 32;

664
665
666
667
668
669
670


671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
		acc >>= 32;

		acc += rp[6];
		acc += bp[10 - 7];
		acc -= bp[13 - 7];
		rp[6] = (unsigned int)acc;



		carry = (int)(acc >> 32);
# if BN_BITS2==64
		rp[7] = carry;
# endif
	}
#else
	{
		BN_ULONG t_d[BN_NIST_224_TOP] = {0};

		nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0);
		carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
		nist_set_224(t_d, buf.bn, 0, 13, 12, 11, 0, 0, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
		nist_set_224(t_d, buf.bn, 13, 12, 11, 10, 9, 8, 7);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
		nist_set_224(t_d, buf.bn, 0, 0, 0, 0, 13, 12, 11);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);

#if BN_BITS2==64
		carry = (int)(r_d[BN_NIST_224_TOP - 1] >> 32);
#endif
	}
#endif
	u.f = bn_sub_words;
	if (carry > 0) {
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_224[carry - 1],
		    BN_NIST_224_TOP);
#if BN_BITS2==64
		carry = (int)(~(r_d[BN_NIST_224_TOP - 1] >> 32)) & 1;
#endif
	} else if (carry < 0) {
		/* it's a bit more complicated logic in this case.
		 * if bn_add_words yields no carry, then result
		 * has to be adjusted by unconditionally *adding*
		 * the modulus. but if it does, then result has
		 * to be compared to the modulus and conditionally
		 * adjusted by *subtracting* the latter. */
		carry = (int)bn_add_words(r_d, r_d, _nist_p_224[-carry - 1],
		    BN_NIST_224_TOP);
		mask = 0 - (uintptr_t)carry;
		u.p = ((uintptr_t)bn_sub_words & mask) |
		    ((uintptr_t)bn_add_words & ~mask);
	} else
		carry = 1;

	/* otherwise it's effectively same as in BN_nist_mod_192... */
	mask = 0 - (uintptr_t)(*u.f)(c_d, r_d, _nist_p_224[0], BN_NIST_224_TOP);
	mask &= 0 - (uintptr_t)carry;
	res = c_d;
	res = (BN_ULONG *)(((uintptr_t)res & ~mask) | ((uintptr_t)r_d & mask));
	nist_cp_bn(r_d, res, BN_NIST_224_TOP);
	r->top = BN_NIST_224_TOP;
	bn_correct_top(r);








>
>









|

|

|

|







|















|
<
|




|







719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767

768
769
770
771
772
773
774
775
776
777
778
779
780
		acc >>= 32;

		acc += rp[6];
		acc += bp[10 - 7];
		acc -= bp[13 - 7];
		rp[6] = (unsigned int)acc;

		memcpy(r_d, rbuf, sizeof(rbuf));

		carry = (int)(acc >> 32);
# if BN_BITS2==64
		rp[7] = carry;
# endif
	}
#else
	{
		BN_ULONG t_d[BN_NIST_224_TOP] = {0};

		nist_set_224(t_d, bnbuf, 10, 9, 8, 7, 0, 0, 0);
		carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
		nist_set_224(t_d, bnbuf, 0, 13, 12, 11, 0, 0, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
		nist_set_224(t_d, bnbuf, 13, 12, 11, 10, 9, 8, 7);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
		nist_set_224(t_d, bnbuf, 0, 0, 0, 0, 13, 12, 11);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);

#if BN_BITS2==64
		carry = (int)(r_d[BN_NIST_224_TOP - 1] >> 32);
#endif
	}
#endif
	addsubf = bn_sub_words;
	if (carry > 0) {
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_224[carry - 1],
		    BN_NIST_224_TOP);
#if BN_BITS2==64
		carry = (int)(~(r_d[BN_NIST_224_TOP - 1] >> 32)) & 1;
#endif
	} else if (carry < 0) {
		/* it's a bit more complicated logic in this case.
		 * if bn_add_words yields no carry, then result
		 * has to be adjusted by unconditionally *adding*
		 * the modulus. but if it does, then result has
		 * to be compared to the modulus and conditionally
		 * adjusted by *subtracting* the latter. */
		carry = (int)bn_add_words(r_d, r_d, _nist_p_224[-carry - 1],
		    BN_NIST_224_TOP);
		if (carry == 0)

			addsubf = bn_add_words;
	} else
		carry = 1;

	/* otherwise it's effectively same as in BN_nist_mod_192... */
	mask = 0 - (uintptr_t)(*addsubf)(c_d, r_d, _nist_p_224[0], BN_NIST_224_TOP);
	mask &= 0 - (uintptr_t)carry;
	res = c_d;
	res = (BN_ULONG *)(((uintptr_t)res & ~mask) | ((uintptr_t)r_d & mask));
	nist_cp_bn(r_d, res, BN_NIST_224_TOP);
	r->top = BN_NIST_224_TOP;
	bn_correct_top(r);

736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751

752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
	bn_cp_32(to, 6, from, (a2) - 8) \
	bn_cp_32(to, 7, from, (a1) - 8) \
	}

int
BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{
	int i, top = a->top;
	int carry = 0;
	BN_ULONG *a_d = a->d, *r_d;
	union {
		BN_ULONG bn[BN_NIST_256_TOP];
		unsigned int ui[BN_NIST_256_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
	} buf;
	BN_ULONG c_d[BN_NIST_256_TOP] = {0}, *res;

	uintptr_t mask;
	union {
		bn_addsub_f f;
		uintptr_t p;
	} u;
	static const BIGNUM _bignum_nist_p_256_sqr = {
		(BN_ULONG *)_nist_p_256_sqr,
		sizeof(_nist_p_256_sqr) / sizeof(_nist_p_256_sqr[0]),
		sizeof(_nist_p_256_sqr) / sizeof(_nist_p_256_sqr[0]),
		0,
		BN_FLG_STATIC_DATA
	};

	field = &_bignum_nist_p_256; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_256_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);







<
<
<
<
|
<
<
<
|
>
|
<
|
|
|
<
<
<
<
|
<
<







792
793
794
795
796
797
798




799



800
801
802

803
804
805




806


807
808
809
810
811
812
813
	bn_cp_32(to, 6, from, (a2) - 8) \
	bn_cp_32(to, 7, from, (a1) - 8) \
	}

int
BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{




	BN_ULONG bnbuf[BN_NIST_256_TOP] = { 0 };



	BN_ULONG c_d[BN_NIST_256_TOP] = { 0 };
	BN_ULONG *a_d = a->d;
	BN_ULONG *r_d, *res;

	bn_addsub_f addsubf;
	uintptr_t mask;
	int top = a->top;




	int carry, i;



	field = &_bignum_nist_p_256; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_256_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);
778
779
780
781
782
783
784
785
786
787
788
789
790
791



792














793
794
795
796
797
798
799
		if (!bn_wexpand(r, BN_NIST_256_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_256_TOP);
	} else
		r_d = a_d;

	nist_cp_bn_0(buf.bn, a_d + BN_NIST_256_TOP,
	    top - BN_NIST_256_TOP, BN_NIST_256_TOP);

#if defined(NIST_INT64)
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int *rp = (unsigned int *)r_d;



		const unsigned int *bp = (const unsigned int *)buf.ui;















		acc = rp[0];
		acc += bp[8 - 8];
		acc += bp[9 - 8];
		acc -= bp[11 - 8];
		acc -= bp[12 - 8];
		acc -= bp[13 - 8];







|





|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
		if (!bn_wexpand(r, BN_NIST_256_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_256_TOP);
	} else
		r_d = a_d;

	nist_cp_bn_0(bnbuf, a_d + BN_NIST_256_TOP,
	    top - BN_NIST_256_TOP, BN_NIST_256_TOP);

#if defined(NIST_INT64)
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int bbuf[BN_NIST_256_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		unsigned int rbuf[BN_NIST_256_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		const unsigned int *bp = bbuf;
		unsigned int *rp = rbuf;

		CTASSERT(sizeof(bbuf) == sizeof(bnbuf));
		CTASSERT(sizeof(rbuf) == sizeof(bnbuf));

		/*
		 * Avoid strict aliasing violations by copying from an unsigned
		 * long array to an unsigned int array, then copying back the
		 * result. Any sensible compiler will omit the copies, while
		 * avoiding undefined behaviour that would result from unsafe
		 * type punning via pointer type casting.
		 */
		memcpy(bbuf, bnbuf, sizeof(bbuf));
		memcpy(rbuf, r_d, sizeof(rbuf));

		acc = rp[0];
		acc += bp[8 - 8];
		acc += bp[9 - 8];
		acc -= bp[11 - 8];
		acc -= bp[12 - 8];
		acc -= bp[13 - 8];
873
874
875
876
877
878
879


880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
		acc += bp[8 - 8];
		acc -= bp[10 - 8];
		acc -= bp[11 - 8];
		acc -= bp[12 - 8];
		acc -= bp[13 - 8];
		rp[7] = (unsigned int)acc;



		carry = (int)(acc >> 32);
	}
#else
	{
		BN_ULONG t_d[BN_NIST_256_TOP] = {0};

		/*S1*/
		nist_set_256(t_d, buf.bn, 15, 14, 13, 12, 11, 0, 0, 0);
		/*S2*/
		nist_set_256(c_d, buf.bn, 0, 15, 14, 13, 12, 0, 0, 0);
		carry = (int)bn_add_words(t_d, t_d, c_d, BN_NIST_256_TOP);
		/* left shift */
		{
			BN_ULONG *ap, t, c;
			ap = t_d;
			c = 0;
			for (i = BN_NIST_256_TOP; i != 0; --i) {
				t = *ap;
				*(ap++) = ((t << 1) | c) & BN_MASK2;
				c = (t & BN_TBIT) ? 1 : 0;
			}
			carry <<= 1;
			carry |= c;
		}
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*S3*/
		nist_set_256(t_d, buf.bn, 15, 14, 0, 0, 0, 10, 9, 8);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*S4*/
		nist_set_256(t_d, buf.bn, 8, 13, 15, 14, 13, 11, 10, 9);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D1*/
		nist_set_256(t_d, buf.bn, 10, 8, 0, 0, 0, 13, 12, 11);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D2*/
		nist_set_256(t_d, buf.bn, 11, 9, 0, 0, 15, 14, 13, 12);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D3*/
		nist_set_256(t_d, buf.bn, 12, 0, 10, 9, 8, 15, 14, 13);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D4*/
		nist_set_256(t_d, buf.bn, 13, 0, 11, 10, 9, 0, 15, 14);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);

	}
#endif
	/* see BN_nist_mod_224 for explanation */
	u.f = bn_sub_words;
	if (carry > 0)
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_256[carry - 1],
		    BN_NIST_256_TOP);
	else if (carry < 0) {
		carry = (int)bn_add_words(r_d, r_d, _nist_p_256[-carry - 1],
		    BN_NIST_256_TOP);
		mask = 0 - (uintptr_t)carry;
		u.p = ((uintptr_t)bn_sub_words & mask) |
		    ((uintptr_t)bn_add_words & ~mask);
	} else
		carry = 1;

	mask = 0 - (uintptr_t)(*u.f)(c_d, r_d, _nist_p_256[0], BN_NIST_256_TOP);
	mask &= 0 - (uintptr_t)carry;
	res = c_d;
	res = (BN_ULONG *)(((uintptr_t)res & ~mask) | ((uintptr_t)r_d & mask));
	nist_cp_bn(r_d, res, BN_NIST_256_TOP);
	r->top = BN_NIST_256_TOP;
	bn_correct_top(r);








>
>







|

|
















|


|


|


|


|


|





|






|
<
|



|







933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996

997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
		acc += bp[8 - 8];
		acc -= bp[10 - 8];
		acc -= bp[11 - 8];
		acc -= bp[12 - 8];
		acc -= bp[13 - 8];
		rp[7] = (unsigned int)acc;

		memcpy(r_d, rbuf, sizeof(rbuf));

		carry = (int)(acc >> 32);
	}
#else
	{
		BN_ULONG t_d[BN_NIST_256_TOP] = {0};

		/*S1*/
		nist_set_256(t_d, bnbuf, 15, 14, 13, 12, 11, 0, 0, 0);
		/*S2*/
		nist_set_256(c_d, bnbuf, 0, 15, 14, 13, 12, 0, 0, 0);
		carry = (int)bn_add_words(t_d, t_d, c_d, BN_NIST_256_TOP);
		/* left shift */
		{
			BN_ULONG *ap, t, c;
			ap = t_d;
			c = 0;
			for (i = BN_NIST_256_TOP; i != 0; --i) {
				t = *ap;
				*(ap++) = ((t << 1) | c) & BN_MASK2;
				c = (t & BN_TBIT) ? 1 : 0;
			}
			carry <<= 1;
			carry |= c;
		}
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*S3*/
		nist_set_256(t_d, bnbuf, 15, 14, 0, 0, 0, 10, 9, 8);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*S4*/
		nist_set_256(t_d, bnbuf, 8, 13, 15, 14, 13, 11, 10, 9);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D1*/
		nist_set_256(t_d, bnbuf, 10, 8, 0, 0, 0, 13, 12, 11);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D2*/
		nist_set_256(t_d, bnbuf, 11, 9, 0, 0, 15, 14, 13, 12);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D3*/
		nist_set_256(t_d, bnbuf, 12, 0, 10, 9, 8, 15, 14, 13);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
		/*D4*/
		nist_set_256(t_d, bnbuf, 13, 0, 11, 10, 9, 0, 15, 14);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);

	}
#endif
	/* see BN_nist_mod_224 for explanation */
	addsubf = bn_sub_words;
	if (carry > 0)
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_256[carry - 1],
		    BN_NIST_256_TOP);
	else if (carry < 0) {
		carry = (int)bn_add_words(r_d, r_d, _nist_p_256[-carry - 1],
		    BN_NIST_256_TOP);
		if (carry == 0)

			addsubf = bn_add_words;
	} else
		carry = 1;

	mask = 0 - (uintptr_t)(*addsubf)(c_d, r_d, _nist_p_256[0], BN_NIST_256_TOP);
	mask &= 0 - (uintptr_t)carry;
	res = c_d;
	res = (BN_ULONG *)(((uintptr_t)res & ~mask) | ((uintptr_t)r_d & mask));
	nist_cp_bn(r_d, res, BN_NIST_256_TOP);
	r->top = BN_NIST_256_TOP;
	bn_correct_top(r);

963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978

979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
	bn_cp_32(to, 10, from, (a2) - 12)  \
	bn_cp_32(to, 11, from, (a1) - 12)  \
	}

int
BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{
	int i, top = a->top;
	int carry = 0;
	BN_ULONG *r_d, *a_d = a->d;
	union {
		BN_ULONG bn[BN_NIST_384_TOP];
		unsigned int ui[BN_NIST_384_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
	} buf;
	BN_ULONG c_d[BN_NIST_384_TOP], *res;

	uintptr_t mask;
	union {
		bn_addsub_f f;
		uintptr_t p;
	} u;
	static const BIGNUM _bignum_nist_p_384_sqr = {
		(BN_ULONG *)_nist_p_384_sqr,
		sizeof(_nist_p_384_sqr) / sizeof(_nist_p_384_sqr[0]),
		sizeof(_nist_p_384_sqr) / sizeof(_nist_p_384_sqr[0]),
		0,
		BN_FLG_STATIC_DATA
	};

	field = &_bignum_nist_p_384; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_384_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);







<
<
<
<
|
<
<
<
|
>
|
<
|
|
|
<
<
<
<
|
<
<







1024
1025
1026
1027
1028
1029
1030




1031



1032
1033
1034

1035
1036
1037




1038


1039
1040
1041
1042
1043
1044
1045
	bn_cp_32(to, 10, from, (a2) - 12)  \
	bn_cp_32(to, 11, from, (a1) - 12)  \
	}

int
BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{




	BN_ULONG bnbuf[BN_NIST_384_TOP] = { 0 };



	BN_ULONG c_d[BN_NIST_384_TOP] = { 0 };
	BN_ULONG *a_d = a->d;
	BN_ULONG *r_d, *res;

	bn_addsub_f addsubf;
	uintptr_t mask;
	int top = a->top;




	int carry, i;



	field = &_bignum_nist_p_384; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_384_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018



1019














1020
1021
1022
1023
1024
1025
1026
		if (!bn_wexpand(r, BN_NIST_384_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_384_TOP);
	} else
		r_d = a_d;

	nist_cp_bn_0(buf.bn, a_d + BN_NIST_384_TOP,
	    top - BN_NIST_384_TOP, BN_NIST_384_TOP);

#if defined(NIST_INT64)
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int *rp = (unsigned int *)r_d;



		const unsigned int *bp = (const unsigned int *)buf.ui;















		acc = rp[0];
		acc += bp[12 - 12];
		acc += bp[21 - 12];
		acc += bp[20 - 12];
		acc -= bp[23 - 12];
		rp[0] = (unsigned int)acc;







|





|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
		if (!bn_wexpand(r, BN_NIST_384_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_384_TOP);
	} else
		r_d = a_d;

	nist_cp_bn_0(bnbuf, a_d + BN_NIST_384_TOP,
	    top - BN_NIST_384_TOP, BN_NIST_384_TOP);

#if defined(NIST_INT64)
	{
		NIST_INT64 acc;	/* accumulator */
		unsigned int bbuf[BN_NIST_384_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		unsigned int rbuf[BN_NIST_384_TOP *
		    sizeof(BN_ULONG) / sizeof(unsigned int)];
		const unsigned int *bp = bbuf;
		unsigned int *rp = rbuf;

		CTASSERT(sizeof(bbuf) == sizeof(bnbuf));
		CTASSERT(sizeof(rbuf) == sizeof(bnbuf));

		/*
		 * Avoid strict aliasing violations by copying from an unsigned
		 * long array to an unsigned int array, then copying back the
		 * result. Any sensible compiler will omit the copies, while
		 * avoiding undefined behaviour that would result from unsafe
		 * type punning via pointer type casting.
		 */
		memcpy(bbuf, bnbuf, sizeof(bbuf));
		memcpy(rbuf, r_d, sizeof(rbuf));

		acc = rp[0];
		acc += bp[12 - 12];
		acc += bp[21 - 12];
		acc += bp[20 - 12];
		acc -= bp[23 - 12];
		rp[0] = (unsigned int)acc;
1127
1128
1129
1130
1131
1132
1133


1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217

1218
1219

1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
		acc += rp[11];
		acc += bp[23 - 12];
		acc += bp[20 - 12];
		acc += bp[19 - 12];
		acc -= bp[22 - 12];
		rp[11] = (unsigned int)acc;



		carry = (int)(acc >> 32);
	}
#else
	{
		BN_ULONG t_d[BN_NIST_384_TOP] = {0};

		/*S1*/
		nist_set_256(t_d, buf.bn, 0, 0, 0, 0, 0, 23 - 4, 22 - 4,
		    21 - 4);
		/* left shift */
		{
			BN_ULONG *ap, t, c;
			ap = t_d;
			c = 0;
			for (i = 3; i != 0; --i) {
				t= *ap;
				*(ap++) = ((t << 1)|c) & BN_MASK2;
				c = (t & BN_TBIT) ? 1 : 0;
			}
			*ap = c;
		}
		carry = (int)bn_add_words(r_d + (128 / BN_BITS2),
		    r_d + (128 / BN_BITS2), t_d, BN_NIST_256_TOP);
		/*S2 */
		carry += (int)bn_add_words(r_d, r_d, buf.bn, BN_NIST_384_TOP);
		/*S3*/
		nist_set_384(t_d, buf.bn, 20, 19, 18, 17, 16, 15, 14, 13, 12,
		    23, 22, 21);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*S4*/
		nist_set_384(t_d, buf.bn, 19, 18, 17, 16, 15, 14, 13, 12, 20,
		    0, 23, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*S5*/
		nist_set_384(t_d, buf.bn, 0,0, 0,0, 23, 22, 21, 20, 0,0, 0, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*S6*/
		nist_set_384(t_d, buf.bn, 0,0, 0,0, 0,0, 23, 22, 21, 0,0, 20);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*D1*/
		nist_set_384(t_d, buf.bn, 22, 21, 20, 19, 18, 17, 16, 15, 14,
		    13, 12, 23);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*D2*/
		nist_set_384(t_d, buf.bn, 0,0, 0,0, 0,0, 0,23, 22, 21, 20, 0);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*D3*/
		nist_set_384(t_d, buf.bn, 0,0, 0,0, 0,0, 0,23, 23, 0,0, 0);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);

	}
#endif
	/* see BN_nist_mod_224 for explanation */
	u.f = bn_sub_words;
	if (carry > 0)
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_384[carry - 1],
		    BN_NIST_384_TOP);
	else if (carry < 0) {
		carry = (int)bn_add_words(r_d, r_d, _nist_p_384[-carry - 1],
		    BN_NIST_384_TOP);
		mask = 0 - (uintptr_t)carry;
		u.p = ((uintptr_t)bn_sub_words & mask) |
		    ((uintptr_t)bn_add_words & ~mask);
	} else
		carry = 1;

	mask = 0 - (uintptr_t)(*u.f)(c_d, r_d, _nist_p_384[0], BN_NIST_384_TOP);
	mask &= 0 - (uintptr_t)carry;
	res = c_d;
	res = (BN_ULONG *)(((uintptr_t)res & ~mask) | ((uintptr_t)r_d & mask));
	nist_cp_bn(r_d, res, BN_NIST_384_TOP);
	r->top = BN_NIST_384_TOP;
	bn_correct_top(r);

	return 1;
}

#define BN_NIST_521_RSHIFT	(521%BN_BITS2)
#define BN_NIST_521_LSHIFT	(BN_BITS2-BN_NIST_521_RSHIFT)
#define BN_NIST_521_TOP_MASK	((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)

int
BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{

	int top = a->top, i;
	BN_ULONG *r_d, *a_d = a->d, t_d[BN_NIST_521_TOP], val, tmp, *res;

	uintptr_t mask;
	static const BIGNUM _bignum_nist_p_521_sqr = {
		(BN_ULONG *)_nist_p_521_sqr,
		sizeof(_nist_p_521_sqr) / sizeof(_nist_p_521_sqr[0]),
		sizeof(_nist_p_521_sqr) / sizeof(_nist_p_521_sqr[0]),
		0,
		BN_FLG_STATIC_DATA
	};

	field = &_bignum_nist_p_521; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_521_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);







>
>







|
















|

|



|



|


|


|



|


|





|






|
<
|



|

















>
|
|
>

<
<
|
|
<
<
<







1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261

1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288


1289
1290



1291
1292
1293
1294
1295
1296
1297
		acc += rp[11];
		acc += bp[23 - 12];
		acc += bp[20 - 12];
		acc += bp[19 - 12];
		acc -= bp[22 - 12];
		rp[11] = (unsigned int)acc;

		memcpy(r_d, rbuf, sizeof(rbuf));

		carry = (int)(acc >> 32);
	}
#else
	{
		BN_ULONG t_d[BN_NIST_384_TOP] = {0};

		/*S1*/
		nist_set_256(t_d, bnbuf, 0, 0, 0, 0, 0, 23 - 4, 22 - 4,
		    21 - 4);
		/* left shift */
		{
			BN_ULONG *ap, t, c;
			ap = t_d;
			c = 0;
			for (i = 3; i != 0; --i) {
				t= *ap;
				*(ap++) = ((t << 1)|c) & BN_MASK2;
				c = (t & BN_TBIT) ? 1 : 0;
			}
			*ap = c;
		}
		carry = (int)bn_add_words(r_d + (128 / BN_BITS2),
		    r_d + (128 / BN_BITS2), t_d, BN_NIST_256_TOP);
		/*S2 */
		carry += (int)bn_add_words(r_d, r_d, bnbuf, BN_NIST_384_TOP);
		/*S3*/
		nist_set_384(t_d, bnbuf, 20, 19, 18, 17, 16, 15, 14, 13, 12,
		    23, 22, 21);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*S4*/
		nist_set_384(t_d, bnbuf, 19, 18, 17, 16, 15, 14, 13, 12, 20,
		    0, 23, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*S5*/
		nist_set_384(t_d, bnbuf, 0,0, 0,0, 23, 22, 21, 20, 0,0, 0, 0);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*S6*/
		nist_set_384(t_d, bnbuf, 0,0, 0,0, 0,0, 23, 22, 21, 0,0, 20);
		carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*D1*/
		nist_set_384(t_d, bnbuf, 22, 21, 20, 19, 18, 17, 16, 15, 14,
		    13, 12, 23);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*D2*/
		nist_set_384(t_d, bnbuf, 0,0, 0,0, 0,0, 0,23, 22, 21, 20, 0);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
		/*D3*/
		nist_set_384(t_d, bnbuf, 0,0, 0,0, 0,0, 0,23, 23, 0,0, 0);
		carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);

	}
#endif
	/* see BN_nist_mod_224 for explanation */
	addsubf = bn_sub_words;
	if (carry > 0)
		carry = (int)bn_sub_words(r_d, r_d, _nist_p_384[carry - 1],
		    BN_NIST_384_TOP);
	else if (carry < 0) {
		carry = (int)bn_add_words(r_d, r_d, _nist_p_384[-carry - 1],
		    BN_NIST_384_TOP);
		if (carry == 0)

			addsubf = bn_add_words;
	} else
		carry = 1;

	mask = 0 - (uintptr_t)(*addsubf)(c_d, r_d, _nist_p_384[0], BN_NIST_384_TOP);
	mask &= 0 - (uintptr_t)carry;
	res = c_d;
	res = (BN_ULONG *)(((uintptr_t)res & ~mask) | ((uintptr_t)r_d & mask));
	nist_cp_bn(r_d, res, BN_NIST_384_TOP);
	r->top = BN_NIST_384_TOP;
	bn_correct_top(r);

	return 1;
}

#define BN_NIST_521_RSHIFT	(521%BN_BITS2)
#define BN_NIST_521_LSHIFT	(BN_BITS2-BN_NIST_521_RSHIFT)
#define BN_NIST_521_TOP_MASK	((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)

int
BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
{
	BN_ULONG t_d[BN_NIST_521_TOP] = { 0 };
	BN_ULONG *a_d = a->d;
	BN_ULONG *r_d, *res;
	BN_ULONG tmp, val;
	uintptr_t mask;


	int top = a->top;
	int i;




	field = &_bignum_nist_p_521; /* just to make sure */

	if (BN_is_negative(a) || BN_ucmp(a, &_bignum_nist_p_521_sqr) >= 0)
		return BN_nnmod(r, a, field, ctx);

	i = BN_ucmp(field, a);
Changes to jni/libressl/crypto/bn/bn_prime.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_prime.c,v 1.18 2017/01/29 17:49:22 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_prime.c,v 1.22 2022/07/19 16:19:19 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
111
112
113
114
115
116
117


118
119
120
121
122
123
124

#include <stdio.h>
#include <time.h>

#include <openssl/err.h>

#include "bn_lcl.h"



/* NB: these functions have been "upgraded", the deprecated versions (which are
 * compatibility wrappers using these functions) are in bn_depr.c.
 * - Geoff
 */

/* The quick sieve algorithm approach to weeding out primes is







>
>







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

#include <stdio.h>
#include <time.h>

#include <openssl/err.h>

#include "bn_lcl.h"

#define LIBRESSL_HAS_BPSW

/* NB: these functions have been "upgraded", the deprecated versions (which are
 * compatibility wrappers using these functions) are in bn_depr.c.
 * - Geoff
 */

/* The quick sieve algorithm approach to weeding out primes is
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186

187

188
189
190
191
192
193
194
BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
    const BIGNUM *rem, BN_GENCB *cb)
{
	BIGNUM *t;
	int found = 0;
	int i, j, c1 = 0;
	BN_CTX *ctx;
	int checks;

	if (bits < 2 || (bits == 2 && safe)) {
		/*
		 * There are no prime numbers smaller than 2, and the smallest
		 * safe prime (7) spans three bits.
		 */
		BNerror(BN_R_BITS_TOO_SMALL);
		return 0;
	}

	ctx = BN_CTX_new();
	if (ctx == NULL)
		goto err;
	BN_CTX_start(ctx);
	if ((t = BN_CTX_get(ctx)) == NULL)
		goto err;


	checks = BN_prime_checks_for_size(bits);


loop:
	/* make a random number and set the top and bottom bits */
	if (add == NULL) {
		if (!probable_prime(ret, bits))
			goto err;
	} else {







|

















>

>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
    const BIGNUM *rem, BN_GENCB *cb)
{
	BIGNUM *t;
	int found = 0;
	int i, j, c1 = 0;
	BN_CTX *ctx;
	int checks = 1;

	if (bits < 2 || (bits == 2 && safe)) {
		/*
		 * There are no prime numbers smaller than 2, and the smallest
		 * safe prime (7) spans three bits.
		 */
		BNerror(BN_R_BITS_TOO_SMALL);
		return 0;
	}

	ctx = BN_CTX_new();
	if (ctx == NULL)
		goto err;
	BN_CTX_start(ctx);
	if ((t = BN_CTX_get(ctx)) == NULL)
		goto err;

#ifndef LIBRESSL_HAS_BPSW
	checks = BN_prime_checks_for_size(bits);
#endif

loop:
	/* make a random number and set the top and bottom bits */
	if (add == NULL) {
		if (!probable_prime(ret, bits))
			goto err;
	} else {
255
256
257
258
259
260
261
262
263
264
265
266
267












268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
	return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
}

int
BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
    int do_trial_division, BN_GENCB *cb)
{
	int i, j, ret = -1;
	int k;
	BN_CTX *ctx = NULL;
	BIGNUM *A1, *A1_odd, *check; /* taken from ctx */
	BN_MONT_CTX *mont = NULL;
	const BIGNUM *A = NULL;













	if (BN_cmp(a, BN_value_one()) <= 0)
		return 0;

	if (checks == BN_prime_checks)
		checks = BN_prime_checks_for_size(BN_num_bits(a));

	/* first look for small factors */
	if (!BN_is_odd(a))
		/* a is even => a is prime if and only if a == 2 */
		return BN_is_word(a, 2);
	if (do_trial_division) {
		for (i = 1; i < NUMPRIMES; i++) {
			BN_ULONG mod = BN_mod_word(a, primes[i]);
			if (mod == (BN_ULONG)-1)
				goto err;
			if (mod == 0)
				return 0;
		}
		if (!BN_GENCB_call(cb, 1, -1))
			goto err;
	}

	if (ctx_passed != NULL)
		ctx = ctx_passed;







<
<




>
>
>
>
>
>
>
>
>
>
>
>

















|







259
260
261
262
263
264
265


266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
	return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
}

int
BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
    int do_trial_division, BN_GENCB *cb)
{


	BN_CTX *ctx = NULL;
	BIGNUM *A1, *A1_odd, *check; /* taken from ctx */
	BN_MONT_CTX *mont = NULL;
	const BIGNUM *A = NULL;
	int i, j, k;
	int ret = -1;

#ifdef LIBRESSL_HAS_BPSW
	int is_prime;

	/* XXX - tickle BN_GENCB in bn_is_prime_bpsw(). */
	if (!bn_is_prime_bpsw(&is_prime, a, ctx_passed))
		return -1;

	return is_prime;
#endif

	if (BN_cmp(a, BN_value_one()) <= 0)
		return 0;

	if (checks == BN_prime_checks)
		checks = BN_prime_checks_for_size(BN_num_bits(a));

	/* first look for small factors */
	if (!BN_is_odd(a))
		/* a is even => a is prime if and only if a == 2 */
		return BN_is_word(a, 2);
	if (do_trial_division) {
		for (i = 1; i < NUMPRIMES; i++) {
			BN_ULONG mod = BN_mod_word(a, primes[i]);
			if (mod == (BN_ULONG)-1)
				goto err;
			if (mod == 0)
				return BN_is_word(a, primes[i]);
		}
		if (!BN_GENCB_call(cb, 1, -1))
			goto err;
	}

	if (ctx_passed != NULL)
		ctx = ctx_passed;
Changes to jni/libressl/crypto/bn/bn_shift.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_shift.c,v 1.13 2014/10/28 07:35:58 jsg Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_shift.c,v 1.14 2022/06/22 09:03:06 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
54
55
56
57
58
59
60


61
62
63
64
65
66
67
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdio.h>
#include <string.h>



#include "bn_lcl.h"

int
BN_lshift1(BIGNUM *r, const BIGNUM *a)
{
	BN_ULONG *ap, *rp, t, c;







>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdio.h>
#include <string.h>

#include <openssl/err.h>

#include "bn_lcl.h"

int
BN_lshift1(BIGNUM *r, const BIGNUM *a)
{
	BN_ULONG *ap, *rp, t, c;
133
134
135
136
137
138
139





140
141
142
143
144
145
146

int
BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
	int i, nw, lb, rb;
	BN_ULONG *t, *f;
	BN_ULONG l;






	bn_check_top(r);
	bn_check_top(a);

	r->neg = a->neg;
	nw = n / BN_BITS2;
	if (bn_wexpand(r, a->top + nw + 1) == NULL)







>
>
>
>
>







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

int
BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
	int i, nw, lb, rb;
	BN_ULONG *t, *f;
	BN_ULONG l;

	if (n < 0) {
		BNerror(BN_R_INVALID_LENGTH);
		return 0;
	}

	bn_check_top(r);
	bn_check_top(a);

	r->neg = a->neg;
	nw = n / BN_BITS2;
	if (bn_wexpand(r, a->top + nw + 1) == NULL)
170
171
172
173
174
175
176





177
178
179
180
181
182
183

int
BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
{
	int i, j, nw, lb, rb;
	BN_ULONG *t, *f;
	BN_ULONG l, tmp;






	bn_check_top(r);
	bn_check_top(a);

	nw = n / BN_BITS2;
	rb = n % BN_BITS2;
	lb = BN_BITS2 - rb;







>
>
>
>
>







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

int
BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
{
	int i, j, nw, lb, rb;
	BN_ULONG *t, *f;
	BN_ULONG l, tmp;

	if (n < 0) {
		BNerror(BN_R_INVALID_LENGTH);
		return 0;
	}

	bn_check_top(r);
	bn_check_top(a);

	nw = n / BN_BITS2;
	rb = n % BN_BITS2;
	lb = BN_BITS2 - rb;
Changes to jni/libressl/crypto/bn/bn_sqrt.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn_sqrt.c,v 1.10 2022/03/15 15:52:39 tb Exp $ */
/* Written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
 * and Bodo Moeller for the OpenSSL project. */
/* ====================================================================
 * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn_sqrt.c,v 1.11 2022/06/20 15:02:21 tb Exp $ */
/* Written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
 * and Bodo Moeller for the OpenSSL project. */
/* ====================================================================
 * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
213
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228
			goto end;
		err = 0;
		goto vrfy;
	}

	/* e > 2, so we really have to use the Tonelli/Shanks algorithm.
	 * First, find some  y  that is not a square. */
	if (!BN_copy(q, p)) goto end; /* use 'q' as temp */

		q->neg = 0;
	i = 2;
	do {
		/* For efficiency, try small numbers first;
		 * if this fails, try random numbers.
		 */
		if (i < 22) {
			if (!BN_set_word(y, i))







|
>
|







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
			goto end;
		err = 0;
		goto vrfy;
	}

	/* e > 2, so we really have to use the Tonelli/Shanks algorithm.
	 * First, find some  y  that is not a square. */
	if (!BN_copy(q, p)) /* use 'q' as temp */
		goto end;
	q->neg = 0;
	i = 2;
	do {
		/* For efficiency, try small numbers first;
		 * if this fails, try random numbers.
		 */
		if (i < 22) {
			if (!BN_set_word(y, i))
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
		if (r < -1)
			goto end;
		if (r == 0) {
			/* m divides p */
			BNerror(BN_R_P_IS_NOT_PRIME);
			goto end;
		}
	}
	while (r == 1 && ++i < 82);

		if (r != -1) {
		/* Many rounds and still no non-square -- this is more likely
		 * a bug than just bad luck.
		 * Even if  p  is not prime, we should have found some  y
		 * such that r == -1.
		 */
		BNerror(BN_R_TOO_MANY_ITERATIONS);
		goto end;







<
|

|







250
251
252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
		if (r < -1)
			goto end;
		if (r == 0) {
			/* m divides p */
			BNerror(BN_R_P_IS_NOT_PRIME);
			goto end;
		}

	} while (r == 1 && ++i < 82);

	if (r != -1) {
		/* Many rounds and still no non-square -- this is more likely
		 * a bug than just bad luck.
		 * Even if  p  is not prime, we should have found some  y
		 * such that r == -1.
		 */
		BNerror(BN_R_TOO_MANY_ITERATIONS);
		goto end;
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
	 */

	/* t := (q-1)/2  (note that  q  is odd) */
	if (!BN_rshift1(t, q))
		goto end;

	/* x := a^((q-1)/2) */
	if (BN_is_zero(t)) /* special case: p = 2^e + 1 */
	{
		if (!BN_nnmod(t, A, p, ctx))
			goto end;
		if (BN_is_zero(t)) {
			/* special case: a == 0  (mod p) */
			BN_zero(ret);
			err = 0;
			goto end;







|
<







298
299
300
301
302
303
304
305

306
307
308
309
310
311
312
	 */

	/* t := (q-1)/2  (note that  q  is odd) */
	if (!BN_rshift1(t, q))
		goto end;

	/* x := a^((q-1)/2) */
	if (BN_is_zero(t)) { /* special case: p = 2^e + 1 */

		if (!BN_nnmod(t, A, p, ctx))
			goto end;
		if (BN_is_zero(t)) {
			/* special case: a == 0  (mod p) */
			BN_zero(ret);
			err = 0;
			goto end;
Changes to jni/libressl/crypto/buffer/buf_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: buf_err.c,v 1.11 2017/01/29 17:49:22 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: buf_err.c,v 1.12 2022/07/12 14:42:48 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/buffer.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason)

static ERR_STRING_DATA BUF_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/buffer.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason)

static ERR_STRING_DATA BUF_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/bytestring/bs_cbb.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: bs_cbb.c,v 1.3 2022/01/06 14:32:55 jsing Exp $	*/
/*
 * Copyright (c) 2014, Google Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: bs_cbb.c,v 1.4 2022/07/07 17:16:05 tb Exp $	*/
/*
 * Copyright (c) 2014, Google Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
158
159
160
161
162
163
164



165
166
167
168
169
170
171

	if (cbb->base->can_resize && (out_data == NULL || out_len == NULL))
		/*
		 * |out_data| and |out_len| can only be NULL if the CBB is
		 * fixed.
		 */
		return 0;




	if (out_data != NULL)
		*out_data = cbb->base->buf;

	if (out_len != NULL)
		*out_len = cbb->base->len;








>
>
>







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

	if (cbb->base->can_resize && (out_data == NULL || out_len == NULL))
		/*
		 * |out_data| and |out_len| can only be NULL if the CBB is
		 * fixed.
		 */
		return 0;

	if (out_data != NULL && *out_data != NULL)
		return 0;

	if (out_data != NULL)
		*out_data = cbb->base->buf;

	if (out_len != NULL)
		*out_len = cbb->base->len;

Changes to jni/libressl/crypto/chacha/chacha.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: chacha.c,v 1.8 2019/01/22 00:59:21 dlg Exp $ */
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: chacha.c,v 1.9 2022/08/20 18:44:58 jsing Exp $ */
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
52
53
54




55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
72
73
74
75




76





77
78
79
80
81
82
83
84
85
86
87
	ctx->unused = 0;
}

void
ChaCha(ChaCha_ctx *ctx, unsigned char *out, const unsigned char *in, size_t len)
{
	unsigned char *k;

	int i, l;

	/* Consume remaining keystream, if any exists. */
	if (ctx->unused > 0) {
		k = ctx->ks + 64 - ctx->unused;
		l = (len > ctx->unused) ? ctx->unused : len;
		for (i = 0; i < l; i++)
			*(out++) = *(in++) ^ *(k++);
		ctx->unused -= l;
		len -= l;
	}





	chacha_encrypt_bytes((chacha_ctx *)ctx, in, out, (uint32_t)len);





}

void
CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len,
    const unsigned char key[32], const unsigned char iv[8], uint64_t counter)
{
	struct chacha_ctx ctx;


	/*
	 * chacha_ivsetup expects the counter to be in u8. Rather than
	 * converting size_t to u8 and then back again, pass a counter of
	 * NULL and manually assign it afterwards.
	 */
	chacha_keysetup(&ctx, key, 256);
	chacha_ivsetup(&ctx, iv, NULL);
	if (counter != 0) {
		ctx.input[12] = (uint32_t)counter;
		ctx.input[13] = (uint32_t)(counter >> 32);
	}





	chacha_encrypt_bytes(&ctx, in, out, (uint32_t)len);





}

void
CRYPTO_xchacha_20(unsigned char *out, const unsigned char *in, size_t len,
    const unsigned char key[32], const unsigned char iv[24])
{
	uint8_t subkey[32];

	CRYPTO_hchacha_20(subkey, key, iv);
	CRYPTO_chacha_20(out, in, len, subkey, iv + 16, 0);
}







>












>
>
>
>
|
>
>
>
>
>







>













>
>
>
>
|
>
>
>
>
>











36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
	ctx->unused = 0;
}

void
ChaCha(ChaCha_ctx *ctx, unsigned char *out, const unsigned char *in, size_t len)
{
	unsigned char *k;
	uint64_t n;
	int i, l;

	/* Consume remaining keystream, if any exists. */
	if (ctx->unused > 0) {
		k = ctx->ks + 64 - ctx->unused;
		l = (len > ctx->unused) ? ctx->unused : len;
		for (i = 0; i < l; i++)
			*(out++) = *(in++) ^ *(k++);
		ctx->unused -= l;
		len -= l;
	}

	while (len > 0) {
		if ((n = len) > UINT32_MAX)
			n = UINT32_MAX;

		chacha_encrypt_bytes((chacha_ctx *)ctx, in, out, (uint32_t)n);

		in += n;
		out += n;
		len -= n;
	}
}

void
CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len,
    const unsigned char key[32], const unsigned char iv[8], uint64_t counter)
{
	struct chacha_ctx ctx;
	uint64_t n;

	/*
	 * chacha_ivsetup expects the counter to be in u8. Rather than
	 * converting size_t to u8 and then back again, pass a counter of
	 * NULL and manually assign it afterwards.
	 */
	chacha_keysetup(&ctx, key, 256);
	chacha_ivsetup(&ctx, iv, NULL);
	if (counter != 0) {
		ctx.input[12] = (uint32_t)counter;
		ctx.input[13] = (uint32_t)(counter >> 32);
	}

	while (len > 0) {
		if ((n = len) > UINT32_MAX)
			n = UINT32_MAX;

		chacha_encrypt_bytes(&ctx, in, out, (uint32_t)n);

		in += n;
		out += n;
		len -= n;
	}
}

void
CRYPTO_xchacha_20(unsigned char *out, const unsigned char *in, size_t len,
    const unsigned char key[32], const unsigned char iv[24])
{
	uint8_t subkey[32];

	CRYPTO_hchacha_20(subkey, key, iv);
	CRYPTO_chacha_20(out, in, len, subkey, iv + 16, 0);
}
Changes to jni/libressl/crypto/cms/cms_err.c.
1
2
3
4
5
6
7
8
9
10
/* $OpenBSD: cms_err.c,v 1.12 2020/06/05 16:51:12 jsing Exp $ */
/*
 * Generated by util/mkerr.pl DO NOT EDIT
 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the OpenSSL license (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */
|

<







1
2

3
4
5
6
7
8
9
/* $OpenBSD: cms_err.c,v 1.13 2022/07/12 14:42:48 kn Exp $ */
/*

 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the OpenSSL license (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */
Changes to jni/libressl/crypto/cms/cms_sd.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: cms_sd.c,v 1.23 2019/08/11 14:35:57 jsing Exp $ */
/*
 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: cms_sd.c,v 1.24 2022/08/28 18:27:47 tb Exp $ */
/*
 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
 *
951
952
953
954
955
956
957
958

959

960

961
962
963
964
965
966
967
int
CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, int algnid, int keysize)
{
	X509_ALGOR *alg;
	ASN1_INTEGER *key = NULL;

	if (keysize > 0) {
		key = ASN1_INTEGER_new();

		if (key == NULL || !ASN1_INTEGER_set(key, keysize))

			return 0;

	}
	alg = X509_ALGOR_new();
	if (alg == NULL) {
		ASN1_INTEGER_free(key);
		return 0;
	}








|
>
|
>

>







951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
int
CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, int algnid, int keysize)
{
	X509_ALGOR *alg;
	ASN1_INTEGER *key = NULL;

	if (keysize > 0) {
		if ((key = ASN1_INTEGER_new()) == NULL)
			return 0;
		if (!ASN1_INTEGER_set(key, keysize)) {
			ASN1_INTEGER_free(key);
			return 0;
		}
	}
	alg = X509_ALGOR_new();
	if (alg == NULL) {
		ASN1_INTEGER_free(key);
		return 0;
	}

Changes to jni/libressl/crypto/comp/comp_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: comp_err.c,v 1.11 2022/01/09 23:50:10 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: comp_err.c,v 1.12 2022/07/12 14:42:48 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <openssl/opensslconf.h>

#include <openssl/comp.h>
#include <openssl/err.h>

#include "comp_local.h"

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_COMP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_COMP,0,reason)

static ERR_STRING_DATA COMP_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<







58
59
60
61
62
63
64

65
66
67
68
69
70
71
#include <openssl/opensslconf.h>

#include <openssl/comp.h>
#include <openssl/err.h>

#include "comp_local.h"


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_COMP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_COMP,0,reason)

static ERR_STRING_DATA COMP_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/compat/arc4random.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: arc4random.c,v 1.56 2022/02/28 21:56:29 dtucker Exp $	*/

/*
 * Copyright (c) 1996, David Mazieres <dm@uun.org>
 * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
 * Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
 * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: arc4random.c,v 1.58 2022/07/31 13:41:45 tb Exp $	*/

/*
 * Copyright (c) 1996, David Mazieres <dm@uun.org>
 * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
 * Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
 * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
 *
45
46
47
48
49
50
51


52
53
54
55
56
57
58
#endif				/* !__GNUC__ && !_MSC_VER */

#define KEYSZ	32
#define IVSZ	8
#define BLOCKSZ	64
#define RSBUFSZ	(16*BLOCKSZ)



/* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
static struct _rs {
	size_t		rs_have;	/* valid bytes at end of rs_buf */
	size_t		rs_count;	/* bytes till reseed */
} *rs;

/* Maybe be preserved in fork children, if _rs_allocate() decides. */







>
>







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#endif				/* !__GNUC__ && !_MSC_VER */

#define KEYSZ	32
#define IVSZ	8
#define BLOCKSZ	64
#define RSBUFSZ	(16*BLOCKSZ)

#define REKEY_BASE	(1024*1024) /* NB. should be a power of 2 */

/* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
static struct _rs {
	size_t		rs_have;	/* valid bytes at end of rs_buf */
	size_t		rs_count;	/* bytes till reseed */
} *rs;

/* Maybe be preserved in fork children, if _rs_allocate() decides. */
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101
102



103
104
105
106
107
108
109
110
	chacha_ivsetup(&rsx->rs_chacha, buf + KEYSZ);
}

static void
_rs_stir(void)
{
	u_char rnd[KEYSZ + IVSZ];


	if (getentropy(rnd, sizeof rnd) == -1)
		_getentropy_fail();

	if (!rs)
		_rs_init(rnd, sizeof(rnd));
	else
		_rs_rekey(rnd, sizeof(rnd));
	explicit_bzero(rnd, sizeof(rnd));	/* discard source seed */

	/* invalidate rs_buf */
	rs->rs_have = 0;
	memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));




	rs->rs_count = 1600000;
}

static inline void
_rs_stir_if_needed(size_t len)
{
	_rs_forkdetect();
	if (!rs || rs->rs_count <= len)







>














>
>
>
|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
	chacha_ivsetup(&rsx->rs_chacha, buf + KEYSZ);
}

static void
_rs_stir(void)
{
	u_char rnd[KEYSZ + IVSZ];
	uint32_t rekey_fuzz = 0;

	if (getentropy(rnd, sizeof rnd) == -1)
		_getentropy_fail();

	if (!rs)
		_rs_init(rnd, sizeof(rnd));
	else
		_rs_rekey(rnd, sizeof(rnd));
	explicit_bzero(rnd, sizeof(rnd));	/* discard source seed */

	/* invalidate rs_buf */
	rs->rs_have = 0;
	memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));

	/* rekey interval should not be predictable */
	chacha_encrypt_bytes(&rsx->rs_chacha, (uint8_t *)&rekey_fuzz,
	    (uint8_t *)&rekey_fuzz, sizeof(rekey_fuzz));
	rs->rs_count = REKEY_BASE + (rekey_fuzz % REKEY_BASE);
}

static inline void
_rs_stir_if_needed(size_t len)
{
	_rs_forkdetect();
	if (!rs || rs->rs_count <= len)
Changes to jni/libressl/crypto/conf/conf_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: conf_err.c,v 1.14 2020/02/17 12:51:48 inoguchi Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: conf_err.c,v 1.15 2022/07/12 14:42:48 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/conf.h>
#include <openssl/err.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason)

static ERR_STRING_DATA CONF_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/conf.h>
#include <openssl/err.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason)

static ERR_STRING_DATA CONF_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/cpt_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: cpt_err.c,v 1.13 2014/07/10 22:45:56 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: cpt_err.c,v 1.14 2022/07/12 14:42:48 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/crypto.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CRYPTO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CRYPTO,0,reason)

static ERR_STRING_DATA CRYPTO_str_functs[] = {
	{ERR_FUNC(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX),	"CRYPTO_get_ex_new_index"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/crypto.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CRYPTO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CRYPTO,0,reason)

static ERR_STRING_DATA CRYPTO_str_functs[] = {
	{ERR_FUNC(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX),	"CRYPTO_get_ex_new_index"},
Changes to jni/libressl/crypto/crypto.sym.
37
38
39
40
41
42
43

44
45
46

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65


66
67
68


69
70
71
72
73
74
75
ASN1_BIT_STRING_set_asc
ASN1_BIT_STRING_set_bit
ASN1_BMPSTRING_free
ASN1_BMPSTRING_it
ASN1_BMPSTRING_new
ASN1_ENUMERATED_free
ASN1_ENUMERATED_get

ASN1_ENUMERATED_it
ASN1_ENUMERATED_new
ASN1_ENUMERATED_set

ASN1_ENUMERATED_to_BN
ASN1_GENERALIZEDTIME_adj
ASN1_GENERALIZEDTIME_check
ASN1_GENERALIZEDTIME_free
ASN1_GENERALIZEDTIME_it
ASN1_GENERALIZEDTIME_new
ASN1_GENERALIZEDTIME_print
ASN1_GENERALIZEDTIME_set
ASN1_GENERALIZEDTIME_set_string
ASN1_GENERALSTRING_free
ASN1_GENERALSTRING_it
ASN1_GENERALSTRING_new
ASN1_IA5STRING_free
ASN1_IA5STRING_it
ASN1_IA5STRING_new
ASN1_INTEGER_cmp
ASN1_INTEGER_dup
ASN1_INTEGER_free
ASN1_INTEGER_get


ASN1_INTEGER_it
ASN1_INTEGER_new
ASN1_INTEGER_set


ASN1_INTEGER_to_BN
ASN1_NULL_free
ASN1_NULL_it
ASN1_NULL_new
ASN1_OBJECT_create
ASN1_OBJECT_free
ASN1_OBJECT_it







>



>



















>
>



>
>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
ASN1_BIT_STRING_set_asc
ASN1_BIT_STRING_set_bit
ASN1_BMPSTRING_free
ASN1_BMPSTRING_it
ASN1_BMPSTRING_new
ASN1_ENUMERATED_free
ASN1_ENUMERATED_get
ASN1_ENUMERATED_get_int64
ASN1_ENUMERATED_it
ASN1_ENUMERATED_new
ASN1_ENUMERATED_set
ASN1_ENUMERATED_set_int64
ASN1_ENUMERATED_to_BN
ASN1_GENERALIZEDTIME_adj
ASN1_GENERALIZEDTIME_check
ASN1_GENERALIZEDTIME_free
ASN1_GENERALIZEDTIME_it
ASN1_GENERALIZEDTIME_new
ASN1_GENERALIZEDTIME_print
ASN1_GENERALIZEDTIME_set
ASN1_GENERALIZEDTIME_set_string
ASN1_GENERALSTRING_free
ASN1_GENERALSTRING_it
ASN1_GENERALSTRING_new
ASN1_IA5STRING_free
ASN1_IA5STRING_it
ASN1_IA5STRING_new
ASN1_INTEGER_cmp
ASN1_INTEGER_dup
ASN1_INTEGER_free
ASN1_INTEGER_get
ASN1_INTEGER_get_int64
ASN1_INTEGER_get_uint64
ASN1_INTEGER_it
ASN1_INTEGER_new
ASN1_INTEGER_set
ASN1_INTEGER_set_int64
ASN1_INTEGER_set_uint64
ASN1_INTEGER_to_BN
ASN1_NULL_free
ASN1_NULL_it
ASN1_NULL_new
ASN1_OBJECT_create
ASN1_OBJECT_free
ASN1_OBJECT_it
128
129
130
131
132
133
134


135
136
137
138

139
140
141

142
143

144
145
146
147
148
149
150
ASN1_STRING_type
ASN1_STRING_type_new
ASN1_T61STRING_free
ASN1_T61STRING_it
ASN1_T61STRING_new
ASN1_TIME_adj
ASN1_TIME_check


ASN1_TIME_diff
ASN1_TIME_free
ASN1_TIME_it
ASN1_TIME_new

ASN1_TIME_print
ASN1_TIME_set
ASN1_TIME_set_string

ASN1_TIME_set_tm
ASN1_TIME_to_generalizedtime

ASN1_TYPE_cmp
ASN1_TYPE_free
ASN1_TYPE_get
ASN1_TYPE_get_int_octetstring
ASN1_TYPE_get_octetstring
ASN1_TYPE_new
ASN1_TYPE_set







>
>




>



>


>







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
ASN1_STRING_type
ASN1_STRING_type_new
ASN1_T61STRING_free
ASN1_T61STRING_it
ASN1_T61STRING_new
ASN1_TIME_adj
ASN1_TIME_check
ASN1_TIME_cmp_time_t
ASN1_TIME_compare
ASN1_TIME_diff
ASN1_TIME_free
ASN1_TIME_it
ASN1_TIME_new
ASN1_TIME_normalize
ASN1_TIME_print
ASN1_TIME_set
ASN1_TIME_set_string
ASN1_TIME_set_string_X509
ASN1_TIME_set_tm
ASN1_TIME_to_generalizedtime
ASN1_TIME_to_tm
ASN1_TYPE_cmp
ASN1_TYPE_free
ASN1_TYPE_get
ASN1_TYPE_get_int_octetstring
ASN1_TYPE_get_octetstring
ASN1_TYPE_new
ASN1_TYPE_set
536
537
538
539
540
541
542

543
544
545
546
547
548
549
BN_pseudo_rand
BN_pseudo_rand_range
BN_rand
BN_rand_range
BN_reciprocal
BN_rshift
BN_rshift1

BN_set_bit
BN_set_flags
BN_set_negative
BN_set_params
BN_set_word
BN_sqr
BN_sub







>







547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
BN_pseudo_rand
BN_pseudo_rand_range
BN_rand
BN_rand_range
BN_reciprocal
BN_rshift
BN_rshift1
BN_security_bits
BN_set_bit
BN_set_flags
BN_set_negative
BN_set_params
BN_set_word
BN_sqr
BN_sub
945
946
947
948
949
950
951

952
953
954
955
956
957
958
DH_get0_q
DH_get_default_method
DH_get_ex_data
DH_get_ex_new_index
DH_get_length
DH_new
DH_new_method

DH_set0_key
DH_set0_pqg
DH_set_default_method
DH_set_ex_data
DH_set_flags
DH_set_length
DH_set_method







>







957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
DH_get0_q
DH_get_default_method
DH_get_ex_data
DH_get_ex_new_index
DH_get_length
DH_new
DH_new_method
DH_security_bits
DH_set0_key
DH_set0_pqg
DH_set_default_method
DH_set_ex_data
DH_set_flags
DH_set_length
DH_set_method
1002
1003
1004
1005
1006
1007
1008

1009

1010
1011
1012
1013
1014
1015

1016
1017
1018
1019
1020
1021
1022
DSA_get0_pub_key
DSA_get0_q
DSA_get_default_method
DSA_get_ex_data
DSA_get_ex_new_index
DSA_meth_dup
DSA_meth_free

DSA_meth_new

DSA_meth_set_finish
DSA_meth_set_sign
DSA_new
DSA_new_method
DSA_print
DSA_print_fp

DSA_set0_key
DSA_set0_pqg
DSA_set_default_method
DSA_set_ex_data
DSA_set_flags
DSA_set_method
DSA_sign







>

>






>







1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
DSA_get0_pub_key
DSA_get0_q
DSA_get_default_method
DSA_get_ex_data
DSA_get_ex_new_index
DSA_meth_dup
DSA_meth_free
DSA_meth_get0_name
DSA_meth_new
DSA_meth_set1_name
DSA_meth_set_finish
DSA_meth_set_sign
DSA_new
DSA_new_method
DSA_print
DSA_print_fp
DSA_security_bits
DSA_set0_key
DSA_set0_pqg
DSA_set_default_method
DSA_set_ex_data
DSA_set_flags
DSA_set_method
DSA_sign
1621
1622
1623
1624
1625
1626
1627

1628
1629
1630
1631
1632
1633
1634
EVP_PKEY_asn1_set_ctrl
EVP_PKEY_asn1_set_free
EVP_PKEY_asn1_set_param
EVP_PKEY_asn1_set_param_check
EVP_PKEY_asn1_set_private
EVP_PKEY_asn1_set_public
EVP_PKEY_asn1_set_public_check

EVP_PKEY_assign
EVP_PKEY_base_id
EVP_PKEY_bits
EVP_PKEY_check
EVP_PKEY_cmp
EVP_PKEY_cmp_parameters
EVP_PKEY_copy_parameters







>







1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
EVP_PKEY_asn1_set_ctrl
EVP_PKEY_asn1_set_free
EVP_PKEY_asn1_set_param
EVP_PKEY_asn1_set_param_check
EVP_PKEY_asn1_set_private
EVP_PKEY_asn1_set_public
EVP_PKEY_asn1_set_public_check
EVP_PKEY_asn1_set_security_bits
EVP_PKEY_assign
EVP_PKEY_base_id
EVP_PKEY_bits
EVP_PKEY_check
EVP_PKEY_cmp
EVP_PKEY_cmp_parameters
EVP_PKEY_copy_parameters
1693
1694
1695
1696
1697
1698
1699

1700
1701
1702
1703
1704
1705
1706
EVP_PKEY_paramgen
EVP_PKEY_paramgen_init
EVP_PKEY_print_params
EVP_PKEY_print_private
EVP_PKEY_print_public
EVP_PKEY_public_check
EVP_PKEY_save_parameters

EVP_PKEY_set1_DH
EVP_PKEY_set1_DSA
EVP_PKEY_set1_EC_KEY
EVP_PKEY_set1_RSA
EVP_PKEY_set_type
EVP_PKEY_set_type_str
EVP_PKEY_sign







>







1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
EVP_PKEY_paramgen
EVP_PKEY_paramgen_init
EVP_PKEY_print_params
EVP_PKEY_print_private
EVP_PKEY_print_public
EVP_PKEY_public_check
EVP_PKEY_save_parameters
EVP_PKEY_security_bits
EVP_PKEY_set1_DH
EVP_PKEY_set1_DSA
EVP_PKEY_set1_EC_KEY
EVP_PKEY_set1_RSA
EVP_PKEY_set_type
EVP_PKEY_set_type_str
EVP_PKEY_sign
1784
1785
1786
1787
1788
1789
1790

1791
1792
1793
1794
1795
1796
1797
EVP_camellia_256_ofb
EVP_cast5_cbc
EVP_cast5_cfb
EVP_cast5_cfb64
EVP_cast5_ecb
EVP_cast5_ofb
EVP_chacha20

EVP_cleanup
EVP_des_cbc
EVP_des_cfb
EVP_des_cfb1
EVP_des_cfb64
EVP_des_cfb8
EVP_des_ecb







>







1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
EVP_camellia_256_ofb
EVP_cast5_cbc
EVP_cast5_cfb
EVP_cast5_cfb64
EVP_cast5_ecb
EVP_cast5_ofb
EVP_chacha20
EVP_chacha20_poly1305
EVP_cleanup
EVP_des_cbc
EVP_des_cfb
EVP_des_cfb1
EVP_des_cfb64
EVP_des_cfb8
EVP_des_ecb
2153
2154
2155
2156
2157
2158
2159

2160
2161
2162
2163
2164
2165
2166
OCSP_sendreq_new
OCSP_single_get0_status
OCSP_url_svcloc_new
OPENSSL_add_all_algorithms_conf
OPENSSL_add_all_algorithms_noconf
OPENSSL_asc2uni
OPENSSL_cleanse

OPENSSL_config
OPENSSL_cpu_caps
OPENSSL_cpuid_setup
OPENSSL_init
OPENSSL_init_crypto
OPENSSL_load_builtin_modules
OPENSSL_no_config







>







2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
OCSP_sendreq_new
OCSP_single_get0_status
OCSP_url_svcloc_new
OPENSSL_add_all_algorithms_conf
OPENSSL_add_all_algorithms_noconf
OPENSSL_asc2uni
OPENSSL_cleanse
OPENSSL_cleanup
OPENSSL_config
OPENSSL_cpu_caps
OPENSSL_cpuid_setup
OPENSSL_init
OPENSSL_init_crypto
OPENSSL_load_builtin_modules
OPENSSL_no_config
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315





2316










2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332

2333
2334
2335
2336
2337
2338
2339
2340
2341

2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
PKCS12_AUTHSAFES_it
PKCS12_BAGS_free
PKCS12_BAGS_it
PKCS12_BAGS_new
PKCS12_MAC_DATA_free
PKCS12_MAC_DATA_it
PKCS12_MAC_DATA_new
PKCS12_MAKE_KEYBAG
PKCS12_MAKE_SHKEYBAG
PKCS12_PBE_add
PKCS12_PBE_keyivgen
PKCS12_SAFEBAGS_it





PKCS12_SAFEBAG_free










PKCS12_SAFEBAG_it
PKCS12_SAFEBAG_new
PKCS12_add_CSPName_asc
PKCS12_add_cert
PKCS12_add_friendlyname_asc
PKCS12_add_friendlyname_uni
PKCS12_add_key
PKCS12_add_localkeyid
PKCS12_add_safe
PKCS12_add_safes
PKCS12_certbag2x509
PKCS12_certbag2x509crl
PKCS12_create
PKCS12_decrypt_skey
PKCS12_free
PKCS12_gen_mac

PKCS12_get_attr_gen
PKCS12_get_friendlyname
PKCS12_init
PKCS12_it
PKCS12_item_decrypt_d2i
PKCS12_item_i2d_encrypt
PKCS12_item_pack_safebag
PKCS12_key_gen_asc
PKCS12_key_gen_uni

PKCS12_new
PKCS12_newpass
PKCS12_pack_authsafes
PKCS12_pack_p7data
PKCS12_pack_p7encdata
PKCS12_parse
PKCS12_pbe_crypt
PKCS12_set_mac
PKCS12_setup_mac
PKCS12_unpack_authsafes
PKCS12_unpack_p7data
PKCS12_unpack_p7encdata
PKCS12_verify_mac
PKCS12_x5092certbag
PKCS12_x509crl2certbag
PKCS1_MGF1
PKCS5_PBE_add
PKCS5_PBE_keyivgen
PKCS5_PBKDF2_HMAC
PKCS5_PBKDF2_HMAC_SHA1
PKCS5_pbe2_set
PKCS5_pbe2_set_iv







<
<



>
>
>
>
>

>
>
>
>
>
>
>
>
>
>










<
<




>









>













<
<







2324
2325
2326
2327
2328
2329
2330


2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359


2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387


2388
2389
2390
2391
2392
2393
2394
PKCS12_AUTHSAFES_it
PKCS12_BAGS_free
PKCS12_BAGS_it
PKCS12_BAGS_new
PKCS12_MAC_DATA_free
PKCS12_MAC_DATA_it
PKCS12_MAC_DATA_new


PKCS12_PBE_add
PKCS12_PBE_keyivgen
PKCS12_SAFEBAGS_it
PKCS12_SAFEBAG_create0_p8inf
PKCS12_SAFEBAG_create0_pkcs8
PKCS12_SAFEBAG_create_cert
PKCS12_SAFEBAG_create_crl
PKCS12_SAFEBAG_create_pkcs8_encrypt
PKCS12_SAFEBAG_free
PKCS12_SAFEBAG_get0_attr
PKCS12_SAFEBAG_get0_attrs
PKCS12_SAFEBAG_get0_p8inf
PKCS12_SAFEBAG_get0_pkcs8
PKCS12_SAFEBAG_get0_safes
PKCS12_SAFEBAG_get0_type
PKCS12_SAFEBAG_get1_cert
PKCS12_SAFEBAG_get1_crl
PKCS12_SAFEBAG_get_bag_nid
PKCS12_SAFEBAG_get_nid
PKCS12_SAFEBAG_it
PKCS12_SAFEBAG_new
PKCS12_add_CSPName_asc
PKCS12_add_cert
PKCS12_add_friendlyname_asc
PKCS12_add_friendlyname_uni
PKCS12_add_key
PKCS12_add_localkeyid
PKCS12_add_safe
PKCS12_add_safes


PKCS12_create
PKCS12_decrypt_skey
PKCS12_free
PKCS12_gen_mac
PKCS12_get0_mac
PKCS12_get_attr_gen
PKCS12_get_friendlyname
PKCS12_init
PKCS12_it
PKCS12_item_decrypt_d2i
PKCS12_item_i2d_encrypt
PKCS12_item_pack_safebag
PKCS12_key_gen_asc
PKCS12_key_gen_uni
PKCS12_mac_present
PKCS12_new
PKCS12_newpass
PKCS12_pack_authsafes
PKCS12_pack_p7data
PKCS12_pack_p7encdata
PKCS12_parse
PKCS12_pbe_crypt
PKCS12_set_mac
PKCS12_setup_mac
PKCS12_unpack_authsafes
PKCS12_unpack_p7data
PKCS12_unpack_p7encdata
PKCS12_verify_mac


PKCS1_MGF1
PKCS5_PBE_add
PKCS5_PBE_keyivgen
PKCS5_PBKDF2_HMAC
PKCS5_PBKDF2_HMAC_SHA1
PKCS5_pbe2_set
PKCS5_pbe2_set_iv
2450
2451
2452
2453
2454
2455
2456

2457
2458
2459
2460
2461
2462
2463
PKCS7_verify
PKCS8_PRIV_KEY_INFO_free
PKCS8_PRIV_KEY_INFO_it
PKCS8_PRIV_KEY_INFO_new
PKCS8_add_keyusage
PKCS8_decrypt
PKCS8_encrypt

PKCS8_pkey_add1_attr_by_NID
PKCS8_pkey_get0
PKCS8_pkey_get0_attrs
PKCS8_pkey_set0
PKEY_USAGE_PERIOD_free
PKEY_USAGE_PERIOD_it
PKEY_USAGE_PERIOD_new







>







2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
PKCS7_verify
PKCS8_PRIV_KEY_INFO_free
PKCS8_PRIV_KEY_INFO_it
PKCS8_PRIV_KEY_INFO_new
PKCS8_add_keyusage
PKCS8_decrypt
PKCS8_encrypt
PKCS8_get_attr
PKCS8_pkey_add1_attr_by_NID
PKCS8_pkey_get0
PKCS8_pkey_get0_attrs
PKCS8_pkey_set0
PKEY_USAGE_PERIOD_free
PKEY_USAGE_PERIOD_it
PKEY_USAGE_PERIOD_new
2597
2598
2599
2600
2601
2602
2603

2604
2605
2606
2607
2608
2609
2610
RSA_pkey_ctx_ctrl
RSA_print
RSA_print_fp
RSA_private_decrypt
RSA_private_encrypt
RSA_public_decrypt
RSA_public_encrypt

RSA_set0_crt_params
RSA_set0_factors
RSA_set0_key
RSA_set_default_method
RSA_set_ex_data
RSA_set_flags
RSA_set_method







>







2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
RSA_pkey_ctx_ctrl
RSA_print
RSA_print_fp
RSA_private_decrypt
RSA_private_encrypt
RSA_public_decrypt
RSA_public_encrypt
RSA_security_bits
RSA_set0_crt_params
RSA_set0_factors
RSA_set0_key
RSA_set_default_method
RSA_set_ex_data
RSA_set_flags
RSA_set_method
2786
2787
2788
2789
2790
2791
2792

2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808



2809
2810
2811

2812
2813
2814
2815
2816
2817
2818
TS_RESP_CTX_set_def_policy
TS_RESP_CTX_set_extension_cb
TS_RESP_CTX_set_serial_cb
TS_RESP_CTX_set_signer_cert
TS_RESP_CTX_set_signer_key
TS_RESP_CTX_set_status_info
TS_RESP_CTX_set_status_info_cond

TS_RESP_create_response
TS_RESP_dup
TS_RESP_free
TS_RESP_get_status_info
TS_RESP_get_token
TS_RESP_get_tst_info
TS_RESP_it
TS_RESP_new
TS_RESP_print_bio
TS_RESP_set_status_info
TS_RESP_set_tst_info
TS_RESP_verify_response
TS_RESP_verify_signature
TS_RESP_verify_token
TS_STATUS_INFO_dup
TS_STATUS_INFO_free



TS_STATUS_INFO_it
TS_STATUS_INFO_new
TS_STATUS_INFO_print_bio

TS_TST_INFO_add_ext
TS_TST_INFO_delete_ext
TS_TST_INFO_dup
TS_TST_INFO_ext_free
TS_TST_INFO_free
TS_TST_INFO_get_accuracy
TS_TST_INFO_get_ext







>
















>
>
>



>







2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
TS_RESP_CTX_set_def_policy
TS_RESP_CTX_set_extension_cb
TS_RESP_CTX_set_serial_cb
TS_RESP_CTX_set_signer_cert
TS_RESP_CTX_set_signer_key
TS_RESP_CTX_set_status_info
TS_RESP_CTX_set_status_info_cond
TS_RESP_CTX_set_time_cb
TS_RESP_create_response
TS_RESP_dup
TS_RESP_free
TS_RESP_get_status_info
TS_RESP_get_token
TS_RESP_get_tst_info
TS_RESP_it
TS_RESP_new
TS_RESP_print_bio
TS_RESP_set_status_info
TS_RESP_set_tst_info
TS_RESP_verify_response
TS_RESP_verify_signature
TS_RESP_verify_token
TS_STATUS_INFO_dup
TS_STATUS_INFO_free
TS_STATUS_INFO_get0_failure_info
TS_STATUS_INFO_get0_status
TS_STATUS_INFO_get0_text
TS_STATUS_INFO_it
TS_STATUS_INFO_new
TS_STATUS_INFO_print_bio
TS_STATUS_INFO_set_status
TS_TST_INFO_add_ext
TS_TST_INFO_delete_ext
TS_TST_INFO_dup
TS_TST_INFO_ext_free
TS_TST_INFO_free
TS_TST_INFO_get_accuracy
TS_TST_INFO_get_ext
2838
2839
2840
2841
2842
2843
2844

2845
2846
2847
2848





2849
2850
2851
2852
2853
2854
2855
TS_TST_INFO_set_nonce
TS_TST_INFO_set_ordering
TS_TST_INFO_set_policy_id
TS_TST_INFO_set_serial
TS_TST_INFO_set_time
TS_TST_INFO_set_tsa
TS_TST_INFO_set_version

TS_VERIFY_CTX_cleanup
TS_VERIFY_CTX_free
TS_VERIFY_CTX_init
TS_VERIFY_CTX_new





TS_X509_ALGOR_print_bio
TS_ext_print_bio
TXT_DB_create_index
TXT_DB_free
TXT_DB_get_by_index
TXT_DB_insert
TXT_DB_read







>




>
>
>
>
>







2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
TS_TST_INFO_set_nonce
TS_TST_INFO_set_ordering
TS_TST_INFO_set_policy_id
TS_TST_INFO_set_serial
TS_TST_INFO_set_time
TS_TST_INFO_set_tsa
TS_TST_INFO_set_version
TS_VERIFY_CTX_add_flags
TS_VERIFY_CTX_cleanup
TS_VERIFY_CTX_free
TS_VERIFY_CTX_init
TS_VERIFY_CTX_new
TS_VERIFY_CTX_set_certs
TS_VERIFY_CTX_set_data
TS_VERIFY_CTX_set_flags
TS_VERIFY_CTX_set_imprint
TS_VERIFY_CTX_set_store
TS_X509_ALGOR_print_bio
TS_ext_print_bio
TXT_DB_create_index
TXT_DB_free
TXT_DB_get_by_index
TXT_DB_insert
TXT_DB_read
3293
3294
3295
3296
3297
3298
3299

3300
3301
3302
3303
3304
3305
3306
3307
3308
3309

3310
3311
3312
3313
3314
3315
3316
X509_VERIFY_PARAM_free
X509_VERIFY_PARAM_get0
X509_VERIFY_PARAM_get0_name
X509_VERIFY_PARAM_get0_peername
X509_VERIFY_PARAM_get_count
X509_VERIFY_PARAM_get_depth
X509_VERIFY_PARAM_get_flags

X509_VERIFY_PARAM_inherit
X509_VERIFY_PARAM_lookup
X509_VERIFY_PARAM_new
X509_VERIFY_PARAM_set1
X509_VERIFY_PARAM_set1_email
X509_VERIFY_PARAM_set1_host
X509_VERIFY_PARAM_set1_ip
X509_VERIFY_PARAM_set1_ip_asc
X509_VERIFY_PARAM_set1_name
X509_VERIFY_PARAM_set1_policies

X509_VERIFY_PARAM_set_depth
X509_VERIFY_PARAM_set_flags
X509_VERIFY_PARAM_set_hostflags
X509_VERIFY_PARAM_set_purpose
X509_VERIFY_PARAM_set_time
X509_VERIFY_PARAM_set_trust
X509_VERIFY_PARAM_table_cleanup







>










>







3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
X509_VERIFY_PARAM_free
X509_VERIFY_PARAM_get0
X509_VERIFY_PARAM_get0_name
X509_VERIFY_PARAM_get0_peername
X509_VERIFY_PARAM_get_count
X509_VERIFY_PARAM_get_depth
X509_VERIFY_PARAM_get_flags
X509_VERIFY_PARAM_get_time
X509_VERIFY_PARAM_inherit
X509_VERIFY_PARAM_lookup
X509_VERIFY_PARAM_new
X509_VERIFY_PARAM_set1
X509_VERIFY_PARAM_set1_email
X509_VERIFY_PARAM_set1_host
X509_VERIFY_PARAM_set1_ip
X509_VERIFY_PARAM_set1_ip_asc
X509_VERIFY_PARAM_set1_name
X509_VERIFY_PARAM_set1_policies
X509_VERIFY_PARAM_set_auth_level
X509_VERIFY_PARAM_set_depth
X509_VERIFY_PARAM_set_flags
X509_VERIFY_PARAM_set_hostflags
X509_VERIFY_PARAM_set_purpose
X509_VERIFY_PARAM_set_time
X509_VERIFY_PARAM_set_trust
X509_VERIFY_PARAM_table_cleanup
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
a2i_IPADDRESS_NC
a2i_ipadd
b2i_PVK_bio
b2i_PrivateKey
b2i_PrivateKey_bio
b2i_PublicKey
b2i_PublicKey_bio
c2i_ASN1_BIT_STRING
c2i_ASN1_INTEGER
c2i_ASN1_OBJECT
d2i_ACCESS_DESCRIPTION
d2i_ASIdOrRange
d2i_ASIdentifierChoice
d2i_ASIdentifiers
d2i_ASN1_BIT_STRING
d2i_ASN1_BMPSTRING
d2i_ASN1_ENUMERATED







<
<
<







3544
3545
3546
3547
3548
3549
3550



3551
3552
3553
3554
3555
3556
3557
a2i_IPADDRESS_NC
a2i_ipadd
b2i_PVK_bio
b2i_PrivateKey
b2i_PrivateKey_bio
b2i_PublicKey
b2i_PublicKey_bio



d2i_ACCESS_DESCRIPTION
d2i_ASIdOrRange
d2i_ASIdentifierChoice
d2i_ASIdentifiers
d2i_ASN1_BIT_STRING
d2i_ASN1_BMPSTRING
d2i_ASN1_ENUMERATED
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
i2a_ASN1_ENUMERATED
i2a_ASN1_INTEGER
i2a_ASN1_OBJECT
i2a_ASN1_STRING
i2b_PVK_bio
i2b_PrivateKey_bio
i2b_PublicKey_bio
i2c_ASN1_BIT_STRING
i2c_ASN1_INTEGER
i2d_ACCESS_DESCRIPTION
i2d_ASIdOrRange
i2d_ASIdentifierChoice
i2d_ASIdentifiers
i2d_ASN1_BIT_STRING
i2d_ASN1_BMPSTRING
i2d_ASN1_ENUMERATED







<
<







3755
3756
3757
3758
3759
3760
3761


3762
3763
3764
3765
3766
3767
3768
i2a_ASN1_ENUMERATED
i2a_ASN1_INTEGER
i2a_ASN1_OBJECT
i2a_ASN1_STRING
i2b_PVK_bio
i2b_PrivateKey_bio
i2b_PublicKey_bio


i2d_ACCESS_DESCRIPTION
i2d_ASIdOrRange
i2d_ASIdentifierChoice
i2d_ASIdentifiers
i2d_ASN1_BIT_STRING
i2d_ASN1_BMPSTRING
i2d_ASN1_ENUMERATED
Changes to jni/libressl/crypto/crypto_init.c.
15
16
17
18
19
20
21
22
23

24
25
26
27

28
29
30
31

32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

48


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65













 */

/* OpenSSL style init */

#include <pthread.h>
#include <stdio.h>

#include <openssl/objects.h>
#include <openssl/conf.h>

#include <openssl/evp.h>
#include <openssl/err.h>

#include "cryptlib.h"


int OpenSSL_config(const char *);
int OpenSSL_no_config(void);


static pthread_t crypto_init_thread;


static void
OPENSSL_init_crypto_internal(void)
{
	crypto_init_thread = pthread_self();

	OPENSSL_cpuid_setup();
	ERR_load_crypto_strings();
	OpenSSL_add_all_ciphers();
	OpenSSL_add_all_digests();
}

int
OPENSSL_init_crypto(uint64_t opts, const void *settings)
{

	static pthread_once_t once = PTHREAD_ONCE_INIT;



	if (pthread_equal(pthread_self(), crypto_init_thread))
		return 1; /* don't recurse */

	if (pthread_once(&once, OPENSSL_init_crypto_internal) != 0)
		return 0;

	if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG) &&
	    (OpenSSL_no_config() == 0))
		return 0;

	if ((opts & OPENSSL_INIT_LOAD_CONFIG) &&
	    (OpenSSL_config(NULL) == 0))
		return 0;

	return 1;
}




















|
|
>

|


>




>

>















>
|
>
>




|












>
>
>
>
>
>
>
>
>
>
>
>
>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
 */

/* OpenSSL style init */

#include <pthread.h>
#include <stdio.h>

#include <openssl/conf.h>
#include <openssl/engine.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "cryptlib.h"
#include "x509_issuer_cache.h"

int OpenSSL_config(const char *);
int OpenSSL_no_config(void);

static pthread_once_t crypto_init_once = PTHREAD_ONCE_INIT;
static pthread_t crypto_init_thread;
static int crypto_init_cleaned_up;

static void
OPENSSL_init_crypto_internal(void)
{
	crypto_init_thread = pthread_self();

	OPENSSL_cpuid_setup();
	ERR_load_crypto_strings();
	OpenSSL_add_all_ciphers();
	OpenSSL_add_all_digests();
}

int
OPENSSL_init_crypto(uint64_t opts, const void *settings)
{
	if (crypto_init_cleaned_up) {
		CRYPTOerror(ERR_R_INIT_FAIL);
		return 0;
	}

	if (pthread_equal(pthread_self(), crypto_init_thread))
		return 1; /* don't recurse */

	if (pthread_once(&crypto_init_once, OPENSSL_init_crypto_internal) != 0)
		return 0;

	if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG) &&
	    (OpenSSL_no_config() == 0))
		return 0;

	if ((opts & OPENSSL_INIT_LOAD_CONFIG) &&
	    (OpenSSL_config(NULL) == 0))
		return 0;

	return 1;
}

void
OPENSSL_cleanup(void)
{
	/* This currently calls init... */
	ERR_free_strings();

	ENGINE_cleanup();
	EVP_cleanup();
	x509_issuer_cache_free();

	crypto_init_cleaned_up = 1;
}
Changes to jni/libressl/crypto/ct/ct_err.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: ct_err.c,v 1.5 2021/12/18 16:50:40 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: ct_err.c,v 1.7 2022/07/12 14:42:48 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <openssl/err.h>
#include <openssl/cterr.h>

#ifndef OPENSSL_NO_ERR

static ERR_STRING_DATA CT_str_functs[] = {
	{ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW, 0), "CTLOG_new"},
	{ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW_FROM_BASE64, 0),
	 "CTLOG_new_from_base64"},







<
<
<
<
<
|
|







49
50
51
52
53
54
55





56
57
58
59
60
61
62
63
64
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <openssl/ct.h>
#include <openssl/err.h>

#ifndef OPENSSL_NO_ERR

static ERR_STRING_DATA CT_str_functs[] = {
	{ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW, 0), "CTLOG_new"},
	{ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW_FROM_BASE64, 0),
	 "CTLOG_new_from_base64"},
Changes to jni/libressl/crypto/ct/ct_sct_ctx.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: ct_sct_ctx.c,v 1.5 2021/12/18 16:34:52 tb Exp $ */
/*
 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
 * (steve@openssl.org) for the OpenSSL project 2014.
 */
/* ====================================================================
 * Copyright (c) 2014 The OpenSSL Project.  All rights reserved.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: ct_sct_ctx.c,v 1.6 2022/06/30 11:14:47 tb Exp $ */
/*
 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
 * (steve@openssl.org) for the OpenSSL project 2014.
 */
/* ====================================================================
 * Copyright (c) 2014 The OpenSSL Project.  All rights reserved.
 *
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# error "CT is disabled"
#endif

#include <stddef.h>
#include <string.h>

#include <openssl/err.h>
#include <openssl/obj_mac.h>
#include <openssl/x509.h>

#include "ct_local.h"

SCT_CTX *
SCT_CTX_new(void)
{







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# error "CT is disabled"
#endif

#include <stddef.h>
#include <string.h>

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/x509.h>

#include "ct_local.h"

SCT_CTX *
SCT_CTX_new(void)
{
Changes to jni/libressl/crypto/dh/dh_ameth.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: dh_ameth.c,v 1.23 2022/01/20 11:00:34 inoguchi Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dh_ameth.c,v 1.24 2022/06/27 12:36:05 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
392
393
394
395
396
397
398






399
400
401
402
403
404
405
}

static int
dh_bits(const EVP_PKEY *pkey)
{
	return BN_num_bits(pkey->pkey.dh->p);
}







static int
dh_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
{
	if (BN_cmp(a->pkey.dh->p, b->pkey.dh->p) ||
	    BN_cmp(a->pkey.dh->g, b->pkey.dh->g))
		return 0;







>
>
>
>
>
>







392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
}

static int
dh_bits(const EVP_PKEY *pkey)
{
	return BN_num_bits(pkey->pkey.dh->p);
}

static int
dh_security_bits(const EVP_PKEY *pkey)
{
	return DH_security_bits(pkey->pkey.dh);
}

static int
dh_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
{
	if (BN_cmp(a->pkey.dh->p, b->pkey.dh->p) ||
	    BN_cmp(a->pkey.dh->g, b->pkey.dh->g))
		return 0;
508
509
510
511
512
513
514

515
516
517
518
519
520
521

	.priv_decode = dh_priv_decode,
	.priv_encode = dh_priv_encode,
	.priv_print = dh_private_print,

	.pkey_size = int_dh_size,
	.pkey_bits = dh_bits,


	.param_decode = dh_param_decode,
	.param_encode = dh_param_encode,
	.param_missing = dh_missing_parameters,
	.param_copy = dh_copy_parameters,
	.param_cmp = dh_cmp_parameters,
	.param_print = dh_param_print,







>







514
515
516
517
518
519
520
521
522
523
524
525
526
527
528

	.priv_decode = dh_priv_decode,
	.priv_encode = dh_priv_encode,
	.priv_print = dh_private_print,

	.pkey_size = int_dh_size,
	.pkey_bits = dh_bits,
	.pkey_security_bits = dh_security_bits,

	.param_decode = dh_param_decode,
	.param_encode = dh_param_encode,
	.param_missing = dh_missing_parameters,
	.param_copy = dh_copy_parameters,
	.param_cmp = dh_cmp_parameters,
	.param_print = dh_param_print,
Changes to jni/libressl/crypto/dh/dh_check.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: dh_check.c,v 1.24 2022/01/10 12:00:52 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dh_check.c,v 1.25 2022/07/13 18:38:20 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
	 * Check that 1 < pub_key < dh->p - 1
	 */

	if (BN_cmp(pub_key, BN_value_one()) <= 0)
		*flags |= DH_CHECK_PUBKEY_TOO_SMALL;

	/* max_pub_key = dh->p - 1 */
	if (BN_copy(max_pub_key, dh->p) == NULL)
		goto err;
	if (!BN_sub_word(max_pub_key, 1))
		goto err;

	if (BN_cmp(pub_key, max_pub_key) >= 0)
		*flags |= DH_CHECK_PUBKEY_TOO_LARGE;

	/*
	 * If dh->q is set, check that pub_key^q == 1 mod p







|
<
<







265
266
267
268
269
270
271
272


273
274
275
276
277
278
279
	 * Check that 1 < pub_key < dh->p - 1
	 */

	if (BN_cmp(pub_key, BN_value_one()) <= 0)
		*flags |= DH_CHECK_PUBKEY_TOO_SMALL;

	/* max_pub_key = dh->p - 1 */
	if (!BN_sub(max_pub_key, dh->p, BN_value_one()))


		goto err;

	if (BN_cmp(pub_key, max_pub_key) >= 0)
		*flags |= DH_CHECK_PUBKEY_TOO_LARGE;

	/*
	 * If dh->q is set, check that pub_key^q == 1 mod p
Changes to jni/libressl/crypto/dh/dh_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: dh_err.c,v 1.17 2022/01/10 12:00:52 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dh_err.c,v 1.18 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/dh.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason)

static ERR_STRING_DATA DH_str_functs[]=	{
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/dh.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason)

static ERR_STRING_DATA DH_str_functs[]=	{
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/dh/dh_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: dh_lib.c,v 1.36 2022/01/07 09:27:13 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dh_lib.c,v 1.37 2022/06/27 12:31:38 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
240
241
242
243
244
245
246













247
248
249
250
251
252
253
}

int
DH_bits(const DH *dh)
{
	return BN_num_bits(dh->p);
}














ENGINE *
DH_get0_engine(DH *dh)
{
	return dh->engine;
}








>
>
>
>
>
>
>
>
>
>
>
>
>







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
}

int
DH_bits(const DH *dh)
{
	return BN_num_bits(dh->p);
}

int
DH_security_bits(const DH *dh)
{
	int N = -1;

	if (dh->q != NULL)
		N = BN_num_bits(dh->q);
	else if (dh->length > 0)
		N = dh->length;

	return BN_security_bits(BN_num_bits(dh->p), N);
}

ENGINE *
DH_get0_engine(DH *dh)
{
	return dh->engine;
}

Changes to jni/libressl/crypto/dsa/dsa_ameth.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* $OpenBSD: dsa_ameth.c,v 1.35 2022/04/07 17:38:24 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
|











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* $OpenBSD: dsa_ameth.c,v 1.37 2022/06/27 12:36:05 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	DSA *dsa = NULL;

	if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
		return 0;
	X509_ALGOR_get0(NULL, &ptype, &pval, palg);

	if (ptype == V_ASN1_SEQUENCE) {
		pstr = pval;	
		pm = pstr->data;
		pmlen = pstr->length;

		if (!(dsa = d2i_DSAparams(NULL, &pm, pmlen))) {
			DSAerror(DSA_R_DECODE_ERROR);
			goto err;
		}
	} else if (ptype == V_ASN1_NULL || ptype == V_ASN1_UNDEF) {
		if (!(dsa = DSA_new())) {
			DSAerror(ERR_R_MALLOC_FAILURE);
			goto err;
			}
	} else {
		DSAerror(DSA_R_PARAMETER_ENCODING_ERROR);
		goto err;
	}

	if (!(public_key=d2i_ASN1_INTEGER(NULL, &p, pklen))) {
		DSAerror(DSA_R_DECODE_ERROR);
		goto err;
	}

	if (!(dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL))) {
		DSAerror(DSA_R_BN_DECODE_ERROR);
		goto err;







|











|





|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	DSA *dsa = NULL;

	if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
		return 0;
	X509_ALGOR_get0(NULL, &ptype, &pval, palg);

	if (ptype == V_ASN1_SEQUENCE) {
		pstr = pval;
		pm = pstr->data;
		pmlen = pstr->length;

		if (!(dsa = d2i_DSAparams(NULL, &pm, pmlen))) {
			DSAerror(DSA_R_DECODE_ERROR);
			goto err;
		}
	} else if (ptype == V_ASN1_NULL || ptype == V_ASN1_UNDEF) {
		if (!(dsa = DSA_new())) {
			DSAerror(ERR_R_MALLOC_FAILURE);
			goto err;
		}
	} else {
		DSAerror(DSA_R_PARAMETER_ENCODING_ERROR);
		goto err;
	}

	if (!(public_key = d2i_ASN1_INTEGER(NULL, &p, pklen))) {
		DSAerror(DSA_R_DECODE_ERROR);
		goto err;
	}

	if (!(dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL))) {
		DSAerror(DSA_R_BN_DECODE_ERROR);
		goto err;
300
301
302
303
304
305
306






307
308
309
310
311
312
313
}

static int
dsa_bits(const EVP_PKEY *pkey)
{
	return BN_num_bits(pkey->pkey.dsa->p);
}







static int
dsa_missing_parameters(const EVP_PKEY *pkey)
{
	DSA *dsa;

	dsa = pkey->pkey.dsa;







>
>
>
>
>
>







300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
}

static int
dsa_bits(const EVP_PKEY *pkey)
{
	return BN_num_bits(pkey->pkey.dsa->p);
}

static int
dsa_security_bits(const EVP_PKEY *pkey)
{
	return DSA_security_bits(pkey->pkey.dsa);
}

static int
dsa_missing_parameters(const EVP_PKEY *pkey)
{
	DSA *dsa;

	dsa = pkey->pkey.dsa;
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
	if (!ASN1_bn_print(bp, "Q:   ", x->q, m, off))
		goto err;
	if (!ASN1_bn_print(bp, "G:   ", x->g, m, off))
		goto err;
	ret = 1;
err:
	free(m);
	return(ret);
}

static int
dsa_param_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen)
{
	DSA *dsa;








|







436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
	if (!ASN1_bn_print(bp, "Q:   ", x->q, m, off))
		goto err;
	if (!ASN1_bn_print(bp, "G:   ", x->g, m, off))
		goto err;
	ret = 1;
err:
	free(m);
	return ret;
}

static int
dsa_param_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen)
{
	DSA *dsa;

629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
			if (alg1 == NULL || alg1->algorithm == NULL)
				return -1;
			hnid = OBJ_obj2nid(alg1->algorithm);
			if (hnid == NID_undef)
				return -1;
			if (!OBJ_find_sigid_by_algs(&snid, hnid,
			    EVP_PKEY_id(pkey)))
				return -1; 
			X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF,
			    0);
		}
		return 1;

#ifndef OPENSSL_NO_CMS
	case ASN1_PKEY_CTRL_CMS_SIGN:







|







635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
			if (alg1 == NULL || alg1->algorithm == NULL)
				return -1;
			hnid = OBJ_obj2nid(alg1->algorithm);
			if (hnid == NID_undef)
				return -1;
			if (!OBJ_find_sigid_by_algs(&snid, hnid,
			    EVP_PKEY_id(pkey)))
				return -1;
			X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF,
			    0);
		}
		return 1;

#ifndef OPENSSL_NO_CMS
	case ASN1_PKEY_CTRL_CMS_SIGN:
712
713
714
715
716
717
718

719
720
721
722
723
724
725

		.priv_decode = dsa_priv_decode,
		.priv_encode = dsa_priv_encode,
		.priv_print = dsa_priv_print,

		.pkey_size = int_dsa_size,
		.pkey_bits = dsa_bits,


		.param_decode = dsa_param_decode,
		.param_encode = dsa_param_encode,
		.param_missing = dsa_missing_parameters,
		.param_copy = dsa_copy_parameters,
		.param_cmp = dsa_cmp_parameters,
		.param_print = dsa_param_print,







>







718
719
720
721
722
723
724
725
726
727
728
729
730
731
732

		.priv_decode = dsa_priv_decode,
		.priv_encode = dsa_priv_encode,
		.priv_print = dsa_priv_print,

		.pkey_size = int_dsa_size,
		.pkey_bits = dsa_bits,
		.pkey_security_bits = dsa_security_bits,

		.param_decode = dsa_param_decode,
		.param_encode = dsa_param_encode,
		.param_missing = dsa_missing_parameters,
		.param_copy = dsa_copy_parameters,
		.param_cmp = dsa_cmp_parameters,
		.param_print = dsa_param_print,
Changes to jni/libressl/crypto/dsa/dsa_asn1.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: dsa_asn1.c,v 1.24 2022/01/14 08:29:06 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dsa_asn1.c,v 1.25 2022/09/03 16:01:23 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
};
static const ASN1_TEMPLATE DSA_SIG_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(DSA_SIG, r),
		.field_name = "r",
		.item = &CBIGNUM_it,
	},
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(DSA_SIG, s),
		.field_name = "s",
		.item = &CBIGNUM_it,
	},
};

const ASN1_ITEM DSA_SIG_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = DSA_SIG_seq_tt,







|






|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
};
static const ASN1_TEMPLATE DSA_SIG_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(DSA_SIG, r),
		.field_name = "r",
		.item = &BIGNUM_it,
	},
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(DSA_SIG, s),
		.field_name = "s",
		.item = &BIGNUM_it,
	},
};

const ASN1_ITEM DSA_SIG_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = DSA_SIG_seq_tt,
Changes to jni/libressl/crypto/dsa/dsa_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: dsa_err.c,v 1.15 2017/01/29 17:49:22 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dsa_err.c,v 1.16 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/dsa.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason)

static ERR_STRING_DATA DSA_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/dsa.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason)

static ERR_STRING_DATA DSA_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/dsa/dsa_lib.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* $OpenBSD: dsa_lib.c,v 1.34 2022/01/14 08:29:06 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 * 
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from 
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 * 
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
|






|






|






|














|


|











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* $OpenBSD: dsa_lib.c,v 1.37 2022/08/31 13:28:39 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 *
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 *
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
216
217
218
219
220
221
222

223
224
225
226
227
228
229
230
231
232
233
234

235
236
237
238
239
240
241
242
243
244
245
246
	int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA);
	return i > 1 ? 1 : 0;
}

int
DSA_size(const DSA *r)
{

	int ret, i;
	ASN1_INTEGER bs;
	unsigned char buf[4];	/* 4 bytes looks really small.
				   However, i2d_ASN1_INTEGER() will not look
				   beyond the first byte, as long as the second
				   parameter is NULL. */

	i = BN_num_bits(r->q);
	bs.length = (i + 7) / 8;
	bs.data = buf;
	bs.type = V_ASN1_INTEGER;
	/* If the top bit is set the asn1 encoding is 1 larger. */

	buf[0] = 0xff;

	i = i2d_ASN1_INTEGER(&bs, NULL);
	i += i; /* r and s */
	ret = ASN1_object_size(1, i, V_ASN1_SEQUENCE);
	return ret;
}

int
DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{







>
|
<
<
<
<
<

|
<
|
|
<
>
|

<
<
<







216
217
218
219
220
221
222
223
224





225
226

227
228

229
230
231



232
233
234
235
236
237
238
	int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA);
	return i > 1 ? 1 : 0;
}

int
DSA_size(const DSA *r)
{
	DSA_SIG signature;
	int ret = 0;






	signature.r = r->q;

	signature.s = r->q;


	if ((ret = i2d_DSA_SIG(&signature, NULL)) < 0)
		ret = 0;




	return ret;
}

int
DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
255
256
257
258
259
260
261









262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
}

void *
DSA_get_ex_data(DSA *d, int idx)
{
	return CRYPTO_get_ex_data(&d->ex_data, idx);
}










#ifndef OPENSSL_NO_DH
DH *
DSA_dup_DH(const DSA *r)
{
	/*
	 * DSA has p, q, g, optional pub_key, optional priv_key.
	 * DH has p, optional length, g, optional pub_key, optional priv_key,
	 * optional q.
	 */ 
	DH *ret = NULL;

	if (r == NULL)
		goto err;
	ret = DH_new();
	if (ret == NULL)
		goto err;
	if (r->p != NULL) 
		if ((ret->p = BN_dup(r->p)) == NULL)
			goto err;
	if (r->q != NULL) {
		ret->length = BN_num_bits(r->q);
		if ((ret->q = BN_dup(r->q)) == NULL)
			goto err;
	}







>
>
>
>
>
>
>
>
>









|







|







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
}

void *
DSA_get_ex_data(DSA *d, int idx)
{
	return CRYPTO_get_ex_data(&d->ex_data, idx);
}

int
DSA_security_bits(const DSA *d)
{
	if (d->p == NULL || d->q == NULL)
		return -1;

	return BN_security_bits(BN_num_bits(d->p), BN_num_bits(d->q));
}

#ifndef OPENSSL_NO_DH
DH *
DSA_dup_DH(const DSA *r)
{
	/*
	 * DSA has p, q, g, optional pub_key, optional priv_key.
	 * DH has p, optional length, g, optional pub_key, optional priv_key,
	 * optional q.
	 */
	DH *ret = NULL;

	if (r == NULL)
		goto err;
	ret = DH_new();
	if (ret == NULL)
		goto err;
	if (r->p != NULL)
		if ((ret->p = BN_dup(r->p)) == NULL)
			goto err;
	if (r->q != NULL) {
		ret->length = BN_num_bits(r->q);
		if ((ret->q = BN_dup(r->q)) == NULL)
			goto err;
	}
Changes to jni/libressl/crypto/dsa/dsa_locl.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: dsa_locl.h,v 1.5 2022/01/14 08:29:06 tb Exp $ */
/* ====================================================================
 * Copyright (c) 2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dsa_locl.h,v 1.6 2022/07/04 12:22:32 tb Exp $ */
/* ====================================================================
 * Copyright (c) 2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

struct DSA_SIG_st {
	BIGNUM *r;
	BIGNUM *s;
} /* DSA_SIG */;

struct dsa_method {
	const char *name;
	DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);
	int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
	    BIGNUM **rp);
	int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
	    DSA_SIG *sig, DSA *dsa);
	int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
	    BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,







|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

struct DSA_SIG_st {
	BIGNUM *r;
	BIGNUM *s;
} /* DSA_SIG */;

struct dsa_method {
	char *name;
	DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);
	int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
	    BIGNUM **rp);
	int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
	    DSA_SIG *sig, DSA *dsa);
	int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
	    BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
Changes to jni/libressl/crypto/dsa/dsa_meth.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: dsa_meth.c,v 1.2 2022/01/07 09:35:36 tb Exp $	*/
/*
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: dsa_meth.c,v 1.5 2022/07/11 05:33:14 bcook Exp $	*/
/*
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
38
39
40
41
42
43
44
45


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65






















66
67
68
69
70
71
72

	return meth;
}

void
DSA_meth_free(DSA_METHOD *meth)
{
	if (meth != NULL) {


		free((char *)meth->name);
		free(meth);
	}
}

DSA_METHOD *
DSA_meth_dup(const DSA_METHOD *meth)
{
	DSA_METHOD *copy;

	if ((copy = calloc(1, sizeof(*copy))) == NULL)
		return NULL;
	memcpy(copy, meth, sizeof(*copy));
	if ((copy->name = strdup(meth->name)) == NULL) {
		free(copy);
		return NULL;
	}
	
	return copy;
}























int
DSA_meth_set_sign(DSA_METHOD *meth,
    DSA_SIG *(*sign)(const unsigned char *, int, DSA *))
{
	meth->dsa_do_sign = sign;
	return 1;







|
>
>
|
|
<














|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

	return meth;
}

void
DSA_meth_free(DSA_METHOD *meth)
{
	if (meth == NULL)
		return;

	free(meth->name);
	free(meth);

}

DSA_METHOD *
DSA_meth_dup(const DSA_METHOD *meth)
{
	DSA_METHOD *copy;

	if ((copy = calloc(1, sizeof(*copy))) == NULL)
		return NULL;
	memcpy(copy, meth, sizeof(*copy));
	if ((copy->name = strdup(meth->name)) == NULL) {
		free(copy);
		return NULL;
	}

	return copy;
}

const char *
DSA_meth_get0_name(const DSA_METHOD *meth)
{
	return meth->name;
}

int
DSA_meth_set1_name(DSA_METHOD *meth, const char *name)
{
	char *new_name;

	if ((new_name = strdup(name)) == NULL) {
		DSAerror(ERR_R_MALLOC_FAILURE);
		return 0;
	}

	free(meth->name);
	meth->name = new_name;

	return 1;
}

int
DSA_meth_set_sign(DSA_METHOD *meth,
    DSA_SIG *(*sign)(const unsigned char *, int, DSA *))
{
	meth->dsa_do_sign = sign;
	return 1;
Changes to jni/libressl/crypto/dso/dso_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: dso_err.c,v 1.9 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dso_err.c,v 1.10 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/dso.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSO,0,reason)

static ERR_STRING_DATA DSO_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/dso.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSO,0,reason)

static ERR_STRING_DATA DSO_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/ec/ec_ameth.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ec_ameth.c,v 1.31 2022/01/10 12:10:26 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ec_ameth.c,v 1.33 2022/06/27 12:36:05 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
381
382
383
384
385
386
387



















388
389
390
391
392
393
394
		ERR_clear_error();
		return 0;
	}
	ret = BN_num_bits(order);
	BN_free(order);
	return ret;
}




















static int 
ec_missing_parameters(const EVP_PKEY * pkey)
{
	if (EC_KEY_get0_group(pkey->pkey.ec) == NULL)
		return 1;
	return 0;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
		ERR_clear_error();
		return 0;
	}
	ret = BN_num_bits(order);
	BN_free(order);
	return ret;
}

static int
ec_security_bits(const EVP_PKEY *pkey)
{
	int ecbits = ec_bits(pkey);

	if (ecbits >= 512)
		return 256;
	if (ecbits >= 384)
		return 192;
	if (ecbits >= 256)
		return 128;
	if (ecbits >= 224)
		return 112;
	if (ecbits >= 160)
		return 80;

	return ecbits / 2;
}

static int 
ec_missing_parameters(const EVP_PKEY * pkey)
{
	if (EC_KEY_get0_group(pkey->pkey.ec) == NULL)
		return 1;
	return 0;
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
		if (penc == NULL)
			goto err;
		p = penc;
		penclen = i2o_ECPublicKey(eckey, &p);
		if (penclen <= 0)
			goto err;
		ASN1_STRING_set0(pubkey, penc, penclen);
		pubkey->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
		pubkey->flags |= ASN1_STRING_FLAG_BITS_LEFT;
		penc = NULL;

		X509_ALGOR_set0(talg, OBJ_nid2obj(NID_X9_62_id_ecPublicKey),
		    V_ASN1_UNDEF, NULL);
	}

	/* See if custom parameters set */







|
|







903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
		if (penc == NULL)
			goto err;
		p = penc;
		penclen = i2o_ECPublicKey(eckey, &p);
		if (penclen <= 0)
			goto err;
		ASN1_STRING_set0(pubkey, penc, penclen);
		if (!asn1_abs_set_unused_bits(pubkey, 0))
			goto err;
		penc = NULL;

		X509_ALGOR_set0(talg, OBJ_nid2obj(NID_X9_62_id_ecPublicKey),
		    V_ASN1_UNDEF, NULL);
	}

	/* See if custom parameters set */
1002
1003
1004
1005
1006
1007
1008

1009
1010
1011
1012
1013
1014
1015

	.priv_decode = eckey_priv_decode,
	.priv_encode = eckey_priv_encode,
	.priv_print = eckey_priv_print,

	.pkey_size = int_ec_size,
	.pkey_bits = ec_bits,


	.param_decode = eckey_param_decode,
	.param_encode = eckey_param_encode,
	.param_missing = ec_missing_parameters,
	.param_copy = ec_copy_parameters,
	.param_cmp = ec_cmp_parameters,
	.param_print = eckey_param_print,







>







1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035

	.priv_decode = eckey_priv_decode,
	.priv_encode = eckey_priv_encode,
	.priv_print = eckey_priv_print,

	.pkey_size = int_ec_size,
	.pkey_bits = ec_bits,
	.pkey_security_bits = ec_security_bits,

	.param_decode = eckey_param_decode,
	.param_encode = eckey_param_encode,
	.param_missing = ec_missing_parameters,
	.param_copy = ec_copy_parameters,
	.param_cmp = ec_cmp_parameters,
	.param_print = eckey_param_print,
Changes to jni/libressl/crypto/ec/ec_asn1.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ec_asn1.c,v 1.36 2022/03/31 13:00:58 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 2000-2003 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ec_asn1.c,v 1.37 2022/05/24 20:06:32 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 2000-2003 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62
63
64
65
66



67
68
69
70
71
72
73
 *
 */

#include <string.h>

#include <openssl/opensslconf.h>

#include "ec_lcl.h"
#include <openssl/err.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>




int 
EC_GROUP_get_basis_type(const EC_GROUP * group)
{
	int i = 0;

	if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=







<



>
>
>







56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 */

#include <string.h>

#include <openssl/opensslconf.h>


#include <openssl/err.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>

#include "asn1_locl.h"
#include "ec_lcl.h"

int 
EC_GROUP_get_basis_type(const EC_GROUP * group)
{
	int i = 0;

	if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
856
857
858
859
860
861
862




863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880

881
882
883
884
885
886
887

	/* set a and b */
	if (!ASN1_STRING_set(curve->a, a_buf, len_1) ||
	    !ASN1_STRING_set(curve->b, b_buf, len_2)) {
		ECerror(ERR_R_ASN1_LIB);
		goto err;
	}




	/* set the seed (optional) */
	if (group->seed) {
		if (!curve->seed)
			if ((curve->seed = ASN1_BIT_STRING_new()) == NULL) {
				ECerror(ERR_R_MALLOC_FAILURE);
				goto err;
			}
		curve->seed->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
		curve->seed->flags |= ASN1_STRING_FLAG_BITS_LEFT;
		if (!ASN1_BIT_STRING_set(curve->seed, group->seed,
			(int) group->seed_len)) {
			ECerror(ERR_R_ASN1_LIB);
			goto err;
		}
	} else {
		if (curve->seed) {
			ASN1_BIT_STRING_free(curve->seed);
			curve->seed = NULL;

		}
	}

	ok = 1;

 err:
	free(buffer_1);







>
>
>
>

|
<
|
|
|
|
<
<





<
|
|
<
>







858
859
860
861
862
863
864
865
866
867
868
869
870

871
872
873
874


875
876
877
878
879

880
881

882
883
884
885
886
887
888
889

	/* set a and b */
	if (!ASN1_STRING_set(curve->a, a_buf, len_1) ||
	    !ASN1_STRING_set(curve->b, b_buf, len_2)) {
		ECerror(ERR_R_ASN1_LIB);
		goto err;
	}

	ASN1_BIT_STRING_free(curve->seed);
	curve->seed = NULL;

	/* set the seed (optional) */
	if (group->seed != NULL) {

		if ((curve->seed = ASN1_BIT_STRING_new()) == NULL) {
			ECerror(ERR_R_MALLOC_FAILURE);
			goto err;
		}


		if (!ASN1_BIT_STRING_set(curve->seed, group->seed,
			(int) group->seed_len)) {
			ECerror(ERR_R_ASN1_LIB);
			goto err;
		}

		if (!asn1_abs_set_unused_bits(curve->seed, 0)) {
			ECerror(ERR_R_ASN1_LIB);

			goto err;
		}
	}

	ok = 1;

 err:
	free(buffer_1);
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486



1487
1488
1489
1490
1491
1492
1493
1494
			buf_len = tmp_len;
		}
		if (!EC_POINT_point2oct(a->group, a->pub_key,
			a->conv_form, buffer, buf_len, NULL)) {
			ECerror(ERR_R_EC_LIB);
			goto err;
		}
		priv_key->publicKey->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
		priv_key->publicKey->flags |= ASN1_STRING_FLAG_BITS_LEFT;
		if (!ASN1_STRING_set(priv_key->publicKey, buffer,



			buf_len)) {
			ECerror(ERR_R_ASN1_LIB);
			goto err;
		}
	}
	if ((ret = i2d_EC_PRIVATEKEY(priv_key, out)) == 0) {
		ECerror(ERR_R_EC_LIB);
		goto err;







<
<
|
>
>
>
|







1479
1480
1481
1482
1483
1484
1485


1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
			buf_len = tmp_len;
		}
		if (!EC_POINT_point2oct(a->group, a->pub_key,
			a->conv_form, buffer, buf_len, NULL)) {
			ECerror(ERR_R_EC_LIB);
			goto err;
		}


		if (!ASN1_STRING_set(priv_key->publicKey, buffer, buf_len)) {
			ECerror(ERR_R_ASN1_LIB);
			goto err;
		}
		if (!asn1_abs_set_unused_bits(priv_key->publicKey, 0)) {
			ECerror(ERR_R_ASN1_LIB);
			goto err;
		}
	}
	if ((ret = i2d_EC_PRIVATEKEY(priv_key, out)) == 0) {
		ECerror(ERR_R_EC_LIB);
		goto err;
Changes to jni/libressl/crypto/ec/ec_curve.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ec_curve.c,v 1.21 2021/04/20 17:16:37 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 1998-2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ec_curve.c,v 1.22 2022/06/30 11:14:47 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 1998-2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
69
70
71
72
73
74
75
76
77
78


79
80
81
82
83
84
85
 *
 */

#include <string.h>

#include <openssl/opensslconf.h>

#include "ec_lcl.h"
#include <openssl/err.h>
#include <openssl/obj_mac.h>



typedef struct {
	int field_type,		/* either NID_X9_62_prime_field or
				 * NID_X9_62_characteristic_two_field */
	 seed_len, param_len;
	unsigned int cofactor;	/* promoted to BN_ULONG */
} EC_CURVE_DATA;







<

|
>
>







69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
84
85
86
 *
 */

#include <string.h>

#include <openssl/opensslconf.h>


#include <openssl/err.h>
#include <openssl/objects.h>

#include "ec_lcl.h"

typedef struct {
	int field_type,		/* either NID_X9_62_prime_field or
				 * NID_X9_62_characteristic_two_field */
	 seed_len, param_len;
	unsigned int cofactor;	/* promoted to BN_ULONG */
} EC_CURVE_DATA;
Changes to jni/libressl/crypto/ec/ec_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ec_err.c,v 1.12 2019/09/29 10:09:09 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ec_err.c,v 1.13 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ec.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EC,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EC,0,reason)

static ERR_STRING_DATA EC_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ec.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EC,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EC,0,reason)

static ERR_STRING_DATA EC_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/ec/ec_lcl.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ec_lcl.h,v 1.19 2021/12/04 16:08:32 tb Exp $ */
/*
 * Originally written by Bodo Moeller for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 1998-2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ec_lcl.h,v 1.20 2022/06/30 11:14:47 tb Exp $ */
/*
 * Originally written by Bodo Moeller for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 1998-2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 * The elliptic curve binary polynomial software is originally written by 
 * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
 *
 */

#include <stdlib.h>

#include <openssl/obj_mac.h>
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#include <openssl/bn.h>

#include "bn_lcl.h"

__BEGIN_HIDDEN_DECLS

#if defined(__SUNPRO_C)
# if __SUNPRO_C >= 0x520







|


|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 * The elliptic curve binary polynomial software is originally written by 
 * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
 *
 */

#include <stdlib.h>

#include <openssl/bn.h>
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#include <openssl/objects.h>

#include "bn_lcl.h"

__BEGIN_HIDDEN_DECLS

#if defined(__SUNPRO_C)
# if __SUNPRO_C >= 0x520
Changes to jni/libressl/crypto/ec/ecp_nist.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ecp_nist.c,v 1.18 2021/09/08 17:29:21 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 1998-2003 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ecp_nist.c,v 1.19 2022/06/30 11:14:47 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 1998-2003 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
 * Portions of this software developed by SUN MICROSYSTEMS, INC.,
 * and contributed to the OpenSSL project.
 */

#include <limits.h>

#include <openssl/err.h>
#include <openssl/obj_mac.h>

#include "ec_lcl.h"

const EC_METHOD *
EC_GFp_nist_method(void)
{
	static const EC_METHOD ret = {
		.flags = EC_FLAGS_DEFAULT_OCT,







|
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 * Portions of this software developed by SUN MICROSYSTEMS, INC.,
 * and contributed to the OpenSSL project.
 */

#include <limits.h>

#include <openssl/err.h>
#include <openssl/objects.h>

#include "ec_lcl.h"

const EC_METHOD *
EC_GFp_nist_method(void)
{
	static const EC_METHOD ret = {
		.flags = EC_FLAGS_DEFAULT_OCT,
Changes to jni/libressl/crypto/ecdh/ech_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ech_err.c,v 1.6 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ech_err.c,v 1.7 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ecdh.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ECDH,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ECDH,0,reason)

static ERR_STRING_DATA ECDH_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ecdh.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ECDH,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ECDH,0,reason)

static ERR_STRING_DATA ECDH_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/ecdh/ech_key.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ech_key.c,v 1.12 2021/12/04 16:08:32 tb Exp $ */
/* ====================================================================
 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
 *
 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
 * to the OpenSSL project.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ech_key.c,v 1.13 2022/06/30 11:14:47 tb Exp $ */
/* ====================================================================
 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
 *
 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
 * to the OpenSSL project.
 *
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <limits.h>
#include <string.h>

#include <openssl/opensslconf.h>

#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/obj_mac.h>
#include <openssl/sha.h>

#include "bn_lcl.h"
#include "ech_locl.h"
#include "ec_lcl.h"

static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,







|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <limits.h>
#include <string.h>

#include <openssl/opensslconf.h>

#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/sha.h>

#include "bn_lcl.h"
#include "ech_locl.h"
#include "ec_lcl.h"

static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,
Changes to jni/libressl/crypto/ecdsa/ecs_asn1.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_asn1.c,v 1.10 2022/01/05 20:39:04 tb Exp $ */
/* ====================================================================
 * Copyright (c) 2000-2002 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_asn1.c,v 1.11 2022/09/03 16:01:23 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 2000-2002 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

static const ASN1_TEMPLATE ECDSA_SIG_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(ECDSA_SIG, r),
		.field_name = "r",
		.item = &CBIGNUM_it,
	},
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(ECDSA_SIG, s),
		.field_name = "s",
		.item = &CBIGNUM_it,
	},
};

const ASN1_ITEM ECDSA_SIG_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = ECDSA_SIG_seq_tt,







|






|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

static const ASN1_TEMPLATE ECDSA_SIG_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(ECDSA_SIG, r),
		.field_name = "r",
		.item = &BIGNUM_it,
	},
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(ECDSA_SIG, s),
		.field_name = "s",
		.item = &BIGNUM_it,
	},
};

const ASN1_ITEM ECDSA_SIG_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = ECDSA_SIG_seq_tt,
Changes to jni/libressl/crypto/ecdsa/ecs_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_err.c,v 1.6 2022/01/27 20:31:21 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_err.c,v 1.7 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/ecdsa.h>
#include <openssl/err.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ECDSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ECDSA,0,reason)

static ERR_STRING_DATA ECDSA_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/ecdsa.h>
#include <openssl/err.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ECDSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ECDSA,0,reason)

static ERR_STRING_DATA ECDSA_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/ecdsa/ecs_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_lib.c,v 1.13 2018/04/14 07:09:21 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1998-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_lib.c,v 1.14 2022/08/31 13:01:01 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1998-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
193
194
195
196
197
198
199
200
201
202
203
204


205
206

207
208
209
210
211
212

213
214
215
216
217
218
219
220
221
222

223
224
225
226
227

228

229
230
231
232
233
234
235
236

	return ecdsa_data;
}

int
ECDSA_size(const EC_KEY *r)
{
	int ret, i;
	ASN1_INTEGER bs;
	BIGNUM	*order = NULL;
	unsigned char buf[4];
	const EC_GROUP *group;



	if (r == NULL)

		return 0;
	group = EC_KEY_get0_group(r);
	if (group == NULL)
		return 0;

	if ((order = BN_new()) == NULL)

		return 0;
	if (!EC_GROUP_get_order(group, order, NULL)) {
		BN_clear_free(order);
		return 0;
	}
	i = BN_num_bits(order);
	bs.length = (i + 7) / 8;
	bs.data = buf;
	bs.type = V_ASN1_INTEGER;
	/* If the top bit is set the asn1 encoding is 1 larger. */

	buf[0] = 0xff;

	i = i2d_ASN1_INTEGER(&bs, NULL);
	i += i; /* r and s */
	ret = ASN1_object_size(1, i, V_ASN1_SEQUENCE);

	BN_clear_free(order);

	return (ret);
}

int
ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
	return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ECDSA, argl, argp,







<
<
|
<

>
>


>
|
|
<
|


>
|
|
|
<
|
|
<
|
|
<
>
|

<
<
<
>

>
|







193
194
195
196
197
198
199


200

201
202
203
204
205
206
207
208

209
210
211
212
213
214
215

216
217

218
219

220
221
222



223
224
225
226
227
228
229
230
231
232
233

	return ecdsa_data;
}

int
ECDSA_size(const EC_KEY *r)
{


	BIGNUM *order = NULL;

	const EC_GROUP *group;
	ECDSA_SIG signature;
	int ret = 0;

	if (r == NULL)
		goto err;

	if ((group = EC_KEY_get0_group(r)) == NULL)

		goto err;

	if ((order = BN_new()) == NULL)
		goto err;

	if (!EC_GROUP_get_order(group, order, NULL))
		goto err;


	signature.r = order;

	signature.s = order;


	if ((ret = i2d_ECDSA_SIG(&signature, NULL)) < 0)
		ret = 0;




 err:
	BN_clear_free(order);

	return ret;
}

int
ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
	return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ECDSA, argl, argp,
Changes to jni/libressl/crypto/ecdsa/ecs_ossl.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_ossl.c,v 1.24 2022/04/07 17:37:25 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project
 */
/* ====================================================================
 * Copyright (c) 1998-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ecs_ossl.c,v 1.25 2022/06/30 11:14:47 tb Exp $ */
/*
 * Written by Nils Larsch for the OpenSSL project
 */
/* ====================================================================
 * Copyright (c) 1998-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 *
 */

#include <string.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/obj_mac.h>
#include <openssl/bn.h>

#include "bn_lcl.h"
#include "ecs_locl.h"

static int ecdsa_prepare_digest(const unsigned char *dgst, int dgst_len,
    BIGNUM *order, BIGNUM *ret);
static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len,







|
|
|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 *
 */

#include <string.h>

#include <openssl/opensslconf.h>

#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/objects.h>

#include "bn_lcl.h"
#include "ecs_locl.h"

static int ecdsa_prepare_digest(const unsigned char *dgst, int dgst_len,
    BIGNUM *order, BIGNUM *ret);
static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
Changes to jni/libressl/crypto/engine/eng_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: eng_err.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: eng_err.c,v 1.12 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/engine.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ENGINE,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ENGINE,0,reason)

static ERR_STRING_DATA ENGINE_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/engine.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ENGINE,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ENGINE,0,reason)

static ERR_STRING_DATA ENGINE_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/err/err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: err.c,v 1.48 2019/10/17 14:28:53 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: err.c,v 1.49 2022/08/29 06:49:24 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
211
212
213
214
215
216
217

218
219
220
221
222
223
224

	{ERR_R_FATAL,				"fatal"},
	{ERR_R_MALLOC_FAILURE,			"malloc failure"},
	{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED,	"called a function you should not call"},
	{ERR_R_PASSED_NULL_PARAMETER,		"passed a null parameter"},
	{ERR_R_INTERNAL_ERROR,			"internal error"},
	{ERR_R_DISABLED	,			"called a function that was disabled at compile-time"},


	{0, NULL},
};
#endif


/* Define the predeclared (but externally opaque) "ERR_FNS" type */







>







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

	{ERR_R_FATAL,				"fatal"},
	{ERR_R_MALLOC_FAILURE,			"malloc failure"},
	{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED,	"called a function you should not call"},
	{ERR_R_PASSED_NULL_PARAMETER,		"passed a null parameter"},
	{ERR_R_INTERNAL_ERROR,			"internal error"},
	{ERR_R_DISABLED	,			"called a function that was disabled at compile-time"},
	{ERR_R_INIT_FAIL,			"initialization failure"},

	{0, NULL},
};
#endif


/* Define the predeclared (but externally opaque) "ERR_FNS" type */
Changes to jni/libressl/crypto/err/err_all.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: err_all.c,v 1.25 2019/09/09 17:56:21 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: err_all.c,v 1.27 2022/05/07 17:20:41 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
61
62
63
64
65
66
67


68
69
70
71
72

73
74
75
76
77
78
79

#include <openssl/opensslconf.h>

#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>


#include <openssl/conf.h>
#include <openssl/cms.h>
#include <openssl/dso.h>
#include <openssl/err.h>
#include <openssl/evp.h>

#include <openssl/objects.h>
#include <openssl/ocsp.h>
#include <openssl/pem2.h>
#include <openssl/pkcs12.h>
#include <openssl/rand.h>
#include <openssl/ts.h>
#include <openssl/ui.h>







>
>

|



>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

#include <openssl/opensslconf.h>

#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>
#include <openssl/cms.h>
#include <openssl/comp.h>
#include <openssl/conf.h>
#include <openssl/ct.h>
#include <openssl/dso.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/kdf.h>
#include <openssl/objects.h>
#include <openssl/ocsp.h>
#include <openssl/pem2.h>
#include <openssl/pkcs12.h>
#include <openssl/rand.h>
#include <openssl/ts.h>
#include <openssl/ui.h>
108
109
110
111
112
113
114



115

116








117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157







158
159
160




161
162
163
164
165
166
167
168
169
void ERR_load_ERR_strings_internal(void);

static void
ERR_load_crypto_strings_internal(void)
{
#ifndef OPENSSL_NO_ERR
	ERR_load_ERR_strings_internal(); /* include error strings for SYSerr */



	ERR_load_BN_strings();

#ifndef OPENSSL_NO_RSA








	ERR_load_RSA_strings();
#endif
#ifndef OPENSSL_NO_DH
	ERR_load_DH_strings();
#endif
	ERR_load_EVP_strings();
	ERR_load_BUF_strings();
	ERR_load_OBJ_strings();
	ERR_load_PEM_strings();
#ifndef OPENSSL_NO_DSA
	ERR_load_DSA_strings();
#endif
	ERR_load_X509_strings();
	ERR_load_ASN1_strings();
	ERR_load_CONF_strings();
	ERR_load_CRYPTO_strings();
#ifndef OPENSSL_NO_EC
	ERR_load_EC_strings();
#endif
#ifndef OPENSSL_NO_ECDSA
	ERR_load_ECDSA_strings();
#endif
#ifndef OPENSSL_NO_ECDH
	ERR_load_ECDH_strings();
#endif
	/* skip ERR_load_SSL_strings() because it is not in this library */
	ERR_load_BIO_strings();
	ERR_load_PKCS7_strings();
	ERR_load_X509V3_strings();
	ERR_load_PKCS12_strings();
	ERR_load_RAND_strings();
	ERR_load_DSO_strings();
	ERR_load_TS_strings();
#ifndef OPENSSL_NO_ENGINE
	ERR_load_ENGINE_strings();
#endif
	ERR_load_OCSP_strings();
	ERR_load_UI_strings();
#ifndef OPENSSL_NO_GOST
	ERR_load_GOST_strings();
#endif







#ifndef OPENSSL_NO_CMS
	ERR_load_CMS_strings();
#endif




#endif
}

void
ERR_load_crypto_strings(void)
{
	static pthread_once_t loaded = PTHREAD_ONCE_INIT;
	(void) pthread_once(&loaded, ERR_load_crypto_strings_internal);
}







>
>
>

>
|
>
>
>
>
>
>
>
>
|




<
<
<
<



<
<
<
|
|
|




|
|

<
<
<
<
<
<
<
<



|
<



>
>
>
>
>
>
>
|
|

>
>
>
>









111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136




137
138
139



140
141
142
143
144
145
146
147
148
149








150
151
152
153

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
void ERR_load_ERR_strings_internal(void);

static void
ERR_load_crypto_strings_internal(void)
{
#ifndef OPENSSL_NO_ERR
	ERR_load_ERR_strings_internal(); /* include error strings for SYSerr */

	ERR_load_ASN1_strings();
	ERR_load_BIO_strings();
	ERR_load_BN_strings();
	ERR_load_BUF_strings();
#ifndef OPENSSL_NO_CMS
	ERR_load_CMS_strings();
#endif
#ifdef ZLIB
	ERR_load_COMP_strings();
#endif
	ERR_load_CONF_strings();
	ERR_load_CRYPTO_strings();
#ifndef OPENSSL_NO_CT
	ERR_load_CT_strings();
#endif
#ifndef OPENSSL_NO_DH
	ERR_load_DH_strings();
#endif




#ifndef OPENSSL_NO_DSA
	ERR_load_DSA_strings();
#endif



	ERR_load_DSO_strings();
#ifndef OPENSSL_NO_ECDH
	ERR_load_ECDH_strings();
#endif
#ifndef OPENSSL_NO_ECDSA
	ERR_load_ECDSA_strings();
#endif
#ifndef OPENSSL_NO_EC
	ERR_load_EC_strings();
#endif








#ifndef OPENSSL_NO_ENGINE
	ERR_load_ENGINE_strings();
#endif
	ERR_load_EVP_strings();

#ifndef OPENSSL_NO_GOST
	ERR_load_GOST_strings();
#endif
	ERR_load_KDF_strings();
	ERR_load_OBJ_strings();
	ERR_load_OCSP_strings();
	ERR_load_PEM_strings();
	ERR_load_PKCS12_strings();
	ERR_load_PKCS7_strings();
	ERR_load_RAND_strings();
#ifndef OPENSSL_NO_RSA
	ERR_load_RSA_strings();
#endif
	ERR_load_TS_strings();
	ERR_load_UI_strings();
	ERR_load_X509V3_strings();
	ERR_load_X509_strings();
#endif
}

void
ERR_load_crypto_strings(void)
{
	static pthread_once_t loaded = PTHREAD_ONCE_INIT;
	(void) pthread_once(&loaded, ERR_load_crypto_strings_internal);
}
Changes to jni/libressl/crypto/evp/e_aes.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_aes.c,v 1.42 2020/06/05 18:44:42 tb Exp $ */
/* ====================================================================
 * Copyright (c) 2001-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_aes.c,v 1.49 2022/09/13 04:59:18 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 2001-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
		return 1;

	aesni_ecb_encrypt(in, out, len, ctx->cipher_data, ctx->encrypt);

	return 1;
}

#define aesni_ofb_cipher aes_ofb_cipher
static int aesni_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

#define aesni_cfb_cipher aes_cfb_cipher
static int aesni_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

#define aesni_cfb8_cipher aes_cfb8_cipher
static int aesni_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

#define aesni_cfb1_cipher aes_cfb1_cipher
static int aesni_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

#define aesni_ctr_cipher aes_ctr_cipher
static int aesni_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

static int
aesni_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_AES_GCM_CTX *gctx = ctx->cipher_data;

	if (!iv && !key)







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







253
254
255
256
257
258
259




















260
261
262
263
264
265
266
		return 1;

	aesni_ecb_encrypt(in, out, len, ctx->cipher_data, ctx->encrypt);

	return 1;
}





















static int
aesni_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_AES_GCM_CTX *gctx = ctx->cipher_data;

	if (!iv && !key)
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
			memcpy(gctx->iv, iv, gctx->ivlen);
		gctx->iv_set = 1;
		gctx->iv_gen = 0;
	}
	return 1;
}

#define aesni_gcm_cipher aes_gcm_cipher
static int aesni_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

static int
aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_AES_XTS_CTX *xctx = ctx->cipher_data;

	if (!iv && !key)







<
<
<
<







288
289
290
291
292
293
294




295
296
297
298
299
300
301
			memcpy(gctx->iv, iv, gctx->ivlen);
		gctx->iv_set = 1;
		gctx->iv_gen = 0;
	}
	return 1;
}





static int
aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_AES_XTS_CTX *xctx = ctx->cipher_data;

	if (!iv && !key)
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
		xctx->xts.key2 = &xctx->ks2;
		memcpy(ctx->iv, iv, 16);
	}

	return 1;
}

#define aesni_xts_cipher aes_xts_cipher
static int aesni_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

static int
aesni_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_AES_CCM_CTX *cctx = ctx->cipher_data;

	if (!iv && !key)







<
<
<
<







326
327
328
329
330
331
332




333
334
335
336
337
338
339
		xctx->xts.key2 = &xctx->ks2;
		memcpy(ctx->iv, iv, 16);
	}

	return 1;
}





static int
aesni_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_AES_CCM_CTX *cctx = ctx->cipher_data;

	if (!iv && !key)
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
	if (iv) {
		memcpy(ctx->iv, iv, 15 - cctx->L);
		cctx->iv_set = 1;
	}
	return 1;
}

#define aesni_ccm_cipher aes_ccm_cipher
static int aesni_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len);

#define BLOCK_CIPHER_generic(n,keylen,blocksize,ivlen,nmode,mode,MODE,fl) \
static const EVP_CIPHER aesni_##keylen##_##mode = {			\
	.nid = n##_##keylen##_##nmode,					\
	.block_size = blocksize,					\
	.key_len = keylen / 8,						\
	.iv_len = ivlen, 						\
	.flags = fl | EVP_CIPH_##MODE##_MODE,				\
	.init = aesni_init_key,						\
	.do_cipher = aesni_##mode##_cipher,				\
	.ctx_size = sizeof(EVP_AES_KEY)					\
};									\
static const EVP_CIPHER aes_##keylen##_##mode = {			\
	.nid = n##_##keylen##_##nmode,					\
	.block_size = blocksize,					\
	.key_len = keylen / 8,						\
	.iv_len = ivlen, 						\
	.flags = fl | EVP_CIPH_##MODE##_MODE,				\
	.init = aes_init_key,						\
	.do_cipher = aes_##mode##_cipher,				\
	.ctx_size = sizeof(EVP_AES_KEY)					\
};									\
const EVP_CIPHER *							\
EVP_aes_##keylen##_##mode(void)						\
{									\
	return AESNI_CAPABLE ?						\
	    &aesni_##keylen##_##mode : &aes_##keylen##_##mode;		\
}

#define BLOCK_CIPHER_custom(n,keylen,blocksize,ivlen,mode,MODE,fl)	\
static const EVP_CIPHER aesni_##keylen##_##mode = {			\
	.nid = n##_##keylen##_##mode,					\
	.block_size = blocksize,					\
	.key_len =							\
	    (EVP_CIPH_##MODE##_MODE == EVP_CIPH_XTS_MODE ? 2 : 1) *	\
	    keylen / 8,							\
	.iv_len = ivlen,						\
	.flags = fl | EVP_CIPH_##MODE##_MODE,				\
	.init = aesni_##mode##_init_key,				\
	.do_cipher = aesni_##mode##_cipher,				\
	.cleanup = aes_##mode##_cleanup,				\
	.ctx_size = sizeof(EVP_AES_##MODE##_CTX),			\
	.ctrl = aes_##mode##_ctrl					\
};									\
static const EVP_CIPHER aes_##keylen##_##mode = {			\
	.nid = n##_##keylen##_##mode,					\
	.block_size = blocksize,					\
	.key_len =							\
	    (EVP_CIPH_##MODE##_MODE == EVP_CIPH_XTS_MODE ? 2 : 1) *	\
	    keylen / 8,							\
	.iv_len = ivlen,						\
	.flags = fl | EVP_CIPH_##MODE##_MODE,				\
	.init = aes_##mode##_init_key,					\
	.do_cipher = aes_##mode##_cipher,				\
	.cleanup = aes_##mode##_cleanup,				\
	.ctx_size = sizeof(EVP_AES_##MODE##_CTX),			\
	.ctrl = aes_##mode##_ctrl					\
};									\
const EVP_CIPHER *							\
EVP_aes_##keylen##_##mode(void)						\
{									\
	return AESNI_CAPABLE ?						\
	    &aesni_##keylen##_##mode : &aes_##keylen##_##mode;		\
}

#else

#define BLOCK_CIPHER_generic(n,keylen,blocksize,ivlen,nmode,mode,MODE,fl) \
static const EVP_CIPHER aes_##keylen##_##mode = {			\
	.nid = n##_##keylen##_##nmode,					\
	.block_size = blocksize,					\
	.key_len = keylen / 8,						\
	.iv_len = ivlen,						\
	.flags = fl | EVP_CIPH_##MODE##_MODE,				\
	.init = aes_init_key,						\
	.do_cipher = aes_##mode##_cipher,				\
	.ctx_size = sizeof(EVP_AES_KEY)					\
};									\
const EVP_CIPHER *							\
EVP_aes_##keylen##_##mode(void)						\
{									\
	return &aes_##keylen##_##mode;					\
}

#define BLOCK_CIPHER_custom(n,keylen,blocksize,ivlen,mode,MODE,fl)	\
static const EVP_CIPHER aes_##keylen##_##mode = {			\
	.nid = n##_##keylen##_##mode,					\
	.block_size = blocksize,					\
	.key_len =							\
	    (EVP_CIPH_##MODE##_MODE == EVP_CIPH_XTS_MODE ? 2 : 1) *	\
	    keylen / 8,							\
	.iv_len = ivlen,						\
	.flags = fl | EVP_CIPH_##MODE##_MODE,				\
	.init = aes_##mode##_init_key,					\
	.do_cipher = aes_##mode##_cipher,				\
	.cleanup = aes_##mode##_cleanup,				\
	.ctx_size = sizeof(EVP_AES_##MODE##_CTX),			\
	.ctrl = aes_##mode##_ctrl					\
};									\
const EVP_CIPHER *							\
EVP_aes_##keylen##_##mode(void)						\
{									\
	return &aes_##keylen##_##mode;					\
}

#endif

#define BLOCK_CIPHER_generic_pack(nid,keylen,flags)		\
	BLOCK_CIPHER_generic(nid,keylen,16,16,cbc,cbc,CBC,flags|EVP_CIPH_FLAG_DEFAULT_ASN1)	\
	BLOCK_CIPHER_generic(nid,keylen,16,0,ecb,ecb,ECB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1)	\
	BLOCK_CIPHER_generic(nid,keylen,1,16,ofb128,ofb,OFB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1)	\
	BLOCK_CIPHER_generic(nid,keylen,1,16,cfb128,cfb,CFB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1)	\
	BLOCK_CIPHER_generic(nid,keylen,1,16,cfb1,cfb1,CFB,flags)	\
	BLOCK_CIPHER_generic(nid,keylen,1,16,cfb8,cfb8,CFB,flags)	\
	BLOCK_CIPHER_generic(nid,keylen,1,16,ctr,ctr,CTR,flags)

static int
aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	int ret, mode;
	EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


<
<
<
<
<
<
<
<
<







349
350
351
352
353
354
355












































































































356
357









358
359
360
361
362
363
364
	if (iv) {
		memcpy(ctx->iv, iv, 15 - cctx->L);
		cctx->iv_set = 1;
	}
	return 1;
}













































































































#endif










static int
aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	int ret, mode;
	EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;

652
653
654
655
656
657
658


659
660
661
662
663
664
665
666

667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683












684










685




















































































































































































































































































































































686































































































































































































































































































































































687
688
689
690
691
692
693

694
695
696
697
698
699
700
701
702
		return 1;
	}

	while (len >= MAXBITCHUNK) {
		CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK*8, &dat->ks,
		    ctx->iv, &ctx->num, ctx->encrypt, dat->block);
		len -= MAXBITCHUNK;


	}
	if (len)
		CRYPTO_cfb128_1_encrypt(in, out, len*8, &dat->ks,
		    ctx->iv, &ctx->num, ctx->encrypt, dat->block);

	return 1;
}


static int aes_ctr_cipher (EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len)
{
	unsigned int num = ctx->num;
	EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;

	if (dat->stream.ctr)
		CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks,
		    ctx->iv, ctx->buf, &num, dat->stream.ctr);
	else
		CRYPTO_ctr128_encrypt(in, out, len, &dat->ks,
		    ctx->iv, ctx->buf, &num, dat->block);
	ctx->num = (size_t)num;
	return 1;
}

BLOCK_CIPHER_generic_pack(NID_aes, 128, EVP_CIPH_FLAG_FIPS)












BLOCK_CIPHER_generic_pack(NID_aes, 192, EVP_CIPH_FLAG_FIPS)










BLOCK_CIPHER_generic_pack(NID_aes, 256, EVP_CIPH_FLAG_FIPS)




















































































































































































































































































































































































































































































































































































































































































































static int
aes_gcm_cleanup(EVP_CIPHER_CTX *c)
{
	EVP_AES_GCM_CTX *gctx = c->cipher_data;

	if (gctx->iv != c->iv)
		free(gctx->iv);

	explicit_bzero(gctx, sizeof(*gctx));
	return 1;
}

/* increment counter (64-bit int) by 1 */
static void
ctr64_inc(unsigned char *counter)
{
	int n = 8;







>
>








>
|















|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|






>

<







507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266

1267
1268
1269
1270
1271
1272
1273
		return 1;
	}

	while (len >= MAXBITCHUNK) {
		CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK*8, &dat->ks,
		    ctx->iv, &ctx->num, ctx->encrypt, dat->block);
		len -= MAXBITCHUNK;
		in += MAXBITCHUNK;
		out += MAXBITCHUNK;
	}
	if (len)
		CRYPTO_cfb128_1_encrypt(in, out, len*8, &dat->ks,
		    ctx->iv, &ctx->num, ctx->encrypt, dat->block);

	return 1;
}

static int
aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len)
{
	unsigned int num = ctx->num;
	EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;

	if (dat->stream.ctr)
		CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks,
		    ctx->iv, ctx->buf, &num, dat->stream.ctr);
	else
		CRYPTO_ctr128_encrypt(in, out, len, &dat->ks,
		    ctx->iv, ctx->buf, &num, dat->block);
	ctx->num = (size_t)num;
	return 1;
}


#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_cbc = {
	.nid = NID_aes_128_cbc,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
	.init = aesni_init_key,
	.do_cipher = aesni_cbc_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_128_cbc = {
	.nid = NID_aes_128_cbc,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cbc_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_128_cbc(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_cbc : &aes_128_cbc;
#else
	return &aes_128_cbc;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_ecb = {
	.nid = NID_aes_128_ecb,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 0,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
	.init = aesni_init_key,
	.do_cipher = aesni_ecb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_128_ecb = {
	.nid = NID_aes_128_ecb,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 0,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ecb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_128_ecb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_ecb : &aes_128_ecb;
#else
	return &aes_128_ecb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_ofb = {
	.nid = NID_aes_128_ofb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_ofb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_128_ofb = {
	.nid = NID_aes_128_ofb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ofb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_128_ofb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_ofb : &aes_128_ofb;
#else
	return &aes_128_ofb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_cfb = {
	.nid = NID_aes_128_cfb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_128_cfb = {
	.nid = NID_aes_128_cfb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_128_cfb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_cfb : &aes_128_cfb;
#else
	return &aes_128_cfb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_cfb1 = {
	.nid = NID_aes_128_cfb1,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb1_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_128_cfb1 = {
	.nid = NID_aes_128_cfb1,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb1_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_128_cfb1(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_cfb1 : &aes_128_cfb1;
#else
	return &aes_128_cfb1;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_cfb8 = {
	.nid = NID_aes_128_cfb8,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb8_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_128_cfb8 = {
	.nid = NID_aes_128_cfb8,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb8_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_128_cfb8(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_cfb8 : &aes_128_cfb8;
#else
	return &aes_128_cfb8;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_ctr = {
	.nid = NID_aes_128_ctr,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_CTR_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_ctr_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_128_ctr = {
	.nid = NID_aes_128_ctr,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_CTR_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ctr_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_128_ctr(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_ctr : &aes_128_ctr;
#else
	return &aes_128_ctr;
#endif
}


#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_cbc = {
	.nid = NID_aes_192_cbc,
	.block_size = 16,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
	.init = aesni_init_key,
	.do_cipher = aesni_cbc_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_192_cbc = {
	.nid = NID_aes_192_cbc,
	.block_size = 16,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cbc_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_192_cbc(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_cbc : &aes_192_cbc;
#else
	return &aes_192_cbc;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_ecb = {
	.nid = NID_aes_192_ecb,
	.block_size = 16,
	.key_len = 24,
	.iv_len = 0,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
	.init = aesni_init_key,
	.do_cipher = aesni_ecb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_192_ecb = {
	.nid = NID_aes_192_ecb,
	.block_size = 16,
	.key_len = 24,
	.iv_len = 0,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ecb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_192_ecb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_ecb : &aes_192_ecb;
#else
	return &aes_192_ecb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_ofb = {
	.nid = NID_aes_192_ofb128,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_ofb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_192_ofb = {
	.nid = NID_aes_192_ofb128,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ofb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_192_ofb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_ofb : &aes_192_ofb;
#else
	return &aes_192_ofb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_cfb = {
	.nid = NID_aes_192_cfb128,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_192_cfb = {
	.nid = NID_aes_192_cfb128,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_192_cfb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_cfb : &aes_192_cfb;
#else
	return &aes_192_cfb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_cfb1 = {
	.nid = NID_aes_192_cfb1,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb1_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_192_cfb1 = {
	.nid = NID_aes_192_cfb1,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb1_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_192_cfb1(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_cfb1 : &aes_192_cfb1;
#else
	return &aes_192_cfb1;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_cfb8 = {
	.nid = NID_aes_192_cfb8,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb8_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_192_cfb8 = {
	.nid = NID_aes_192_cfb8,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb8_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_192_cfb8(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_cfb8 : &aes_192_cfb8;
#else
	return &aes_192_cfb8;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_ctr = {
	.nid = NID_aes_192_ctr,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_CTR_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_ctr_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_192_ctr = {
	.nid = NID_aes_192_ctr,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = EVP_CIPH_CTR_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ctr_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_192_ctr(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_ctr : &aes_192_ctr;
#else
	return &aes_192_ctr;
#endif
}


#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_cbc = {
	.nid = NID_aes_256_cbc,
	.block_size = 16,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
	.init = aesni_init_key,
	.do_cipher = aesni_cbc_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_256_cbc = {
	.nid = NID_aes_256_cbc,
	.block_size = 16,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cbc_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_256_cbc(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_cbc : &aes_256_cbc;
#else
	return &aes_256_cbc;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_ecb = {
	.nid = NID_aes_256_ecb,
	.block_size = 16,
	.key_len = 32,
	.iv_len = 0,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
	.init = aesni_init_key,
	.do_cipher = aesni_ecb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_256_ecb = {
	.nid = NID_aes_256_ecb,
	.block_size = 16,
	.key_len = 32,
	.iv_len = 0,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ecb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_256_ecb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_ecb : &aes_256_ecb;
#else
	return &aes_256_ecb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_ofb = {
	.nid = NID_aes_256_ofb128,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_ofb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_256_ofb = {
	.nid = NID_aes_256_ofb128,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ofb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_256_ofb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_ofb : &aes_256_ofb;
#else
	return &aes_256_ofb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_cfb = {
	.nid = NID_aes_256_cfb128,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_256_cfb = {
	.nid = NID_aes_256_cfb128,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_256_cfb(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_cfb : &aes_256_cfb;
#else
	return &aes_256_cfb;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_cfb1 = {
	.nid = NID_aes_256_cfb1,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb1_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_256_cfb1 = {
	.nid = NID_aes_256_cfb1,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb1_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_256_cfb1(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_cfb1 : &aes_256_cfb1;
#else
	return &aes_256_cfb1;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_cfb8 = {
	.nid = NID_aes_256_cfb8,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_cfb8_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_256_cfb8 = {
	.nid = NID_aes_256_cfb8,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_CFB_MODE,
	.init = aes_init_key,
	.do_cipher = aes_cfb8_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_256_cfb8(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_cfb8 : &aes_256_cfb8;
#else
	return &aes_256_cfb8;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_ctr = {
	.nid = NID_aes_256_ctr,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_CTR_MODE,
	.init = aesni_init_key,
	.do_cipher = aes_ctr_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};
#endif

static const EVP_CIPHER aes_256_ctr = {
	.nid = NID_aes_256_ctr,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = EVP_CIPH_CTR_MODE,
	.init = aes_init_key,
	.do_cipher = aes_ctr_cipher,
	.ctx_size = sizeof(EVP_AES_KEY),
};

const EVP_CIPHER *
EVP_aes_256_ctr(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_ctr : &aes_256_ctr;
#else
	return &aes_256_ctr;
#endif
}

static void
aes_gcm_cleanup(EVP_CIPHER_CTX *c)
{
	EVP_AES_GCM_CTX *gctx = c->cipher_data;

	if (gctx->iv != c->iv)
		free(gctx->iv);

	explicit_bzero(gctx, sizeof(*gctx));

}

/* increment counter (64-bit int) by 1 */
static void
ctr64_inc(unsigned char *counter)
{
	int n = 8;
1057
1058
1059
1060
1061
1062
1063
1064






1065







1066





1067






1068
















1069




































































1070
1071
1072
1073
1074
1075
1076
}

#define CUSTOM_FLAGS \
    ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \
      EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \
      EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY )

BLOCK_CIPHER_custom(NID_aes, 128, 1, 12, gcm, GCM,






    EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS)







BLOCK_CIPHER_custom(NID_aes, 192, 1, 12, gcm, GCM,





    EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS)






BLOCK_CIPHER_custom(NID_aes, 256, 1, 12, gcm, GCM,
















    EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS)





































































static int
aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
	EVP_AES_XTS_CTX *xctx = c->cipher_data;

	switch (type) {







|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
}

#define CUSTOM_FLAGS \
    ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \
      EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \
      EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY )


#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_gcm = {
	.nid = NID_aes_128_gcm,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 12,
	.flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
	.init = aesni_gcm_init_key,
	.do_cipher = aes_gcm_cipher,
	.cleanup = aes_gcm_cleanup,
	.ctx_size = sizeof(EVP_AES_GCM_CTX),
	.ctrl = aes_gcm_ctrl,
};
#endif

static const EVP_CIPHER aes_128_gcm = {
	.nid = NID_aes_128_gcm,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 12,
	.flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
	.init = aes_gcm_init_key,
	.do_cipher = aes_gcm_cipher,
	.cleanup = aes_gcm_cleanup,
	.ctx_size = sizeof(EVP_AES_GCM_CTX),
	.ctrl = aes_gcm_ctrl,
};

const EVP_CIPHER *
EVP_aes_128_gcm(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_gcm : &aes_128_gcm;
#else
	return &aes_128_gcm;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_gcm = {
	.nid = NID_aes_192_gcm,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 12,
	.flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
	.init = aesni_gcm_init_key,
	.do_cipher = aes_gcm_cipher,
	.cleanup = aes_gcm_cleanup,
	.ctx_size = sizeof(EVP_AES_GCM_CTX),
	.ctrl = aes_gcm_ctrl,
};
#endif

static const EVP_CIPHER aes_192_gcm = {
	.nid = NID_aes_192_gcm,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 12,
	.flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
	.init = aes_gcm_init_key,
	.do_cipher = aes_gcm_cipher,
	.cleanup = aes_gcm_cleanup,
	.ctx_size = sizeof(EVP_AES_GCM_CTX),
	.ctrl = aes_gcm_ctrl,
};

const EVP_CIPHER *
EVP_aes_192_gcm(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_gcm : &aes_192_gcm;
#else
	return &aes_192_gcm;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_gcm = {
	.nid = NID_aes_256_gcm,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 12,
	.flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
	.init = aesni_gcm_init_key,
	.do_cipher = aes_gcm_cipher,
	.cleanup = aes_gcm_cleanup,
	.ctx_size = sizeof(EVP_AES_GCM_CTX),
	.ctrl = aes_gcm_ctrl,
};
#endif

static const EVP_CIPHER aes_256_gcm = {
	.nid = NID_aes_256_gcm,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 12,
	.flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
	.init = aes_gcm_init_key,
	.do_cipher = aes_gcm_cipher,
	.cleanup = aes_gcm_cleanup,
	.ctx_size = sizeof(EVP_AES_GCM_CTX),
	.ctrl = aes_gcm_ctrl,
};

const EVP_CIPHER *
EVP_aes_256_gcm(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_gcm : &aes_256_gcm;
#else
	return &aes_256_gcm;
#endif
}

static int
aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
	EVP_AES_XTS_CTX *xctx = c->cipher_data;

	switch (type) {
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200














1201




























































1202
1203
1204
1205
1206
1207
1208
		    ctx->iv);
	else if (CRYPTO_xts128_encrypt(&xctx->xts, ctx->iv, in, out, len,
	    ctx->encrypt))
		return 0;
	return 1;
}

#define aes_xts_cleanup NULL

#define XTS_FLAGS \
    ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \
      EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY )

BLOCK_CIPHER_custom(NID_aes, 128, 1, 16, xts, XTS, EVP_CIPH_FLAG_FIPS|XTS_FLAGS)














BLOCK_CIPHER_custom(NID_aes, 256, 1, 16, xts, XTS, EVP_CIPH_FLAG_FIPS|XTS_FLAGS)





























































static int
aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
	EVP_AES_CCM_CTX *cctx = c->cipher_data;

	switch (type) {







<
<




|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1866
1867
1868
1869
1870
1871
1872


1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
		    ctx->iv);
	else if (CRYPTO_xts128_encrypt(&xctx->xts, ctx->iv, in, out, len,
	    ctx->encrypt))
		return 0;
	return 1;
}



#define XTS_FLAGS \
    ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \
      EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY )


#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_xts = {
	.nid = NID_aes_128_xts,
	.block_size = 1,
	.key_len = 2 * 16,
	.iv_len = 16,
	.flags = XTS_FLAGS | EVP_CIPH_XTS_MODE,
	.init = aesni_xts_init_key,
	.do_cipher = aes_xts_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_XTS_CTX),
	.ctrl = aes_xts_ctrl,
};
#endif

static const EVP_CIPHER aes_128_xts = {
	.nid = NID_aes_128_xts,
	.block_size = 1,
	.key_len = 2 * 16,
	.iv_len = 16,
	.flags = XTS_FLAGS | EVP_CIPH_XTS_MODE,
	.init = aes_xts_init_key,
	.do_cipher = aes_xts_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_XTS_CTX),
	.ctrl = aes_xts_ctrl,
};

const EVP_CIPHER *
EVP_aes_128_xts(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_xts : &aes_128_xts;
#else
	return &aes_128_xts;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_xts = {
	.nid = NID_aes_256_xts,
	.block_size = 1,
	.key_len = 2 * 32,
	.iv_len = 16,
	.flags = XTS_FLAGS | EVP_CIPH_XTS_MODE,
	.init = aesni_xts_init_key,
	.do_cipher = aes_xts_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_XTS_CTX),
	.ctrl = aes_xts_ctrl,
};
#endif

static const EVP_CIPHER aes_256_xts = {
	.nid = NID_aes_256_xts,
	.block_size = 1,
	.key_len = 2 * 32,
	.iv_len = 16,
	.flags = XTS_FLAGS | EVP_CIPH_XTS_MODE,
	.init = aes_xts_init_key,
	.do_cipher = aes_xts_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_XTS_CTX),
	.ctrl = aes_xts_ctrl,
};

const EVP_CIPHER *
EVP_aes_256_xts(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_xts : &aes_256_xts;
#else
	return &aes_256_xts;
#endif
}

static int
aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
	EVP_AES_CCM_CTX *cctx = c->cipher_data;

	switch (type) {
1354
1355
1356
1357
1358
1359
1360











1361


1362












1363









1364














1365












1366









1367














1368






















1369
1370
1371
1372
1373
1374
1375
		cctx->tag_set = 0;
		cctx->len_set = 0;
		return rv;
	}

}












#define aes_ccm_cleanup NULL















BLOCK_CIPHER_custom(NID_aes, 128, 1, 12, ccm, CCM,









    EVP_CIPH_FLAG_FIPS|CUSTOM_FLAGS)














BLOCK_CIPHER_custom(NID_aes, 192, 1, 12, ccm, CCM,












    EVP_CIPH_FLAG_FIPS|CUSTOM_FLAGS)









BLOCK_CIPHER_custom(NID_aes, 256, 1, 12, ccm, CCM,














    EVP_CIPH_FLAG_FIPS|CUSTOM_FLAGS)























#define EVP_AEAD_AES_GCM_TAG_LEN 16

struct aead_aes_gcm_ctx {
	union {
		double align;
		AES_KEY ks;







>
>
>
>
>
>
>
>
>
>
>
|
>
>

>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
		cctx->tag_set = 0;
		cctx->len_set = 0;
		return rv;
	}

}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_128_ccm = {
	.nid = NID_aes_128_ccm,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 12,
	.flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
	.init = aesni_ccm_init_key,
	.do_cipher = aes_ccm_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_CCM_CTX),
	.ctrl = aes_ccm_ctrl,
};
#endif

static const EVP_CIPHER aes_128_ccm = {
	.nid = NID_aes_128_ccm,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 12,
	.flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
	.init = aes_ccm_init_key,
	.do_cipher = aes_ccm_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_CCM_CTX),
	.ctrl = aes_ccm_ctrl,
};

const EVP_CIPHER *
EVP_aes_128_ccm(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_128_ccm : &aes_128_ccm;
#else
	return &aes_128_ccm;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_192_ccm = {
	.nid = NID_aes_192_ccm,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 12,
	.flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
	.init = aesni_ccm_init_key,
	.do_cipher = aes_ccm_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_CCM_CTX),
	.ctrl = aes_ccm_ctrl,
};
#endif

static const EVP_CIPHER aes_192_ccm = {
	.nid = NID_aes_192_ccm,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 12,
	.flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
	.init = aes_ccm_init_key,
	.do_cipher = aes_ccm_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_CCM_CTX),
	.ctrl = aes_ccm_ctrl,
};

const EVP_CIPHER *
EVP_aes_192_ccm(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_192_ccm : &aes_192_ccm;
#else
	return &aes_192_ccm;
#endif
}

#ifdef AESNI_CAPABLE
static const EVP_CIPHER aesni_256_ccm = {
	.nid = NID_aes_256_ccm,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 12,
	.flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
	.init = aesni_ccm_init_key,
	.do_cipher = aes_ccm_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_CCM_CTX),
	.ctrl = aes_ccm_ctrl,
};
#endif

static const EVP_CIPHER aes_256_ccm = {
	.nid = NID_aes_256_ccm,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 12,
	.flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
	.init = aes_ccm_init_key,
	.do_cipher = aes_ccm_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_AES_CCM_CTX),
	.ctrl = aes_ccm_ctrl,
};

const EVP_CIPHER *
EVP_aes_256_ccm(void)
{
#ifdef AESNI_CAPABLE
	return AESNI_CAPABLE ? &aesni_256_ccm : &aes_256_ccm;
#else
	return &aes_256_ccm;
#endif
}

#define EVP_AEAD_AES_GCM_TAG_LEN 16

struct aead_aes_gcm_ctx {
	union {
		double align;
		AES_KEY ks;
Changes to jni/libressl/crypto/evp/e_bf.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_bf.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_bf.c,v 1.14 2022/09/15 07:04:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90


































































































































































91
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */


#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_BF

#include <openssl/blowfish.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"

static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);

typedef struct {
	BF_KEY ks;
} EVP_BF_KEY;

#define data(ctx)	EVP_C_DATA(EVP_BF_KEY,ctx)

IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64,
    EVP_CIPH_VARIABLE_LENGTH, bf_init_key, NULL,
    EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)

static int
bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	BF_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key);
	return 1;
}


































































































































































#endif







>












<
<
<




|
<
<
<
<








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71



72
73
74
75
76




77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_BF

#include <openssl/blowfish.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"




typedef struct {
	BF_KEY ks;
} EVP_BF_KEY;

#define data(ctx)	((EVP_BF_KEY *)(ctx)->cipher_data)





static int
bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	BF_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key);
	return 1;
}

static int
bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		BF_cbc_encrypt(in, out, (long)chunk, &((EVP_BF_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		BF_cbc_encrypt(in, out, (long)inl, &((EVP_BF_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
bf_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		BF_cfb64_encrypt(in, out, (long)chunk, &((EVP_BF_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		BF_ecb_encrypt(in + i, out + i, &((EVP_BF_KEY *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		BF_ofb64_encrypt(in, out, (long)chunk, &((EVP_BF_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		BF_ofb64_encrypt(in, out, (long)inl, &((EVP_BF_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static const EVP_CIPHER bf_cbc = {
	.nid = NID_bf_cbc,
	.block_size = 8,
	.key_len = 16,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE,
	.init = bf_init_key,
	.do_cipher = bf_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_BF_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_bf_cbc(void)
{
	return &bf_cbc;
}

static const EVP_CIPHER bf_cfb64 = {
	.nid = NID_bf_cfb64,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE,
	.init = bf_init_key,
	.do_cipher = bf_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_BF_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_bf_cfb64(void)
{
	return &bf_cfb64;
}

static const EVP_CIPHER bf_ofb = {
	.nid = NID_bf_ofb64,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE,
	.init = bf_init_key,
	.do_cipher = bf_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_BF_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_bf_ofb(void)
{
	return &bf_ofb;
}

static const EVP_CIPHER bf_ecb = {
	.nid = NID_bf_ecb,
	.block_size = 8,
	.key_len = 16,
	.iv_len = 0,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE,
	.init = bf_init_key,
	.do_cipher = bf_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_BF_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_bf_ecb(void)
{
	return &bf_ecb;
}
#endif
Changes to jni/libressl/crypto/evp/e_camellia.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_camellia.c,v 1.9 2021/12/12 21:30:13 tb Exp $ */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_camellia.c,v 1.15 2022/09/10 17:39:47 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123





























































































































































































































































































































































































































































































































































































































































































































































124
#ifndef OPENSSL_NO_CAMELLIA
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/camellia.h>

#include "evp_locl.h"

static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);

/* Camellia subkey Structure */
typedef struct {
	CAMELLIA_KEY ks;
} EVP_CAMELLIA_KEY;

/* Attribute operation for Camellia */
#define data(ctx)	EVP_C_DATA(EVP_CAMELLIA_KEY,ctx)

IMPLEMENT_BLOCK_CIPHER(camellia_128, ks, Camellia, EVP_CAMELLIA_KEY,
    NID_camellia_128, 16, 16, 16, 128,
    0, camellia_init_key, NULL,
    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    NULL)
IMPLEMENT_BLOCK_CIPHER(camellia_192, ks, Camellia, EVP_CAMELLIA_KEY,
    NID_camellia_192, 16, 24, 16, 128,
    0, camellia_init_key, NULL,
    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    NULL)
IMPLEMENT_BLOCK_CIPHER(camellia_256, ks, Camellia, EVP_CAMELLIA_KEY,
    NID_camellia_256, 16, 32, 16, 128,
    0, camellia_init_key, NULL,
    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    NULL)

#define IMPLEMENT_CAMELLIA_CFBR(ksize,cbits)	IMPLEMENT_CFBR(camellia,Camellia,EVP_CAMELLIA_KEY,ks,ksize,cbits,16)

IMPLEMENT_CAMELLIA_CFBR(128, 1)
IMPLEMENT_CAMELLIA_CFBR(192, 1)
IMPLEMENT_CAMELLIA_CFBR(256, 1)

IMPLEMENT_CAMELLIA_CFBR(128, 8)
IMPLEMENT_CAMELLIA_CFBR(192, 8)
IMPLEMENT_CAMELLIA_CFBR(256, 8)


/* The subkey for Camellia is generated. */
static int
camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	int ret;

	ret = Camellia_set_key(key, ctx->key_len * 8, ctx->cipher_data);

	if (ret < 0) {
		EVPerror(EVP_R_CAMELLIA_KEY_SETUP_FAILED);
		return 0;
	}

	return 1;
}





























































































































































































































































































































































































































































































































































































































































































































































#endif







<
<
<






|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

60
61
62
63
64
65
66



67
68
69
70
71
72
73
74































75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
#ifndef OPENSSL_NO_CAMELLIA
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/camellia.h>

#include "evp_locl.h"




/* Camellia subkey Structure */
typedef struct {
	CAMELLIA_KEY ks;
} EVP_CAMELLIA_KEY;

/* Attribute operation for Camellia */
#define data(ctx)	((EVP_CAMELLIA_KEY *)(ctx)->cipher_data)
































static int
camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	int ret;

	ret = Camellia_set_key(key, ctx->key_len * 8, ctx->cipher_data);

	if (ret < 0) {
		EVPerror(EVP_R_CAMELLIA_KEY_SETUP_FAILED);
		return 0;
	}

	return 1;
}

static int
camellia_128_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		Camellia_cbc_encrypt(in, out, EVP_MAXCHUNK, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Camellia_cbc_encrypt(in, out, inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
camellia_128_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb128_encrypt(in, out, chunk, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
camellia_128_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		Camellia_ecb_encrypt(in + i, out + i, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
camellia_128_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		Camellia_ofb128_encrypt(in, out, EVP_MAXCHUNK, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Camellia_ofb128_encrypt(in, out, inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static const EVP_CIPHER camellia_128_cbc = {
	.nid = NID_camellia_128_cbc,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CBC_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_128_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_128_cbc(void)
{
	return &camellia_128_cbc;
}

static const EVP_CIPHER camellia_128_cfb128 = {
	.nid = NID_camellia_128_cfb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_128_cfb128_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_128_cfb128(void)
{
	return &camellia_128_cfb128;
}

static const EVP_CIPHER camellia_128_ofb = {
	.nid = NID_camellia_128_ofb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_OFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_128_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_128_ofb(void)
{
	return &camellia_128_ofb;
}

static const EVP_CIPHER camellia_128_ecb = {
	.nid = NID_camellia_128_ecb,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 0,
	.flags = 0 | EVP_CIPH_ECB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_128_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_128_ecb(void)
{
	return &camellia_128_ecb;
}

static int
camellia_192_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		Camellia_cbc_encrypt(in, out, EVP_MAXCHUNK, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Camellia_cbc_encrypt(in, out, inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
camellia_192_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb128_encrypt(in, out, chunk, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
camellia_192_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		Camellia_ecb_encrypt(in + i, out + i, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
camellia_192_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		Camellia_ofb128_encrypt(in, out, EVP_MAXCHUNK, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Camellia_ofb128_encrypt(in, out, inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static const EVP_CIPHER camellia_192_cbc = {
	.nid = NID_camellia_192_cbc,
	.block_size = 16,
	.key_len = 24,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CBC_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_192_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_192_cbc(void)
{
	return &camellia_192_cbc;
}

static const EVP_CIPHER camellia_192_cfb128 = {
	.nid = NID_camellia_192_cfb128,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_192_cfb128_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_192_cfb128(void)
{
	return &camellia_192_cfb128;
}

static const EVP_CIPHER camellia_192_ofb = {
	.nid = NID_camellia_192_ofb128,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_OFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_192_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_192_ofb(void)
{
	return &camellia_192_ofb;
}

static const EVP_CIPHER camellia_192_ecb = {
	.nid = NID_camellia_192_ecb,
	.block_size = 16,
	.key_len = 24,
	.iv_len = 0,
	.flags = 0 | EVP_CIPH_ECB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_192_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_192_ecb(void)
{
	return &camellia_192_ecb;
}

static int
camellia_256_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		Camellia_cbc_encrypt(in, out, EVP_MAXCHUNK, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Camellia_cbc_encrypt(in, out, inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
camellia_256_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb128_encrypt(in, out, chunk, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
camellia_256_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		Camellia_ecb_encrypt(in + i, out + i, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
camellia_256_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		Camellia_ofb128_encrypt(in, out, EVP_MAXCHUNK, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Camellia_ofb128_encrypt(in, out, inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static const EVP_CIPHER camellia_256_cbc = {
	.nid = NID_camellia_256_cbc,
	.block_size = 16,
	.key_len = 32,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CBC_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_256_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_256_cbc(void)
{
	return &camellia_256_cbc;
}

static const EVP_CIPHER camellia_256_cfb128 = {
	.nid = NID_camellia_256_cfb128,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_256_cfb128_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_256_cfb128(void)
{
	return &camellia_256_cfb128;
}

static const EVP_CIPHER camellia_256_ofb = {
	.nid = NID_camellia_256_ofb128,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_OFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_256_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_256_ofb(void)
{
	return &camellia_256_ofb;
}

static const EVP_CIPHER camellia_256_ecb = {
	.nid = NID_camellia_256_ecb,
	.block_size = 16,
	.key_len = 32,
	.iv_len = 0,
	.flags = 0 | EVP_CIPH_ECB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_256_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_256_ecb(void)
{
	return &camellia_256_ecb;
}

static int
camellia_128_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	chunk >>= 3;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb1_encrypt(in, out, ((1 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? chunk * 8 : chunk), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static const EVP_CIPHER camellia_128_cfb1 = {
	.nid = NID_camellia_128_cfb1,
	.block_size = 1,
	.key_len = 128/8,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_128_cfb1_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_128_cfb1(void)
{
	return &camellia_128_cfb1;
}

static int
camellia_192_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	chunk >>= 3;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb1_encrypt(in, out, ((1 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? chunk * 8 : chunk), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static const EVP_CIPHER camellia_192_cfb1 = {
	.nid = NID_camellia_192_cfb1,
	.block_size = 1,
	.key_len = 192/8,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_192_cfb1_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_192_cfb1(void)
{
	return &camellia_192_cfb1;
}

static int
camellia_256_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	chunk >>= 3;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb1_encrypt(in, out, ((1 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? chunk * 8 : chunk), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static const EVP_CIPHER camellia_256_cfb1 = {
	.nid = NID_camellia_256_cfb1,
	.block_size = 1,
	.key_len = 256/8,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_256_cfb1_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_256_cfb1(void)
{
	return &camellia_256_cfb1;
}


static int
camellia_128_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb8_encrypt(in, out, chunk, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static const EVP_CIPHER camellia_128_cfb8 = {
	.nid = NID_camellia_128_cfb8,
	.block_size = 1,
	.key_len = 128/8,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_128_cfb8_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_128_cfb8(void)
{
	return &camellia_128_cfb8;
}

static int
camellia_192_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb8_encrypt(in, out, chunk, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static const EVP_CIPHER camellia_192_cfb8 = {
	.nid = NID_camellia_192_cfb8,
	.block_size = 1,
	.key_len = 192/8,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_192_cfb8_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_192_cfb8(void)
{
	return &camellia_192_cfb8;
}

static int
camellia_256_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Camellia_cfb8_encrypt(in, out, chunk, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static const EVP_CIPHER camellia_256_cfb8 = {
	.nid = NID_camellia_256_cfb8,
	.block_size = 1,
	.key_len = 256/8,
	.iv_len = 16,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = camellia_init_key,
	.do_cipher = camellia_256_cfb8_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAMELLIA_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_camellia_256_cfb8(void)
{
	return &camellia_256_cfb8;
}
#endif
Changes to jni/libressl/crypto/evp/e_cast.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_cast.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_cast.c,v 1.13 2022/09/15 07:04:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91


































































































































































92
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */


#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_CAST

#include <openssl/cast.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"

static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);

typedef struct {
	CAST_KEY ks;
} EVP_CAST_KEY;

#define data(ctx)	EVP_C_DATA(EVP_CAST_KEY,ctx)

IMPLEMENT_BLOCK_CIPHER(cast5, ks, CAST, EVP_CAST_KEY,
    NID_cast5, 8, CAST_KEY_LENGTH, 8, 64,
    EVP_CIPH_VARIABLE_LENGTH, cast_init_key, NULL,
    EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)

static int
cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	CAST_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key);
	return 1;
}


































































































































































#endif







>












<
<
<




|
<
<
<
<
<








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71



72
73
74
75
76





77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_CAST

#include <openssl/cast.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"




typedef struct {
	CAST_KEY ks;
} EVP_CAST_KEY;

#define data(ctx)	((EVP_CAST_KEY *)(ctx)->cipher_data)






static int
cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	CAST_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key);
	return 1;
}

static int
cast5_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		CAST_cbc_encrypt(in, out, (long)chunk, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		CAST_cbc_encrypt(in, out, (long)inl, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
cast5_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		CAST_cfb64_encrypt(in, out, (long)chunk, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
cast5_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		CAST_ecb_encrypt(in + i, out + i, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
cast5_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		CAST_ofb64_encrypt(in, out, (long)chunk, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		CAST_ofb64_encrypt(in, out, (long)inl, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static const EVP_CIPHER cast5_cbc = {
	.nid = NID_cast5_cbc,
	.block_size = 8,
	.key_len = CAST_KEY_LENGTH,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE,
	.init = cast_init_key,
	.do_cipher = cast5_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAST_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_cast5_cbc(void)
{
	return &cast5_cbc;
}

static const EVP_CIPHER cast5_cfb64 = {
	.nid = NID_cast5_cfb64,
	.block_size = 1,
	.key_len = CAST_KEY_LENGTH,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE,
	.init = cast_init_key,
	.do_cipher = cast5_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAST_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_cast5_cfb64(void)
{
	return &cast5_cfb64;
}

static const EVP_CIPHER cast5_ofb = {
	.nid = NID_cast5_ofb64,
	.block_size = 1,
	.key_len = CAST_KEY_LENGTH,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE,
	.init = cast_init_key,
	.do_cipher = cast5_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAST_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_cast5_ofb(void)
{
	return &cast5_ofb;
}

static const EVP_CIPHER cast5_ecb = {
	.nid = NID_cast5_ecb,
	.block_size = 8,
	.key_len = CAST_KEY_LENGTH,
	.iv_len = 0,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE,
	.init = cast_init_key,
	.do_cipher = cast5_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_CAST_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_cast5_ecb(void)
{
	return &cast5_ecb;
}
#endif
Changes to jni/libressl/crypto/evp/e_chacha.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_chacha.c,v 1.8 2020/01/26 07:47:26 tb Exp $ */
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_chacha.c,v 1.9 2022/07/30 17:11:38 jsing Exp $ */
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
21
22
23
24
25
26
27
28

29





30
31













32
33
34
35
36
37
38

#include <openssl/chacha.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"

static int chacha_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,

    const unsigned char *in, size_t len);





static int chacha_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);














static const EVP_CIPHER chacha20_cipher = {
	.nid = NID_chacha20,
	.block_size = 1,
	.key_len = 32,
	/* 
	 * The 128 bit EVP IV is split for ChaCha into four 32 bit pieces:







|
>
|
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

#include <openssl/chacha.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"

static int
chacha_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *openssl_iv, int enc)
{
	if (key != NULL)
		ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key,
		    EVP_CIPHER_CTX_key_length(ctx) * 8);
	if (openssl_iv != NULL) {
		const unsigned char *iv = openssl_iv + 8;
		const unsigned char *counter = openssl_iv;

		ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, counter);
	}
	return 1;
}

static int
chacha_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
    size_t len)
{
	ChaCha((ChaCha_ctx *)ctx->cipher_data, out, in, len);
	return 1;
}

static const EVP_CIPHER chacha20_cipher = {
	.nid = NID_chacha20,
	.block_size = 1,
	.key_len = 32,
	/* 
	 * The 128 bit EVP IV is split for ChaCha into four 32 bit pieces:
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

const EVP_CIPHER *
EVP_chacha20(void)
{
	return (&chacha20_cipher);
}

static int
chacha_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *openssl_iv, int enc)
{
	if (key != NULL)
		ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key,
		    EVP_CIPHER_CTX_key_length(ctx) * 8);
	if (openssl_iv != NULL) {
		const unsigned char *iv = openssl_iv + 8;
		const unsigned char *counter = openssl_iv;

		ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, counter);
	}
	return 1;
}

static int
chacha_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
    size_t len)
{
	ChaCha((ChaCha_ctx *)ctx->cipher_data, out, in, len);
	return 1;
}

#endif







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

71
72
73
74
75
76
77
























78

const EVP_CIPHER *
EVP_chacha20(void)
{
	return (&chacha20_cipher);
}

























#endif
Changes to jni/libressl/crypto/evp/e_chacha20poly1305.c.
1
2
3

4
5
6
7
8
9
10
/* $OpenBSD: e_chacha20poly1305.c,v 1.21 2019/03/27 15:34:01 jsing Exp $ */

/*

 * Copyright (c) 2015 Reyk Floter <reyk@openbsd.org>
 * Copyright (c) 2014, Google Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|


>







1
2
3
4
5
6
7
8
9
10
11
/* $OpenBSD: e_chacha20poly1305.c,v 1.26 2022/09/13 04:59:18 jsing Exp $ */

/*
 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2015 Reyk Floter <reyk@openbsd.org>
 * Copyright (c) 2014, Google Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
25
26
27
28
29
30
31

32
33
34
35
36
37
38
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)

#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/chacha.h>
#include <openssl/poly1305.h>


#include "evp_locl.h"

#define POLY1305_TAG_LEN 16

#define CHACHA20_CONSTANT_LEN 4
#define CHACHA20_IV_LEN 8
#define CHACHA20_NONCE_LEN (CHACHA20_CONSTANT_LEN + CHACHA20_IV_LEN)







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)

#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/chacha.h>
#include <openssl/poly1305.h>

#include "bytestring.h"
#include "evp_locl.h"

#define POLY1305_TAG_LEN 16

#define CHACHA20_CONSTANT_LEN 4
#define CHACHA20_IV_LEN 8
#define CHACHA20_NONCE_LEN (CHACHA20_CONSTANT_LEN + CHACHA20_IV_LEN)
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115








116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

	if (data != NULL)
		CRYPTO_poly1305_update(poly1305, data, data_len);
	CRYPTO_poly1305_update(poly1305, length_bytes, sizeof(length_bytes));
}

static void
poly1305_update_with_pad16(poly1305_state *poly1305,
    const unsigned char *data, size_t data_len)
{
	static const unsigned char zero_pad16[16];
	size_t pad_len;

	CRYPTO_poly1305_update(poly1305, data, data_len);

	/* pad16() is defined in RFC 7539 2.8.1. */
	if ((pad_len = data_len % 16) == 0)
		return;

	CRYPTO_poly1305_update(poly1305, zero_pad16, 16 - pad_len);
}









static int
aead_chacha20_poly1305_seal(const EVP_AEAD_CTX *ctx, unsigned char *out,
    size_t *out_len, size_t max_out_len, const unsigned char *nonce,
    size_t nonce_len, const unsigned char *in, size_t in_len,
    const unsigned char *ad, size_t ad_len)
{
	const struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state;
	unsigned char poly1305_key[32];
	poly1305_state poly1305;
	const unsigned char *iv;
	const uint64_t in_len_64 = in_len;
	uint64_t ctr;

	/* The underlying ChaCha implementation may not overflow the block
	 * counter into the second counter word. Therefore we disallow
	 * individual operations that work on more than 2TB at a time.
	 * in_len_64 is needed because, on 32-bit platforms, size_t is only
	 * 32-bits and this produces a warning because it's always false.
	 * Casting to uint64_t inside the conditional is not sufficient to stop
	 * the warning. */
	if (in_len_64 >= (1ULL << 32) * 64 - 64) {
		EVPerror(EVP_R_TOO_LARGE);
		return 0;
	}

	if (max_out_len < in_len + c20_ctx->tag_len) {
		EVPerror(EVP_R_BUFFER_TOO_SMALL);
		return 0;
	}

	if (nonce_len != ctx->aead->nonce_len) {
		EVPerror(EVP_R_IV_TOO_LARGE);







|
<




<
<






>
>
>
>
>
>
>
>











<


<
<
<
<
<
<
<
<
<
<
<
<







97
98
99
100
101
102
103
104

105
106
107
108


109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

134
135












136
137
138
139
140
141
142

	if (data != NULL)
		CRYPTO_poly1305_update(poly1305, data, data_len);
	CRYPTO_poly1305_update(poly1305, length_bytes, sizeof(length_bytes));
}

static void
poly1305_pad16(poly1305_state *poly1305, size_t data_len)

{
	static const unsigned char zero_pad16[16];
	size_t pad_len;



	/* pad16() is defined in RFC 7539 2.8.1. */
	if ((pad_len = data_len % 16) == 0)
		return;

	CRYPTO_poly1305_update(poly1305, zero_pad16, 16 - pad_len);
}

static void
poly1305_update_with_pad16(poly1305_state *poly1305,
    const unsigned char *data, size_t data_len)
{
	CRYPTO_poly1305_update(poly1305, data, data_len);
	poly1305_pad16(poly1305, data_len);
}

static int
aead_chacha20_poly1305_seal(const EVP_AEAD_CTX *ctx, unsigned char *out,
    size_t *out_len, size_t max_out_len, const unsigned char *nonce,
    size_t nonce_len, const unsigned char *in, size_t in_len,
    const unsigned char *ad, size_t ad_len)
{
	const struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state;
	unsigned char poly1305_key[32];
	poly1305_state poly1305;
	const unsigned char *iv;

	uint64_t ctr;













	if (max_out_len < in_len + c20_ctx->tag_len) {
		EVPerror(EVP_R_BUFFER_TOO_SMALL);
		return 0;
	}

	if (nonce_len != ctx->aead->nonce_len) {
		EVPerror(EVP_R_IV_TOO_LARGE);
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
    const unsigned char *ad, size_t ad_len)
{
	const struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state;
	unsigned char mac[POLY1305_TAG_LEN];
	unsigned char poly1305_key[32];
	const unsigned char *iv = nonce;
	poly1305_state poly1305;
	const uint64_t in_len_64 = in_len;
	size_t plaintext_len;
	uint64_t ctr = 0;

	if (in_len < c20_ctx->tag_len) {
		EVPerror(EVP_R_BAD_DECRYPT);
		return 0;
	}

	/* The underlying ChaCha implementation may not overflow the block
	 * counter into the second counter word. Therefore we disallow
	 * individual operations that work on more than 2TB at a time.
	 * in_len_64 is needed because, on 32-bit platforms, size_t is only
	 * 32-bits and this produces a warning because it's always false.
	 * Casting to uint64_t inside the conditional is not sufficient to stop
	 * the warning. */
	if (in_len_64 >= (1ULL << 32) * 64 - 64) {
		EVPerror(EVP_R_TOO_LARGE);
		return 0;
	}

	if (nonce_len != ctx->aead->nonce_len) {
		EVPerror(EVP_R_IV_TOO_LARGE);
		return 0;
	}

	plaintext_len = in_len - c20_ctx->tag_len;








<








<
<
<
<
<
<
<
<
<
<
<
<







178
179
180
181
182
183
184

185
186
187
188
189
190
191
192












193
194
195
196
197
198
199
    const unsigned char *ad, size_t ad_len)
{
	const struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state;
	unsigned char mac[POLY1305_TAG_LEN];
	unsigned char poly1305_key[32];
	const unsigned char *iv = nonce;
	poly1305_state poly1305;

	size_t plaintext_len;
	uint64_t ctr = 0;

	if (in_len < c20_ctx->tag_len) {
		EVPerror(EVP_R_BAD_DECRYPT);
		return 0;
	}













	if (nonce_len != ctx->aead->nonce_len) {
		EVPerror(EVP_R_IV_TOO_LARGE);
		return 0;
	}

	plaintext_len = in_len - c20_ctx->tag_len;

381
382
383
384
385
386
387
388














































































































































































































































389
};

const EVP_AEAD *
EVP_aead_xchacha20_poly1305()
{
	return &aead_xchacha20_poly1305;
}















































































































































































































































#endif  /* !OPENSSL_NO_CHACHA && !OPENSSL_NO_POLY1305 */








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
};

const EVP_AEAD *
EVP_aead_xchacha20_poly1305()
{
	return &aead_xchacha20_poly1305;
}

struct chacha20_poly1305_ctx {
	ChaCha_ctx chacha;
	poly1305_state poly1305;

	unsigned char key[32];
	unsigned char nonce[CHACHA20_NONCE_LEN];
	size_t nonce_len;
	unsigned char tag[POLY1305_TAG_LEN];
	size_t tag_len;

	size_t ad_len;
	size_t in_len;

	int in_ad;
	int started;
};

static int
chacha20_poly1305_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int encrypt)
{
	struct chacha20_poly1305_ctx *cpx = ctx->cipher_data;
	uint8_t *data;
	CBB cbb;
	int ret = 0;

	memset(&cbb, 0, sizeof(cbb));

	if (key == NULL && iv == NULL)
		goto done;

	cpx->started = 0;

	if (key != NULL)
		memcpy(cpx->key, key, sizeof(cpx->key));

	if (iv != NULL) {
		/*
		 * Left zero pad if configured nonce length is less than ChaCha
		 * nonce length.
		 */
		if (!CBB_init_fixed(&cbb, cpx->nonce, sizeof(cpx->nonce)))
			goto err;
		if (!CBB_add_space(&cbb, &data, sizeof(cpx->nonce) - cpx->nonce_len))
			goto err;
		if (!CBB_add_bytes(&cbb, iv, cpx->nonce_len))
			goto err;
		if (!CBB_finish(&cbb, NULL, NULL))
			goto err;
	}

 done:
	ret = 1;

 err:
	CBB_cleanup(&cbb);

	return ret;
}

static int
chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t len)
{
	struct chacha20_poly1305_ctx *cpx = ctx->cipher_data;

	/*
	 * Since we're making AEAD work within the constraints of EVP_CIPHER...
	 * If in is non-NULL then this is an update, while if in is NULL then
	 * this is a final. If in is non-NULL but out is NULL, then the input
	 * being provided is associated data. Plus we have to handle encryption
	 * (sealing) and decryption (opening) in the same function.
	 */

	if (!cpx->started) {
		unsigned char poly1305_key[32];
		const unsigned char *iv;
		uint64_t ctr;

		ctr = (uint64_t)((uint32_t)(cpx->nonce[0]) |
		    (uint32_t)(cpx->nonce[1]) << 8 |
		    (uint32_t)(cpx->nonce[2]) << 16 |
		    (uint32_t)(cpx->nonce[3]) << 24) << 32;
		iv = cpx->nonce + CHACHA20_CONSTANT_LEN;

		ChaCha_set_key(&cpx->chacha, cpx->key, 8 * sizeof(cpx->key));
		ChaCha_set_iv(&cpx->chacha, iv, NULL);

		/* See chacha.c for details re handling of counter. */
		cpx->chacha.input[12] = (uint32_t)ctr;
		cpx->chacha.input[13] = (uint32_t)(ctr >> 32);

		memset(poly1305_key, 0, sizeof(poly1305_key));
		ChaCha(&cpx->chacha, poly1305_key, poly1305_key,
		    sizeof(poly1305_key));
		CRYPTO_poly1305_init(&cpx->poly1305, poly1305_key);

		/* Mark remaining key block as used. */
		cpx->chacha.unused = 0;

		cpx->ad_len = 0;
		cpx->in_len = 0;
		cpx->in_ad = 0;

		cpx->started = 1;
	}

	if (len > SIZE_MAX - cpx->in_len) {
		EVPerror(EVP_R_TOO_LARGE);
		return 0;
	}

	/* Disallow authenticated data after plaintext/ciphertext. */
	if (cpx->in_len > 0 && in != NULL && out == NULL)
		return -1;

	if (cpx->in_ad && (in == NULL || out != NULL)) {
		poly1305_pad16(&cpx->poly1305, cpx->ad_len);
		cpx->in_ad = 0;
	}

	/* Update with AD or plaintext/ciphertext. */
	if (in != NULL) {
		if (out == NULL) {
			cpx->ad_len += len;
			cpx->in_ad = 1;
		} else {
			ChaCha(&cpx->chacha, out, in, len);
			cpx->in_len += len;
		}
		if (ctx->encrypt && out != NULL)
			CRYPTO_poly1305_update(&cpx->poly1305, out, len);
		else
			CRYPTO_poly1305_update(&cpx->poly1305, in, len);

		return len;
	}

	/* Final. */
	poly1305_pad16(&cpx->poly1305, cpx->in_len);
	poly1305_update_with_length(&cpx->poly1305, NULL, cpx->ad_len);
	poly1305_update_with_length(&cpx->poly1305, NULL, cpx->in_len);

	if (ctx->encrypt) {
		CRYPTO_poly1305_finish(&cpx->poly1305, cpx->tag);
		cpx->tag_len = sizeof(cpx->tag);
	} else {
		unsigned char tag[POLY1305_TAG_LEN];

		/* Ensure that a tag has been provided. */
		if (cpx->tag_len <= 0)
			return -1;

		CRYPTO_poly1305_finish(&cpx->poly1305, tag);
		if (timingsafe_memcmp(tag, cpx->tag, cpx->tag_len) != 0)
			return -1;
	}

	cpx->started = 0;

	return len;
}

static void
chacha20_poly1305_cleanup(EVP_CIPHER_CTX *ctx)
{
	struct chacha20_poly1305_ctx *cpx = ctx->cipher_data;

	explicit_bzero(cpx, sizeof(*cpx));
}

static int
chacha20_poly1305_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
{
	struct chacha20_poly1305_ctx *cpx = ctx->cipher_data;

	switch (type) {
	case EVP_CTRL_INIT:
		memset(cpx, 0, sizeof(*cpx));
		cpx->nonce_len = sizeof(cpx->nonce);
		return 1;

	case EVP_CTRL_AEAD_SET_IVLEN:
		if (arg <= 0 || arg > sizeof(cpx->nonce))
			return 0;
		cpx->nonce_len = arg;
		return 1;

	case EVP_CTRL_AEAD_SET_TAG:
		if (ctx->encrypt)
			return 0;
		if (arg <= 0 || arg > sizeof(cpx->tag))
			return 0;
		if (ptr != NULL) {
			memcpy(cpx->tag, ptr, arg);
			cpx->tag_len = arg;
		}
		return 1;

	case EVP_CTRL_AEAD_GET_TAG:
		if (!ctx->encrypt)
			return 0;
		if (arg <= 0 || arg > cpx->tag_len)
			return 0;
		memcpy(ptr, cpx->tag, arg);
		return 1;

	case EVP_CTRL_AEAD_SET_IV_FIXED:
		if (arg != sizeof(cpx->nonce))
			return 0;
		memcpy(cpx->nonce, ptr, arg);
		return 1;
	}

	return 0;
}

static const EVP_CIPHER cipher_chacha20_poly1305 = {
	.nid = NID_chacha20_poly1305,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 12,
	.flags = EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT |
	    EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_AEAD_CIPHER |
	    EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_FLAG_DEFAULT_ASN1,
	.init = chacha20_poly1305_init,
	.do_cipher = chacha20_poly1305_cipher,
	.cleanup = chacha20_poly1305_cleanup,
	.ctx_size = sizeof(struct chacha20_poly1305_ctx),
	.ctrl = chacha20_poly1305_ctrl,
};

const EVP_CIPHER *
EVP_chacha20_poly1305(void)
{
	return &cipher_chacha20_poly1305;
}

#endif  /* !OPENSSL_NO_CHACHA && !OPENSSL_NO_POLY1305 */
Changes to jni/libressl/crypto/evp/e_des.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_des.c,v 1.14 2015/10/12 06:05:52 guenther Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_des.c,v 1.19 2022/09/15 07:04:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70

71
72








73
74





75




76
77
78
79
80

81








82
83

84
85
86
87
88
89
90


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107


108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145


146
147
148
149
150
151
152
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */


#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_DES

#include <openssl/evp.h>
#include <openssl/des.h>
#include <openssl/objects.h>

#include "evp_locl.h"


static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);








static int des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);






/* Because of various casts and different names can't use IMPLEMENT_BLOCK_CIPHER */





static int
des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{

	BLOCK_CIPHER_ecb_loop()








		DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i),
		    ctx->cipher_data, ctx->encrypt);

	return 1;
}

static int
des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{


	while (inl >= EVP_MAXCHUNK) {
		DES_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num);
	return 1;
}

static int
des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{


	while (inl >= EVP_MAXCHUNK) {
		DES_ncbc_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}

static int
des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{


	while (inl >= EVP_MAXCHUNK) {
		DES_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
	return 1;
}

/* Although we have a CFB-r implementation for DES, it doesn't pack the right
   way, so wrap it here */
static int
des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t n, chunk = EVP_MAXCHUNK/8;
	unsigned char c[1], d[1];



	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		for (n = 0; n < chunk*8; ++n) {
			c[0] = (in[n / 8] & (1 << (7 - n % 8))) ? 0x80 : 0;







>












>
|
|
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
|
>
>
>
>





>
|
>
>
>
>
>
>
>
>


>







>
>
|
|

|
|
|











>
>
|
|

|
|
|











>
>
|
|

|
|
|













<

>
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187
188
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_DES

#include <openssl/evp.h>
#include <openssl/des.h>
#include <openssl/objects.h>

#include "evp_locl.h"

static int
des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	DES_cblock *deskey = (DES_cblock *)key;

	DES_set_key_unchecked(deskey, ctx->cipher_data);
	return 1;
}

static int
des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
	switch (type) {
	case EVP_CTRL_RAND_KEY:
		if (DES_random_key((DES_cblock *)ptr) == 0)
			return 0;
		return 1;

	default:
		return -1;
	}
}

static int
des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i),
		    ctx->cipher_data, ctx->encrypt);

	return 1;
}

static int
des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_ofb64_encrypt(in, out, (long)chunk, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num);
	return 1;
}

static int
des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_ncbc_encrypt(in, out, (long)chunk, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}

static int
des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_cfb64_encrypt(in, out, (long)chunk, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
	return 1;
}

/* Although we have a CFB-r implementation for DES, it doesn't pack the right
   way, so wrap it here */
static int
des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{

	unsigned char c[1], d[1];
	size_t chunk = LONG_MAX / 8;
	size_t n;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		for (n = 0; n < chunk*8; ++n) {
			c[0] = (in[n / 8] & (1 << (7 - n % 8))) ? 0x80 : 0;
166
167
168
169
170
171
172


173
174
175
176
177
178
179
180
181
182
183
184
185

186




187



188
189
190


191





192






193



194
195



196





197






198



199
200



201
202
203
204




205















206


207
208
209
210
















211
212
213
214
215
216
217
218
219
220
221



222










223
224


225


226
	return 1;
}

static int
des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{


	while (inl >= EVP_MAXCHUNK) {
		DES_cfb_encrypt(in, out, 8, (long)EVP_MAXCHUNK,
		    ctx->cipher_data, (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_cfb_encrypt(in, out, 8, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}


BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64,




    EVP_CIPH_RAND_KEY, des_init_key, NULL,



    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    des_ctrl)








BLOCK_CIPHER_def_cfb(des, DES_key_schedule, NID_des, 8, 8, 1,






    EVP_CIPH_RAND_KEY, des_init_key, NULL,



    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv, des_ctrl)









BLOCK_CIPHER_def_cfb(des, DES_key_schedule, NID_des, 8, 8, 8,






    EVP_CIPH_RAND_KEY, des_init_key, NULL,



    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv, des_ctrl)




static int
des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)




{















	DES_cblock *deskey = (DES_cblock *)key;



	DES_set_key_unchecked(deskey, ctx->cipher_data);
	return 1;
}

















static int
des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
	switch (type) {
	case EVP_CTRL_RAND_KEY:
		if (DES_random_key((DES_cblock *)ptr) == 0)
			return 0;
		return 1;

	default:



		return -1;










	}
}





#endif







>
>
|
|

|
|
|







>
|
>
>
>
>
|
>
>
>
|
|
|
>
>

>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
|
|
>
>
>

>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
|
|
>
>
>

<
|
<
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
<
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
|

<
<
<
|
<
|
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
|
|
>
>
|
>
>

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283

284

285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308

309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330



331

332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
	return 1;
}

static int
des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_cfb_encrypt(in, out, 8, (long)chunk,
		    ctx->cipher_data, (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_cfb_encrypt(in, out, 8, (long)inl, ctx->cipher_data,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}

static const EVP_CIPHER des_cbc = {
	.nid = NID_des_cbc,
	.block_size = 8,
	.key_len = 8,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE,
	.init = des_init_key,
	.do_cipher = des_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_key_schedule),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_cbc(void)
{
	return &des_cbc;
}

static const EVP_CIPHER des_cfb64 = {
	.nid = NID_des_cfb64,
	.block_size = 1,
	.key_len = 8,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE,
	.init = des_init_key,
	.do_cipher = des_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_key_schedule),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_cfb64(void)
{
	return &des_cfb64;
}

static const EVP_CIPHER des_ofb = {
	.nid = NID_des_ofb64,
	.block_size = 1,
	.key_len = 8,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE,
	.init = des_init_key,
	.do_cipher = des_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_key_schedule),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des_ctrl,
	.app_data = NULL,
};


const EVP_CIPHER *

EVP_des_ofb(void)
{
	return &des_ofb;
}

static const EVP_CIPHER des_ecb = {
	.nid = NID_des_ecb,
	.block_size = 8,
	.key_len = 8,
	.iv_len = 0,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE,
	.init = des_init_key,
	.do_cipher = des_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_key_schedule),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ecb(void)
{

	return &des_ecb;
}

static const EVP_CIPHER des_cfb1 = {
	.nid = NID_des_cfb1,
	.block_size = 1,
	.key_len = 8,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE,
	.init = des_init_key,
	.do_cipher = des_cfb1_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_key_schedule),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_cfb1(void)
{



	return &des_cfb1;

}

static const EVP_CIPHER des_cfb8 = {
	.nid = NID_des_cfb8,
	.block_size = 1,
	.key_len = 8,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE,
	.init = des_init_key,
	.do_cipher = des_cfb8_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_key_schedule),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_cfb8(void)
{
	return &des_cfb8;
}
#endif
Changes to jni/libressl/crypto/evp/e_des3.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_des3.c,v 1.20 2019/05/14 15:40:44 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_des3.c,v 1.25 2022/09/15 07:04:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */


#include <stdio.h>
#include <string.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_DES

#include <openssl/des.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"

static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);

static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);

static int des3_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);

typedef struct {
    DES_key_schedule ks1;/* key schedule */
    DES_key_schedule ks2;/* key schedule (for ede) */
    DES_key_schedule ks3;/* key schedule (for ede3) */
} DES_EDE_KEY;

#define data(ctx) ((DES_EDE_KEY *)(ctx)->cipher_data)

/* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */

static int
des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	BLOCK_CIPHER_ecb_loop()
	DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i),
	    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, ctx->encrypt);
	return 1;
}

static int
des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_ede3_ofb64_encrypt(in, out, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num);

	return 1;
}

static int
des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_ede3_cbc_encrypt(in, out, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}

static int
des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_ede3_cfb64_encrypt(in, out, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
	return 1;
}

/* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right
   way, so wrap it here */
static int
des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t n;
	unsigned char c[1], d[1];
	if (!(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS))
		inl *= 8;

	for (n = 0; n < inl; ++n) {
		c[0] = (in[n/8]&(1 << (7 - n % 8))) ? 0x80 : 0;
		DES_ede3_cfb_encrypt(c, d, 1, 1,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		out[n / 8] = (out[n / 8] & ~(0x80 >> (unsigned int)(n % 8))) |
		    ((d[0] & 0x80) >> (unsigned int)(n % 8));
	}

	return 1;
}

static int
des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		DES_ede3_cfb_encrypt(in, out, 8, (long)EVP_MAXCHUNK,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}
	if (inl)
		DES_ede3_cfb_encrypt(in, out, 8, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}

BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64,
    EVP_CIPH_RAND_KEY, des_ede_init_key, NULL,
    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    des3_ctrl)

#define des_ede3_cfb64_cipher des_ede_cfb64_cipher
#define des_ede3_ofb_cipher des_ede_ofb_cipher
#define des_ede3_cbc_cipher des_ede_cbc_cipher
#define des_ede3_ecb_cipher des_ede_ecb_cipher

BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64,
    EVP_CIPH_RAND_KEY, des_ede3_init_key, NULL,
    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    des3_ctrl)

BLOCK_CIPHER_def_cfb(des_ede3, DES_EDE_KEY, NID_des_ede3, 24, 8, 1,
    EVP_CIPH_RAND_KEY, des_ede3_init_key, NULL,
    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    des3_ctrl)

BLOCK_CIPHER_def_cfb(des_ede3, DES_EDE_KEY, NID_des_ede3, 24, 8, 8,
    EVP_CIPH_RAND_KEY, des_ede3_init_key, NULL,
    EVP_CIPHER_set_asn1_iv,
    EVP_CIPHER_get_asn1_iv,
    des3_ctrl)

static int
des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	DES_cblock *deskey = (DES_cblock *)key;

	DES_set_key_unchecked(&deskey[0], &data(ctx)->ks1);







>













<
<
<
<
<
<
<
<








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72








73
74
75
76
77
78
79
80













































































































































81
82
83
84
85
86
87
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>
#include <string.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_DES

#include <openssl/des.h>
#include <openssl/evp.h>
#include <openssl/objects.h>

#include "evp_locl.h"









typedef struct {
    DES_key_schedule ks1;/* key schedule */
    DES_key_schedule ks2;/* key schedule (for ede) */
    DES_key_schedule ks3;/* key schedule (for ede3) */
} DES_EDE_KEY;

#define data(ctx) ((DES_EDE_KEY *)(ctx)->cipher_data)














































































































































static int
des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	DES_cblock *deskey = (DES_cblock *)key;

	DES_set_key_unchecked(&deskey[0], &data(ctx)->ks1);
267
268
269
270
271
272
273





































































































































































































































































































































































274
275
276
277
278
279
280
281
282
283
284
285
286
			return 0;
		return 1;

	default:
		return -1;
	}
}






































































































































































































































































































































































const EVP_CIPHER *
EVP_des_ede(void)
{
	return &des_ede_ecb;
}

const EVP_CIPHER *
EVP_des_ede3(void)
{
	return &des_ede3_ecb;
}
#endif







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
			return 0;
		return 1;

	default:
		return -1;
	}
}

static int
des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i),
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, ctx->encrypt);

	return 1;
}

static int
des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_ede3_ofb64_encrypt(in, out, (long)chunk,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_ede3_ofb64_encrypt(in, out, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num);

	return 1;
}

static int
des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_ede3_cbc_encrypt(in, out, (long)chunk,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_ede3_cbc_encrypt(in, out, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}

static int
des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_ede3_cfb64_encrypt(in, out, (long)chunk,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_ede3_cfb64_encrypt(in, out, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
	return 1;
}

/* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right
   way, so wrap it here */
static int
des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	unsigned char c[1], d[1];
	size_t n;

	if (!(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS))
		inl *= 8;

	for (n = 0; n < inl; ++n) {
		c[0] = (in[n/8]&(1 << (7 - n % 8))) ? 0x80 : 0;
		DES_ede3_cfb_encrypt(c, d, 1, 1,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		out[n / 8] = (out[n / 8] & ~(0x80 >> (unsigned int)(n % 8))) |
		    ((d[0] & 0x80) >> (unsigned int)(n % 8));
	}

	return 1;
}

static int
des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		DES_ede3_cfb_encrypt(in, out, 8, (long)chunk,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}
	if (inl)
		DES_ede3_cfb_encrypt(in, out, 8, (long)inl,
		    &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
		    (DES_cblock *)ctx->iv, ctx->encrypt);
	return 1;
}

static const EVP_CIPHER des_ede_cbc = {
	.nid = NID_des_ede_cbc,
	.block_size = 8,
	.key_len = 16,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE,
	.init = des_ede_init_key,
	.do_cipher = des_ede_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede_cbc(void)
{
	return &des_ede_cbc;
}

static const EVP_CIPHER des_ede_cfb64 = {
	.nid = NID_des_ede_cfb64,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE,
	.init = des_ede_init_key,
	.do_cipher = des_ede_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede_cfb64(void)
{
	return &des_ede_cfb64;
}

static const EVP_CIPHER des_ede_ofb = {
	.nid = NID_des_ede_ofb64,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE,
	.init = des_ede_init_key,
	.do_cipher = des_ede_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede_ofb(void)
{
	return &des_ede_ofb;
}

static const EVP_CIPHER des_ede_ecb = {
	.nid = NID_des_ede_ecb,
	.block_size = 8,
	.key_len = 16,
	.iv_len = 0,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE,
	.init = des_ede_init_key,
	.do_cipher = des_ede_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede_ecb(void)
{
	return &des_ede_ecb;
}


#define des_ede3_cfb64_cipher des_ede_cfb64_cipher
#define des_ede3_ofb_cipher des_ede_ofb_cipher
#define des_ede3_cbc_cipher des_ede_cbc_cipher
#define des_ede3_ecb_cipher des_ede_ecb_cipher

static const EVP_CIPHER des_ede3_cbc = {
	.nid = NID_des_ede3_cbc,
	.block_size = 8,
	.key_len = 24,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE,
	.init = des_ede3_init_key,
	.do_cipher = des_ede3_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede3_cbc(void)
{
	return &des_ede3_cbc;
}

static const EVP_CIPHER des_ede3_cfb64 = {
	.nid = NID_des_ede3_cfb64,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE,
	.init = des_ede3_init_key,
	.do_cipher = des_ede3_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede3_cfb64(void)
{
	return &des_ede3_cfb64;
}

static const EVP_CIPHER des_ede3_ofb = {
	.nid = NID_des_ede3_ofb64,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE,
	.init = des_ede3_init_key,
	.do_cipher = des_ede3_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede3_ofb(void)
{
	return &des_ede3_ofb;
}

static const EVP_CIPHER des_ede3_ecb = {
	.nid = NID_des_ede3_ecb,
	.block_size = 8,
	.key_len = 24,
	.iv_len = 0,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE,
	.init = des_ede3_init_key,
	.do_cipher = des_ede3_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede3_ecb(void)
{
	return &des_ede3_ecb;
}


static const EVP_CIPHER des_ede3_cfb1 = {
	.nid = NID_des_ede3_cfb1,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE,
	.init = des_ede3_init_key,
	.do_cipher = des_ede3_cfb1_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede3_cfb1(void)
{
	return &des_ede3_cfb1;
}


static const EVP_CIPHER des_ede3_cfb8 = {
	.nid = NID_des_ede3_cfb8,
	.block_size = 1,
	.key_len = 24,
	.iv_len = 8,
	.flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE,
	.init = des_ede3_init_key,
	.do_cipher = des_ede3_cfb8_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(DES_EDE_KEY),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = des3_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_des_ede3_cfb8(void)
{
	return &des_ede3_cfb8;
}

const EVP_CIPHER *
EVP_des_ede(void)
{
	return &des_ede_ecb;
}

const EVP_CIPHER *
EVP_des_ede3(void)
{
	return &des_ede3_ecb;
}
#endif
Changes to jni/libressl/crypto/evp/e_gost2814789.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_gost2814789.c,v 1.5 2021/12/12 21:30:13 tb Exp $ */
/*
 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
 * Copyright (c) 2005-2006 Cryptocom LTD
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_gost2814789.c,v 1.10 2022/09/10 17:39:47 jsing Exp $ */
/*
 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
 * Copyright (c) 2005-2006 Cryptocom LTD
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
60
61
62
63
64
65
66









67
68
69
70
71
72
73

#include "evp_locl.h"

typedef struct {
	GOST2814789_KEY ks;
	int param_nid;
} EVP_GOST2814789_CTX;










static int
gost2814789_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
{
	EVP_GOST2814789_CTX *c = ctx->cipher_data;

	switch (type) {







>
>
>
>
>
>
>
>
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

#include "evp_locl.h"

typedef struct {
	GOST2814789_KEY ks;
	int param_nid;
} EVP_GOST2814789_CTX;

static int
gost2814789_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_GOST2814789_CTX *c = ctx->cipher_data;

	return Gost2814789_set_key(&c->ks, key, ctx->key_len * 8);
}

static int
gost2814789_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
{
	EVP_GOST2814789_CTX *c = ctx->cipher_data;

	switch (type) {
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
	case EVP_CTRL_GOST_SET_SBOX:
		return Gost2814789_set_sbox(&c->ks, arg);
	default:
		return -1;
	}
}

static int
gost2814789_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_GOST2814789_CTX *c = ctx->cipher_data;

	return Gost2814789_set_key(&c->ks, key, ctx->key_len * 8);
}

int
gost2814789_set_asn1_params(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params)
{
	int len = 0;
	unsigned char *buf = NULL;
	unsigned char *p = NULL;
	EVP_GOST2814789_CTX *c = ctx->cipher_data;







<
<
<
<
<
<
<
<
<







94
95
96
97
98
99
100









101
102
103
104
105
106
107
	case EVP_CTRL_GOST_SET_SBOX:
		return Gost2814789_set_sbox(&c->ks, arg);
	default:
		return -1;
	}
}










int
gost2814789_set_asn1_params(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params)
{
	int len = 0;
	unsigned char *buf = NULL;
	unsigned char *p = NULL;
	EVP_GOST2814789_CTX *c = ctx->cipher_data;
182
183
184
185
186
187
188




189

190






























191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214

215



216




217
218



219











220




221
222



223











224




225
226









227
	memcpy(ctx->iv, gcp->iv->data, len);

	GOST_CIPHER_PARAMS_free(gcp);

	return 1;
}





BLOCK_CIPHER_func_ecb(gost2814789, Gost2814789, EVP_GOST2814789_CTX, ks)

BLOCK_CIPHER_func_cfb(gost2814789, Gost2814789, 64, EVP_GOST2814789_CTX, ks)































static int
gost2814789_cnt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	EVP_GOST2814789_CTX *c = ctx->cipher_data;

	while (inl >= EVP_MAXCHUNK) {
		Gost2814789_cnt_encrypt(in, out, (long)EVP_MAXCHUNK, &c->ks,
		    ctx->iv, ctx->buf, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Gost2814789_cnt_encrypt(in, out, inl, &c->ks, ctx->iv, ctx->buf,
		    &ctx->num);
	return 1;
}

/* gost89 is CFB-64 */
#define NID_gost89_cfb64 NID_id_Gost28147_89


BLOCK_CIPHER_def_ecb(gost2814789, EVP_GOST2814789_CTX, NID_gost89, 8, 32,



		     EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT,




		     gost2814789_init_key, NULL, gost2814789_set_asn1_params,
		     gost2814789_get_asn1_params, gost2814789_ctl)



BLOCK_CIPHER_def_cfb(gost2814789, EVP_GOST2814789_CTX, NID_gost89, 32, 8, 64,











		     EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT,




		     gost2814789_init_key, NULL, gost2814789_set_asn1_params,
		     gost2814789_get_asn1_params, gost2814789_ctl)



BLOCK_CIPHER_def1(gost2814789, cnt, cnt, OFB, EVP_GOST2814789_CTX, NID_gost89,











		  1, 32, 8, EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT,




		  gost2814789_init_key, NULL, gost2814789_set_asn1_params,
		  gost2814789_get_asn1_params, gost2814789_ctl)









#endif







>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|















>
|
>
>
>
|
>
>
>
>
|
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>

182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
	memcpy(ctx->iv, gcp->iv->data, len);

	GOST_CIPHER_PARAMS_free(gcp);

	return 1;
}

static int
gost2814789_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		Gost2814789_ecb_encrypt(in + i, out + i, &((EVP_GOST2814789_CTX *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
gost2814789_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		Gost2814789_cfb64_encrypt(in, out, chunk, &((EVP_GOST2814789_CTX *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
gost2814789_cnt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	EVP_GOST2814789_CTX *c = ctx->cipher_data;

	while (inl >= EVP_MAXCHUNK) {
		Gost2814789_cnt_encrypt(in, out, EVP_MAXCHUNK, &c->ks,
		    ctx->iv, ctx->buf, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		Gost2814789_cnt_encrypt(in, out, inl, &c->ks, ctx->iv, ctx->buf,
		    &ctx->num);
	return 1;
}

/* gost89 is CFB-64 */
#define NID_gost89_cfb64 NID_id_Gost28147_89

static const EVP_CIPHER gost2814789_ecb = {
	.nid = NID_gost89_ecb,
	.block_size = 8,
	.key_len = 32,
	.iv_len = 0,
	.flags = EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT | EVP_CIPH_ECB_MODE,
	.init = gost2814789_init_key,
	.do_cipher = gost2814789_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_GOST2814789_CTX),
	.set_asn1_parameters = gost2814789_set_asn1_params,
	.get_asn1_parameters = gost2814789_get_asn1_params,
	.ctrl = gost2814789_ctl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_gost2814789_ecb(void)
{
	return &gost2814789_ecb;
}

static const EVP_CIPHER gost2814789_cfb64 = {
	.nid = NID_gost89_cfb64,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 8,
	.flags = EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT | EVP_CIPH_CFB_MODE,
	.init = gost2814789_init_key,
	.do_cipher = gost2814789_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_GOST2814789_CTX),
	.set_asn1_parameters = gost2814789_set_asn1_params,
	.get_asn1_parameters = gost2814789_get_asn1_params,
	.ctrl = gost2814789_ctl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_gost2814789_cfb64(void)
{
	return &gost2814789_cfb64;
}

static const EVP_CIPHER gost2814789_cnt = {
	.nid = NID_gost89_cnt,
	.block_size = 1,
	.key_len = 32,
	.iv_len = 8,
	.flags = EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT | EVP_CIPH_OFB_MODE,
	.init = gost2814789_init_key,
	.do_cipher = gost2814789_cnt_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_GOST2814789_CTX),
	.set_asn1_parameters = gost2814789_set_asn1_params,
	.get_asn1_parameters = gost2814789_get_asn1_params,
	.ctrl = gost2814789_ctl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_gost2814789_cnt(void)
{
	return &gost2814789_cnt;
}
#endif
Changes to jni/libressl/crypto/evp/e_idea.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_idea.c,v 1.10 2015/09/10 15:56:25 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_idea.c,v 1.17 2022/09/15 07:04:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */


#include <stdio.h>
#include <string.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_IDEA

#include <openssl/evp.h>
#include <openssl/idea.h>
#include <openssl/objects.h>

#include "evp_locl.h"

static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc);

/* NB idea_ecb_encrypt doesn't take an 'encrypt' argument so we treat it as a special
 * case
 */

static int
idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	BLOCK_CIPHER_ecb_loop()
	idea_ecb_encrypt(in + i, out + i, ctx->cipher_data);
	return 1;
}

/* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */

typedef struct {
	IDEA_KEY_SCHEDULE ks;
} EVP_IDEA_KEY;

BLOCK_CIPHER_func_cbc(idea, idea, EVP_IDEA_KEY, ks)
BLOCK_CIPHER_func_ofb(idea, idea, 64, EVP_IDEA_KEY, ks)
BLOCK_CIPHER_func_cfb(idea, idea, 64, EVP_IDEA_KEY, ks)

BLOCK_CIPHER_defs(idea, IDEA_KEY_SCHEDULE, NID_idea, 8, 16, 8, 64,
    0, idea_init_key, NULL,
    EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)

static int
idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	if (!enc) {
		if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE)
			enc = 1;







>













<
<
<




<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72



73
74
75
76























77
78
79
80
81
82
83
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>
#include <string.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_IDEA

#include <openssl/evp.h>
#include <openssl/idea.h>
#include <openssl/objects.h>

#include "evp_locl.h"




/* NB idea_ecb_encrypt doesn't take an 'encrypt' argument so we treat it as a special
 * case
 */
























static int
idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	if (!enc) {
		if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE)
			enc = 1;
118
119
120
121
122
123
124






































































































































































125
		idea_set_decrypt_key(&tmp, ctx->cipher_data);
		explicit_bzero((unsigned char *)&tmp,
		    sizeof(IDEA_KEY_SCHEDULE));
	}
	return 1;
}







































































































































































#endif







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
		idea_set_decrypt_key(&tmp, ctx->cipher_data);
		explicit_bzero((unsigned char *)&tmp,
		    sizeof(IDEA_KEY_SCHEDULE));
	}
	return 1;
}

static int
idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
    const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		idea_ecb_encrypt(in + i, out + i, ctx->cipher_data);

	return 1;
}

typedef struct {
	IDEA_KEY_SCHEDULE ks;
} EVP_IDEA_KEY;

static int
idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		idea_cbc_encrypt(in, out, (long)chunk, &((EVP_IDEA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		idea_cbc_encrypt(in, out, (long)inl, &((EVP_IDEA_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		idea_ofb64_encrypt(in, out, (long)chunk, &((EVP_IDEA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		idea_ofb64_encrypt(in, out, (long)inl, &((EVP_IDEA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static int
idea_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		idea_cfb64_encrypt(in, out, (long)chunk, &((EVP_IDEA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static const EVP_CIPHER idea_cbc = {
	.nid = NID_idea_cbc,
	.block_size = 8,
	.key_len = 16,
	.iv_len = 8,
	.flags = 0 | EVP_CIPH_CBC_MODE,
	.init = idea_init_key,
	.do_cipher = idea_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(IDEA_KEY_SCHEDULE),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_idea_cbc(void)
{
	return &idea_cbc;
}

static const EVP_CIPHER idea_cfb64 = {
	.nid = NID_idea_cfb64,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 8,
	.flags = 0 | EVP_CIPH_CFB_MODE,
	.init = idea_init_key,
	.do_cipher = idea_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(IDEA_KEY_SCHEDULE),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_idea_cfb64(void)
{
	return &idea_cfb64;
}

static const EVP_CIPHER idea_ofb = {
	.nid = NID_idea_ofb64,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 8,
	.flags = 0 | EVP_CIPH_OFB_MODE,
	.init = idea_init_key,
	.do_cipher = idea_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(IDEA_KEY_SCHEDULE),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_idea_ofb(void)
{
	return &idea_ofb;
}

static const EVP_CIPHER idea_ecb = {
	.nid = NID_idea_ecb,
	.block_size = 8,
	.key_len = 16,
	.iv_len = 0,
	.flags = 0 | EVP_CIPH_ECB_MODE,
	.init = idea_init_key,
	.do_cipher = idea_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(IDEA_KEY_SCHEDULE),
	.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
	.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
	.ctrl = NULL,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_idea_ecb(void)
{
	return &idea_ecb;
}
#endif
Changes to jni/libressl/crypto/evp/e_rc2.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: e_rc2.c,v 1.14 2022/01/20 11:31:37 inoguchi Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: e_rc2.c,v 1.19 2022/09/15 07:04:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
52
53
54
55
56
57
58

59
60
61
62
63
64
65
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */


#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_RC2

#include <openssl/err.h>







>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <limits.h>
#include <stdio.h>

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_RC2

#include <openssl/err.h>
80
81
82
83
84
85
86




87






88

































































89

90
91



92

93










































































94
95
96
97
98
99
100
typedef struct {
	int key_bits;	/* effective key bits */
	RC2_KEY ks;	/* key schedule */
} EVP_RC2_KEY;

#define data(ctx)	((EVP_RC2_KEY *)(ctx)->cipher_data)





IMPLEMENT_BLOCK_CIPHER(rc2, ks, RC2, EVP_RC2_KEY, NID_rc2,






    8,

































































    RC2_KEY_LENGTH, 8, 64,

    EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
    rc2_init_key, NULL,



    rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv,

    rc2_ctrl)











































































#define RC2_40_MAGIC	0xa0
#define RC2_64_MAGIC	0x78
#define RC2_128_MAGIC	0x3a

static const EVP_CIPHER r2_64_cbc_cipher = {
	NID_rc2_64_cbc,







>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
|
>
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
typedef struct {
	int key_bits;	/* effective key bits */
	RC2_KEY ks;	/* key schedule */
} EVP_RC2_KEY;

#define data(ctx)	((EVP_RC2_KEY *)(ctx)->cipher_data)

static int
rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		RC2_cbc_encrypt(in, out, (long)chunk, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		RC2_cbc_encrypt(in, out, (long)inl, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
rc2_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		RC2_cfb64_encrypt(in, out, (long)chunk, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		RC2_ecb_encrypt(in + i, out + i, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = LONG_MAX & ~0xff;

	while (inl >= chunk) {
		RC2_ofb64_encrypt(in, out, (long)chunk, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= chunk;
		in += chunk;
		out += chunk;
	}

	if (inl)
		RC2_ofb64_encrypt(in, out, (long)inl, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static const EVP_CIPHER rc2_cbc = {
	.nid = NID_rc2_cbc,
	.block_size = 8,
	.key_len = RC2_KEY_LENGTH,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT | EVP_CIPH_CBC_MODE,
	.init = rc2_init_key,
	.do_cipher = rc2_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_RC2_KEY),
	.set_asn1_parameters = rc2_set_asn1_type_and_iv,
	.get_asn1_parameters = rc2_get_asn1_type_and_iv,
	.ctrl = rc2_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_rc2_cbc(void)
{
	return &rc2_cbc;
}

static const EVP_CIPHER rc2_cfb64 = {
	.nid = NID_rc2_cfb64,
	.block_size = 1,
	.key_len = RC2_KEY_LENGTH,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT | EVP_CIPH_CFB_MODE,
	.init = rc2_init_key,
	.do_cipher = rc2_cfb64_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_RC2_KEY),
	.set_asn1_parameters = rc2_set_asn1_type_and_iv,
	.get_asn1_parameters = rc2_get_asn1_type_and_iv,
	.ctrl = rc2_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_rc2_cfb64(void)
{
	return &rc2_cfb64;
}

static const EVP_CIPHER rc2_ofb = {
	.nid = NID_rc2_ofb64,
	.block_size = 1,
	.key_len = RC2_KEY_LENGTH,
	.iv_len = 8,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT | EVP_CIPH_OFB_MODE,
	.init = rc2_init_key,
	.do_cipher = rc2_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_RC2_KEY),
	.set_asn1_parameters = rc2_set_asn1_type_and_iv,
	.get_asn1_parameters = rc2_get_asn1_type_and_iv,
	.ctrl = rc2_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_rc2_ofb(void)
{
	return &rc2_ofb;
}

static const EVP_CIPHER rc2_ecb = {
	.nid = NID_rc2_ecb,
	.block_size = 8,
	.key_len = RC2_KEY_LENGTH,
	.iv_len = 0,
	.flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT | EVP_CIPH_ECB_MODE,
	.init = rc2_init_key,
	.do_cipher = rc2_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_RC2_KEY),
	.set_asn1_parameters = rc2_set_asn1_type_and_iv,
	.get_asn1_parameters = rc2_get_asn1_type_and_iv,
	.ctrl = rc2_ctrl,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_rc2_ecb(void)
{
	return &rc2_ecb;
}

#define RC2_40_MAGIC	0xa0
#define RC2_64_MAGIC	0x78
#define RC2_128_MAGIC	0x3a

static const EVP_CIPHER r2_64_cbc_cipher = {
	NID_rc2_64_cbc,
Changes to jni/libressl/crypto/evp/e_sm4.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: e_sm4.c,v 1.1 2019/03/17 17:42:37 tb Exp $	*/
/*
 * Copyright (c) 2017, 2019 Ribose Inc
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: e_sm4.c,v 1.6 2022/09/10 17:39:47 jsing Exp $	*/
/*
 * Copyright (c) 2017, 2019 Ribose Inc
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
70
71
72
73
74
75
76









77

































































78

















































































79
80
81
82
83
84
85
86
87
88
89
90
91
sm4_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length,
    const SM4_KEY *key, unsigned char *ivec, int *num)
{
	CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num,
	    (block128_f)SM4_encrypt);
}










IMPLEMENT_BLOCK_CIPHER(sm4, ks, sm4, EVP_SM4_KEY, NID_sm4, 16, 16, 16, 128,

































































    EVP_CIPH_FLAG_DEFAULT_ASN1, sm4_init_key, NULL, 0, 0, 0)


















































































static int
sm4_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
    size_t len)
{
	EVP_SM4_KEY *key = EVP_C_DATA(EVP_SM4_KEY, ctx);

	CRYPTO_ctr128_encrypt(in, out, len, &key->ks, ctx->iv, ctx->buf,
	    &ctx->num, (block128_f)SM4_encrypt);
	return 1;
}

static const EVP_CIPHER sm4_ctr_mode = {







>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
sm4_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length,
    const SM4_KEY *key, unsigned char *ivec, int *num)
{
	CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num,
	    (block128_f)SM4_encrypt);
}

static int
sm4_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		sm4_cbc_encrypt(in, out, EVP_MAXCHUNK, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		sm4_cbc_encrypt(in, out, inl, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);

	return 1;
}

static int
sm4_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t chunk = EVP_MAXCHUNK;

	if (inl < chunk)
		chunk = inl;

	while (inl && inl >= chunk) {
		sm4_cfb128_encrypt(in, out, chunk, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
		inl -= chunk;
		in += chunk;
		out += chunk;
		if (inl < chunk)
			chunk = inl;
	}

	return 1;
}

static int
sm4_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	size_t i, bl;

	bl = ctx->cipher->block_size;

	if (inl < bl)
		return 1;

	inl -= bl;

	for (i = 0; i <= inl; i += bl)
		sm4_ecb_encrypt(in + i, out + i, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->encrypt);

	return 1;
}

static int
sm4_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
{
	while (inl >= EVP_MAXCHUNK) {
		sm4_ofb128_encrypt(in, out, EVP_MAXCHUNK, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);
		inl -= EVP_MAXCHUNK;
		in += EVP_MAXCHUNK;
		out += EVP_MAXCHUNK;
	}

	if (inl)
		sm4_ofb128_encrypt(in, out, inl, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);

	return 1;
}

static const EVP_CIPHER sm4_cbc = {
	.nid = NID_sm4_cbc,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
	.init = sm4_init_key,
	.do_cipher = sm4_cbc_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_SM4_KEY),
	.set_asn1_parameters = 0,
	.get_asn1_parameters = 0,
	.ctrl = 0,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_sm4_cbc(void)
{
	return &sm4_cbc;
}

static const EVP_CIPHER sm4_cfb128 = {
	.nid = NID_sm4_cfb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
	.init = sm4_init_key,
	.do_cipher = sm4_cfb128_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_SM4_KEY),
	.set_asn1_parameters = 0,
	.get_asn1_parameters = 0,
	.ctrl = 0,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_sm4_cfb128(void)
{
	return &sm4_cfb128;
}

static const EVP_CIPHER sm4_ofb = {
	.nid = NID_sm4_ofb128,
	.block_size = 1,
	.key_len = 16,
	.iv_len = 16,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
	.init = sm4_init_key,
	.do_cipher = sm4_ofb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_SM4_KEY),
	.set_asn1_parameters = 0,
	.get_asn1_parameters = 0,
	.ctrl = 0,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_sm4_ofb(void)
{
	return &sm4_ofb;
}

static const EVP_CIPHER sm4_ecb = {
	.nid = NID_sm4_ecb,
	.block_size = 16,
	.key_len = 16,
	.iv_len = 0,
	.flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
	.init = sm4_init_key,
	.do_cipher = sm4_ecb_cipher,
	.cleanup = NULL,
	.ctx_size = sizeof(EVP_SM4_KEY),
	.set_asn1_parameters = 0,
	.get_asn1_parameters = 0,
	.ctrl = 0,
	.app_data = NULL,
};

const EVP_CIPHER *
EVP_sm4_ecb(void)
{
	return &sm4_ecb;
}

static int
sm4_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
    size_t len)
{
	EVP_SM4_KEY *key = ((EVP_SM4_KEY *)(ctx)->cipher_data);

	CRYPTO_ctr128_encrypt(in, out, len, &key->ks, ctx->iv, ctx->buf,
	    &ctx->num, (block128_f)SM4_encrypt);
	return 1;
}

static const EVP_CIPHER sm4_ctr_mode = {
105
106
107
108
109
110
111
112
113
};

const EVP_CIPHER *
EVP_sm4_ctr(void)
{
	return &sm4_ctr_mode;
}

#endif







<

260
261
262
263
264
265
266

267
};

const EVP_CIPHER *
EVP_sm4_ctr(void)
{
	return &sm4_ctr_mode;
}

#endif
Changes to jni/libressl/crypto/evp/evp_enc.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: evp_enc.c,v 1.44 2021/02/18 19:12:29 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: evp_enc.c,v 1.47 2022/09/13 04:59:18 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif

#include "evp_locl.h"

#define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in, inl)

int
EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
    const unsigned char *key, const unsigned char *iv, int enc)
{
	if (cipher)
		EVP_CIPHER_CTX_init(ctx);
	return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);







<
<







70
71
72
73
74
75
76


77
78
79
80
81
82
83

#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif

#include "evp_locl.h"



int
EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
    const unsigned char *key, const unsigned char *iv, int enc)
{
	if (cipher)
		EVP_CIPHER_CTX_init(ctx);
	return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
295
296
297
298
299
300
301
302








303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
}

int
EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
    const unsigned char *in, int inl)
{
	int i, j, bl;









	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		i = M_do_cipher(ctx, out, in, inl);
		if (i < 0)
			return 0;
		else
			*outl = i;
		return 1;
	}

	if (inl <= 0) {
		*outl = 0;
		return inl == 0;
	}

	if (ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0) {
		if (M_do_cipher(ctx, out, in, inl)) {
			*outl = inl;
			return 1;
		} else {
			*outl = 0;
			return 0;
		}
	}








>
>
>
>
>
>
>
>

|







<
<
<
<
<

|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317





318
319
320
321
322
323
324
325
326
}

int
EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
    const unsigned char *in, int inl)
{
	int i, j, bl;

	*outl = 0;

	if (inl < 0)
		return 0;

	if (inl == 0 && EVP_CIPHER_mode(ctx->cipher) != EVP_CIPH_CCM_MODE)
		return 1;

	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		i = ctx->cipher->do_cipher(ctx, out, in, inl);
		if (i < 0)
			return 0;
		else
			*outl = i;
		return 1;
	}






	if (ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0) {
		if (ctx->cipher->do_cipher(ctx, out, in, inl)) {
			*outl = inl;
			return 1;
		} else {
			*outl = 0;
			return 0;
		}
	}
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
			 * the block processed from ctx-buf doesn't overflow.
			 */
			if (((inl - j) & ~(bl - 1)) > INT_MAX - bl) {
				EVPerror(EVP_R_TOO_LARGE);
				return 0;
			}
			memcpy(&(ctx->buf[i]), in, j);
			if (!M_do_cipher(ctx, out, ctx->buf, bl))
				return 0;
			inl -= j;
			in += j;
			out += bl;
			*outl = bl;
		}
	} else
		*outl = 0;
	i = inl&(bl - 1);
	inl -= i;
	if (inl > 0) {
		if (!M_do_cipher(ctx, out, in, inl))
			return 0;
		*outl += inl;
	}

	if (i != 0)
		memcpy(ctx->buf, &(in[inl]), i);
	ctx->buf_len = i;







|











|







347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
			 * the block processed from ctx-buf doesn't overflow.
			 */
			if (((inl - j) & ~(bl - 1)) > INT_MAX - bl) {
				EVPerror(EVP_R_TOO_LARGE);
				return 0;
			}
			memcpy(&(ctx->buf[i]), in, j);
			if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl))
				return 0;
			inl -= j;
			in += j;
			out += bl;
			*outl = bl;
		}
	} else
		*outl = 0;
	i = inl&(bl - 1);
	inl -= i;
	if (inl > 0) {
		if (!ctx->cipher->do_cipher(ctx, out, in, inl))
			return 0;
		*outl += inl;
	}

	if (i != 0)
		memcpy(ctx->buf, &(in[inl]), i);
	ctx->buf_len = i;
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
int
EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{
	int n, ret;
	unsigned int i, b, bl;

	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		ret = M_do_cipher(ctx, out, NULL, 0);
		if (ret < 0)
			return 0;
		else
			*outl = ret;
		return 1;
	}








|







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
int
EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{
	int n, ret;
	unsigned int i, b, bl;

	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		ret = ctx->cipher->do_cipher(ctx, out, NULL, 0);
		if (ret < 0)
			return 0;
		else
			*outl = ret;
		return 1;
	}

418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440








441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
		*outl = 0;
		return 1;
	}

	n = b - bl;
	for (i = bl; i < b; i++)
		ctx->buf[i] = n;
	ret = M_do_cipher(ctx, out, ctx->buf, b);


	if (ret)
		*outl = b;

	return ret;
}

int
EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
    const unsigned char *in, int inl)
{
	int fix_len;
	unsigned int b;









	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		fix_len = M_do_cipher(ctx, out, in, inl);
		if (fix_len < 0) {
			*outl = 0;
			return 0;
		} else
			*outl = fix_len;
		return 1;
	}

	if (inl <= 0) {
		*outl = 0;
		return inl == 0;
	}

	if (ctx->flags & EVP_CIPH_NO_PADDING)
		return EVP_EncryptUpdate(ctx, out, outl, in, inl);

	b = ctx->cipher->block_size;
	if (b > sizeof ctx->final) {
		EVPerror(EVP_R_BAD_BLOCK_LENGTH);
		return 0;







|















>
>
>
>
>
>
>
>

|








<
<
<
<
<







419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459





460
461
462
463
464
465
466
		*outl = 0;
		return 1;
	}

	n = b - bl;
	for (i = bl; i < b; i++)
		ctx->buf[i] = n;
	ret = ctx->cipher->do_cipher(ctx, out, ctx->buf, b);


	if (ret)
		*outl = b;

	return ret;
}

int
EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
    const unsigned char *in, int inl)
{
	int fix_len;
	unsigned int b;

	*outl = 0;

	if (inl < 0)
		return 0;

	if (inl == 0 && EVP_CIPHER_mode(ctx->cipher) != EVP_CIPH_CCM_MODE)
		return 1;

	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		fix_len = ctx->cipher->do_cipher(ctx, out, in, inl);
		if (fix_len < 0) {
			*outl = 0;
			return 0;
		} else
			*outl = fix_len;
		return 1;
	}






	if (ctx->flags & EVP_CIPH_NO_PADDING)
		return EVP_EncryptUpdate(ctx, out, outl, in, inl);

	b = ctx->cipher->block_size;
	if (b > sizeof ctx->final) {
		EVPerror(EVP_R_BAD_BLOCK_LENGTH);
		return 0;
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{
	int i, n;
	unsigned int b;
	*outl = 0;

	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		i = M_do_cipher(ctx, out, NULL, 0);
		if (i < 0)
			return 0;
		else
			*outl = i;
		return 1;
	}








|







518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{
	int i, n;
	unsigned int b;
	*outl = 0;

	if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
		i = ctx->cipher->do_cipher(ctx, out, NULL, 0);
		if (i < 0)
			return 0;
		else
			*outl = i;
		return 1;
	}

593
594
595
596
597
598
599
600
601
602
603
604
605

606
607

608
609
610

611

612
613
614
615
616
617
618
	return EVP_CIPHER_CTX_cleanup(a);
}

int
EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
{
	if (c->cipher != NULL) {
		if (c->cipher->cleanup && !c->cipher->cleanup(c))
			return 0;
		/* Cleanse cipher context data */
		if (c->cipher_data)
			explicit_bzero(c->cipher_data, c->cipher->ctx_size);
	}

	/* XXX - store size of cipher_data so we can always freezero(). */
	free(c->cipher_data);

#ifndef OPENSSL_NO_ENGINE
	ENGINE_finish(c->engine);
#endif

	explicit_bzero(c, sizeof(EVP_CIPHER_CTX));

	return 1;
}

int
EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)
{
	if (c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)







|
<
|
|


>


>



>

>







597
598
599
600
601
602
603
604

605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
	return EVP_CIPHER_CTX_cleanup(a);
}

int
EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
{
	if (c->cipher != NULL) {
		if (c->cipher->cleanup != NULL)

			c->cipher->cleanup(c);
		if (c->cipher_data != NULL)
			explicit_bzero(c->cipher_data, c->cipher->ctx_size);
	}

	/* XXX - store size of cipher_data so we can always freezero(). */
	free(c->cipher_data);

#ifndef OPENSSL_NO_ENGINE
	ENGINE_finish(c->engine);
#endif

	explicit_bzero(c, sizeof(EVP_CIPHER_CTX));

	return 1;
}

int
EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)
{
	if (c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)
Changes to jni/libressl/crypto/evp/evp_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: evp_err.c,v 1.27 2021/03/29 15:57:23 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: evp_err.c,v 1.28 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/evp.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason)

static ERR_STRING_DATA EVP_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/evp.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason)

static ERR_STRING_DATA EVP_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/evp/evp_locl.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: evp_locl.h,v 1.22 2022/01/14 08:38:05 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: evp_locl.h,v 1.28 2022/09/13 04:59:18 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	int key_len;		/* Default value for variable length ciphers */
	int iv_len;
	unsigned long flags;	/* Various flags */
	int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
	    const unsigned char *iv, int enc);	/* init key */
	int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
	    const unsigned char *in, size_t inl);/* encrypt/decrypt data */
	int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
	int ctx_size;		/* how big ctx->cipher_data needs to be */
	int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
	int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
	int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
	void *app_data;		/* Application data */
} /* EVP_CIPHER */;








|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	int key_len;		/* Default value for variable length ciphers */
	int iv_len;
	unsigned long flags;	/* Various flags */
	int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
	    const unsigned char *iv, int enc);	/* init key */
	int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
	    const unsigned char *in, size_t inl);/* encrypt/decrypt data */
	void (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
	int ctx_size;		/* how big ctx->cipher_data needs to be */
	int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
	int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
	int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
	void *app_data;		/* Application data */
} /* EVP_CIPHER */;

180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
			 * the length is adjusted up each time a longer
			 * line is decoded */
	unsigned char enc_data[80];	/* data to encode */
	int line_num;	/* number read on current line */
	int expect_nl;
} /* EVP_ENCODE_CTX */;

/* Macros to code block cipher wrappers */

/* Wrapper functions for each cipher mode */

#define BLOCK_CIPHER_ecb_loop() \
	size_t i, bl; \
	bl = ctx->cipher->block_size;\
	if(inl < bl) return 1;\
	inl -= bl; \
	for(i=0; i <= inl; i+=bl)

#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
{\
	BLOCK_CIPHER_ecb_loop() \
		cprefix##_ecb_encrypt(in + i, out + i, &((kstruct *)ctx->cipher_data)->ksched, ctx->encrypt);\
	return 1;\
}

#define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2))

#define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \
static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
{\
	while(inl>=EVP_MAXCHUNK)\
	    {\
	    cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\
	    inl-=EVP_MAXCHUNK;\
	    in +=EVP_MAXCHUNK;\
	    out+=EVP_MAXCHUNK;\
	    }\
	if (inl)\
	    cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\
	return 1;\
}

#define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
{\
	while(inl>=EVP_MAXCHUNK) \
	    {\
	    cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\
	    inl-=EVP_MAXCHUNK;\
	    in +=EVP_MAXCHUNK;\
	    out+=EVP_MAXCHUNK;\
	    }\
	if (inl)\
	    cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\
	return 1;\
}

#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
{\
	size_t chunk=EVP_MAXCHUNK;\
	if (cbits==1)  chunk>>=3;\
	if (inl<chunk) chunk=inl;\
	while(inl && inl>=chunk)\
	    {\
            cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits==1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
	    inl-=chunk;\
	    in +=chunk;\
	    out+=chunk;\
	    if(inl<chunk) chunk=inl;\
	    }\
	return 1;\
}

#define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
	BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
	BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
	BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
	BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched)

#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
			  key_len, iv_len, flags, init_key, cleanup, \
			  set_asn1, get_asn1, ctrl) \
static const EVP_CIPHER cname##_##mode = { \
	nid##_##nmode, block_size, key_len, iv_len, \
	flags | EVP_CIPH_##MODE##_MODE, \
	init_key, \
	cname##_##mode##_cipher, \
	cleanup, \
	sizeof(kstruct), \
	set_asn1, get_asn1,\
	ctrl, \
	NULL \
}; \
const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }

#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \
			     iv_len, flags, init_key, cleanup, set_asn1, \
			     get_asn1, ctrl) \
BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
		  iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)

#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \
			     iv_len, cbits, flags, init_key, cleanup, \
			     set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \
		  key_len, iv_len, flags, init_key, cleanup, set_asn1, \
		  get_asn1, ctrl)

#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, \
			     iv_len, cbits, flags, init_key, cleanup, \
			     set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \
		  key_len, iv_len, flags, init_key, cleanup, set_asn1, \
		  get_asn1, ctrl)

#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
			     flags, init_key, cleanup, set_asn1, \
			     get_asn1, ctrl) \
BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
		  0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)

#define BLOCK_CIPHER_defs(cname, kstruct, \
			  nid, block_size, key_len, iv_len, cbits, flags, \
			  init_key, cleanup, set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
		     init_key, cleanup, set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \
		     flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
		     flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \
		     init_key, cleanup, set_asn1, get_asn1, ctrl)


/*
#define BLOCK_CIPHER_defs(cname, kstruct, \
				nid, block_size, key_len, iv_len, flags,\
				 init_key, cleanup, set_asn1, get_asn1, ctrl)\
static const EVP_CIPHER cname##_cbc = {\
	nid##_cbc, block_size, key_len, iv_len, \
	flags | EVP_CIPH_CBC_MODE,\
	init_key,\
	cname##_cbc_cipher,\
	cleanup,\
	sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
		sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
	set_asn1, get_asn1,\
	ctrl, \
	NULL \
};\
const EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\
static const EVP_CIPHER cname##_cfb = {\
	nid##_cfb64, 1, key_len, iv_len, \
	flags | EVP_CIPH_CFB_MODE,\
	init_key,\
	cname##_cfb_cipher,\
	cleanup,\
	sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
		sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
	set_asn1, get_asn1,\
	ctrl,\
	NULL \
};\
const EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\
static const EVP_CIPHER cname##_ofb = {\
	nid##_ofb64, 1, key_len, iv_len, \
	flags | EVP_CIPH_OFB_MODE,\
	init_key,\
	cname##_ofb_cipher,\
	cleanup,\
	sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
		sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
	set_asn1, get_asn1,\
	ctrl,\
	NULL \
};\
const EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\
static const EVP_CIPHER cname##_ecb = {\
	nid##_ecb, block_size, key_len, iv_len, \
	flags | EVP_CIPH_ECB_MODE,\
	init_key,\
	cname##_ecb_cipher,\
	cleanup,\
	sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
		sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
	set_asn1, get_asn1,\
	ctrl,\
	NULL \
};\
const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
*/

#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
			       block_size, key_len, iv_len, cbits, \
			       flags, init_key, \
			       cleanup, set_asn1, get_asn1, ctrl) \
	BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
	BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
			  cbits, flags, init_key, cleanup, set_asn1, \
			  get_asn1, ctrl)

#define EVP_C_DATA(kstruct, ctx)	((kstruct *)(ctx)->cipher_data)

#define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len) \
	BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \
	BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \
			     NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \
			     0, cipher##_init_key, NULL, \
			     EVP_CIPHER_set_asn1_iv, \
			     EVP_CIPHER_get_asn1_iv, \
			     NULL)

struct evp_pkey_ctx_st {
	/* Method associated with this operation */
	const EVP_PKEY_METHOD *pmeth;
	/* Engine that implements this method or NULL if builtin */
	ENGINE *engine;
	/* Key: may be NULL */
	EVP_PKEY *pkey;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







180
181
182
183
184
185
186



















187
188


























































































































































































189
190
191
192
193
194
195
			 * the length is adjusted up each time a longer
			 * line is decoded */
	unsigned char enc_data[80];	/* data to encode */
	int line_num;	/* number read on current line */
	int expect_nl;
} /* EVP_ENCODE_CTX */;




















#define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2))



























































































































































































struct evp_pkey_ctx_st {
	/* Method associated with this operation */
	const EVP_PKEY_METHOD *pmeth;
	/* Engine that implements this method or NULL if builtin */
	ENGINE *engine;
	/* Key: may be NULL */
	EVP_PKEY *pkey;
501
502
503
504
505
506
507


508
509
510
511
512
 * and message-independent IV. */
struct evp_aead_ctx_st {
	const EVP_AEAD *aead;
	/* aead_state is an opaque pointer to the AEAD specific state. */
	void *aead_state;
};



int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md_name);

__END_HIDDEN_DECLS

#endif /* !HEADER_EVP_LOCL_H */







>
>





296
297
298
299
300
301
302
303
304
305
306
307
308
309
 * and message-independent IV. */
struct evp_aead_ctx_st {
	const EVP_AEAD *aead;
	/* aead_state is an opaque pointer to the AEAD specific state. */
	void *aead_state;
};

int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str);
int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex);
int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md_name);

__END_HIDDEN_DECLS

#endif /* !HEADER_EVP_LOCL_H */
Changes to jni/libressl/crypto/evp/p_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p_lib.c,v 1.28 2022/01/20 11:06:24 inoguchi Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p_lib.c,v 1.29 2022/06/27 12:36:05 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
89
90
91
92
93
94
95











96
97
98
99
100
101
102
int
EVP_PKEY_bits(const EVP_PKEY *pkey)
{
	if (pkey && pkey->ameth && pkey->ameth->pkey_bits)
		return pkey->ameth->pkey_bits(pkey);
	return 0;
}












int
EVP_PKEY_size(const EVP_PKEY *pkey)
{
	if (pkey && pkey->ameth && pkey->ameth->pkey_size)
		return pkey->ameth->pkey_size(pkey);
	return 0;







>
>
>
>
>
>
>
>
>
>
>







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
int
EVP_PKEY_bits(const EVP_PKEY *pkey)
{
	if (pkey && pkey->ameth && pkey->ameth->pkey_bits)
		return pkey->ameth->pkey_bits(pkey);
	return 0;
}

int
EVP_PKEY_security_bits(const EVP_PKEY *pkey)
{
	if (pkey == NULL)
		return 0;
	if (pkey->ameth == NULL || pkey->ameth->pkey_security_bits == NULL)
		return -2;

	return pkey->ameth->pkey_security_bits(pkey);
}

int
EVP_PKEY_size(const EVP_PKEY *pkey)
{
	if (pkey && pkey->ameth && pkey->ameth->pkey_size)
		return pkey->ameth->pkey_size(pkey);
	return 0;
Changes to jni/libressl/crypto/evp/pmeth_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: pmeth_lib.c,v 1.20 2022/01/10 12:10:26 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pmeth_lib.c,v 1.22 2022/05/05 08:51:21 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/objects.h>


#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif

#include "asn1_locl.h"
#include "evp_locl.h"

typedef int sk_cmp_fn_type(const char * const *a, const char * const *b);

DECLARE_STACK_OF(EVP_PKEY_METHOD)
STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL;

extern const EVP_PKEY_METHOD rsa_pkey_meth, rsa_pss_pkey_meth;
extern const EVP_PKEY_METHOD dh_pkey_meth, dsa_pkey_meth;
extern const EVP_PKEY_METHOD ec_pkey_meth, hmac_pkey_meth, cmac_pkey_meth;
extern const EVP_PKEY_METHOD gostimit_pkey_meth, gostr01_pkey_meth;


static const EVP_PKEY_METHOD *standard_methods[] = {
#ifndef OPENSSL_NO_RSA
	&rsa_pkey_meth,
#endif
#ifndef OPENSSL_NO_DH
	&dh_pkey_meth,







>









>

















>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509v3.h>

#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif

#include "asn1_locl.h"
#include "evp_locl.h"

typedef int sk_cmp_fn_type(const char * const *a, const char * const *b);

DECLARE_STACK_OF(EVP_PKEY_METHOD)
STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL;

extern const EVP_PKEY_METHOD rsa_pkey_meth, rsa_pss_pkey_meth;
extern const EVP_PKEY_METHOD dh_pkey_meth, dsa_pkey_meth;
extern const EVP_PKEY_METHOD ec_pkey_meth, hmac_pkey_meth, cmac_pkey_meth;
extern const EVP_PKEY_METHOD gostimit_pkey_meth, gostr01_pkey_meth;
extern const EVP_PKEY_METHOD hkdf_pkey_meth;

static const EVP_PKEY_METHOD *standard_methods[] = {
#ifndef OPENSSL_NO_RSA
	&rsa_pkey_meth,
#endif
#ifndef OPENSSL_NO_DH
	&dh_pkey_meth,
101
102
103
104
105
106
107

108
109
110
111
112
113
114
	&gostimit_pkey_meth,
#endif
	&hmac_pkey_meth,
	&cmac_pkey_meth,
#ifndef OPENSSL_NO_RSA
	&rsa_pss_pkey_meth,
#endif

};

static int pmeth_cmp_BSEARCH_CMP_FN(const void *, const void *);
static int pmeth_cmp(const EVP_PKEY_METHOD * const *, const EVP_PKEY_METHOD * const *);
static const EVP_PKEY_METHOD * *OBJ_bsearch_pmeth(const EVP_PKEY_METHOD * *key, const EVP_PKEY_METHOD * const *base, int num);

static int







>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	&gostimit_pkey_meth,
#endif
	&hmac_pkey_meth,
	&cmac_pkey_meth,
#ifndef OPENSSL_NO_RSA
	&rsa_pss_pkey_meth,
#endif
	&hkdf_pkey_meth,
};

static int pmeth_cmp_BSEARCH_CMP_FN(const void *, const void *);
static int pmeth_cmp(const EVP_PKEY_METHOD * const *, const EVP_PKEY_METHOD * const *);
static const EVP_PKEY_METHOD * *OBJ_bsearch_pmeth(const EVP_PKEY_METHOD * *key, const EVP_PKEY_METHOD * const *base, int num);

static int
389
390
391
392
393
394
395
































396
397
398
399
400
401
402
	}
	if (!strcmp(name, "digest")) {
		return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG,
		    EVP_PKEY_CTRL_MD, value);
	}
	return ctx->pmeth->ctrl_str(ctx, name, value);
}

































int
EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md_name)
{
	const EVP_MD *md;

	if ((md = EVP_get_digestbyname(md_name)) == NULL) {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
	}
	if (!strcmp(name, "digest")) {
		return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG,
		    EVP_PKEY_CTRL_MD, value);
	}
	return ctx->pmeth->ctrl_str(ctx, name, value);
}

int
EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str)
{
	size_t len;

	if ((len = strlen(str)) > INT_MAX)
		return -1;

	return ctx->pmeth->ctrl(ctx, cmd, len, (void *)str);
}

int
EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hexstr)
{
	unsigned char *hex = NULL;
	long length;
	int ret = 0;

	if ((hex = string_to_hex(hexstr, &length)) == NULL)
		goto err;
	if (length < 0 || length > INT_MAX) {
		ret = -1;
		goto err;
	}

	ret = ctx->pmeth->ctrl(ctx, cmd, length, hex);

 err:
	free(hex);
	return ret;
}

int
EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md_name)
{
	const EVP_MD *md;

	if ((md = EVP_get_digestbyname(md_name)) == NULL) {
Changes to jni/libressl/crypto/gost/gost_err.c.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>
#include <openssl/err.h>
#include <openssl/gost.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_GOST,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_GOST,0,reason)

static ERR_STRING_DATA GOST_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<




<







49
50
51
52
53
54
55





56
57
58
59

60
61
62
63
64
65
66
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>
#include <openssl/err.h>
#include <openssl/gost.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_GOST,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_GOST,0,reason)

static ERR_STRING_DATA GOST_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/hmac/hmac.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: hmac.c,v 1.27 2021/12/12 21:30:14 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: hmac.c,v 1.28 2022/05/05 18:29:34 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
257
258
259
260
261
262
263

264
265
266




267
268
269
270
271
272
273
274
275
276
277
278
279

unsigned char *
HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *d,
    size_t n, unsigned char *md, unsigned int *md_len)
{
	HMAC_CTX c;
	static unsigned char m[EVP_MAX_MD_SIZE];


	if (md == NULL)
		md = m;




	HMAC_CTX_init(&c);
	if (!HMAC_Init(&c, key, key_len, evp_md))
		goto err;
	if (!HMAC_Update(&c, d, n))
		goto err;
	if (!HMAC_Final(&c, md, md_len))
		goto err;
	HMAC_CTX_cleanup(&c);
	return md;
err:
	HMAC_CTX_cleanup(&c);
	return NULL;
}







>



>
>
>
>

|











257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284

unsigned char *
HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *d,
    size_t n, unsigned char *md, unsigned int *md_len)
{
	HMAC_CTX c;
	static unsigned char m[EVP_MAX_MD_SIZE];
	const unsigned char dummy_key[1] = { 0 };

	if (md == NULL)
		md = m;
	if (key == NULL) {
		key = dummy_key;
		key_len = 0;
	}
	HMAC_CTX_init(&c);
	if (!HMAC_Init_ex(&c, key, key_len, evp_md, NULL))
		goto err;
	if (!HMAC_Update(&c, d, n))
		goto err;
	if (!HMAC_Final(&c, md, md_len))
		goto err;
	HMAC_CTX_cleanup(&c);
	return md;
err:
	HMAC_CTX_cleanup(&c);
	return NULL;
}
Added jni/libressl/crypto/kdf/hkdf_evp.c.


























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*	$OpenBSD: hkdf_evp.c,v 1.18 2022/05/05 19:48:06 tb Exp $ */
/* ====================================================================
 * Copyright (c) 2016-2018 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    openssl-core@openssl.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <stdlib.h>
#include <string.h>

#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/hkdf.h>
#include <openssl/kdf.h>

#include "evp_locl.h"

#define HKDF_MAXBUF 1024

typedef struct {
	int mode;
	const EVP_MD *md;
	unsigned char *salt;
	size_t salt_len;
	unsigned char *key;
	size_t key_len;
	unsigned char info[HKDF_MAXBUF];
	size_t info_len;
} HKDF_PKEY_CTX;

static int
pkey_hkdf_init(EVP_PKEY_CTX *ctx)
{
	HKDF_PKEY_CTX *kctx;

	if ((kctx = calloc(1, sizeof(*kctx))) == NULL) {
		KDFerror(ERR_R_MALLOC_FAILURE);
		return 0;
	}

	ctx->data = kctx;

	return 1;
}

static void
pkey_hkdf_cleanup(EVP_PKEY_CTX *ctx)
{
	HKDF_PKEY_CTX *kctx = ctx->data;

	freezero(kctx->salt, kctx->salt_len);
	freezero(kctx->key, kctx->key_len);
	freezero(kctx, sizeof(*kctx));
}

static int
pkey_hkdf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
{
	HKDF_PKEY_CTX *kctx = ctx->data;

	switch (type) {
	case EVP_PKEY_CTRL_HKDF_MD:
		if (p2 == NULL)
			return 0;

		kctx->md = p2;
		return 1;

	case EVP_PKEY_CTRL_HKDF_MODE:
		kctx->mode = p1;
		return 1;

	case EVP_PKEY_CTRL_HKDF_SALT:
		if (p1 == 0 || p2 == NULL)
			return 1;

		if (p1 < 0)
			return 0;

		freezero(kctx->salt, kctx->salt_len);
		if ((kctx->salt = malloc(p1)) == NULL)
			return 0;
		memcpy(kctx->salt, p2, p1);

		kctx->salt_len = p1;
		return 1;

	case EVP_PKEY_CTRL_HKDF_KEY:
		if (p1 <= 0)
			return 0;

		freezero(kctx->key, kctx->key_len);
		if ((kctx->key = malloc(p1)) == NULL)
			return 0;
		memcpy(kctx->key, p2, p1);

		kctx->key_len = p1;
		return 1;

	case EVP_PKEY_CTRL_HKDF_INFO:
		if (p1 == 0 || p2 == NULL)
			return 1;

		if (p1 < 0 || p1 > (int)(HKDF_MAXBUF - kctx->info_len))
			return 0;

		memcpy(kctx->info + kctx->info_len, p2, p1);
		kctx->info_len += p1;
		return 1;

	default:
		return -2;
	}
}

static int
pkey_hkdf_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
    const char *value)
{
	if (strcmp(type, "mode") == 0) {
		int mode;

		if (strcmp(value, "EXTRACT_AND_EXPAND") == 0)
			mode = EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND;
		else if (strcmp(value, "EXTRACT_ONLY") == 0)
			mode = EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY;
		else if (strcmp(value, "EXPAND_ONLY") == 0)
			mode = EVP_PKEY_HKDEF_MODE_EXPAND_ONLY;
		else
			return 0;

		return EVP_PKEY_CTX_hkdf_mode(ctx, mode);
	}

	if (strcmp(type, "md") == 0)
		return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_DERIVE,
		    EVP_PKEY_CTRL_HKDF_MD, value);

	if (strcmp(type, "salt") == 0)
		return EVP_PKEY_CTX_str2ctrl(ctx, EVP_PKEY_CTRL_HKDF_SALT,
		    value);

	if (strcmp(type, "hexsalt") == 0)
		return EVP_PKEY_CTX_hex2ctrl(ctx, EVP_PKEY_CTRL_HKDF_SALT,
		    value);

	if (strcmp(type, "key") == 0)
		return EVP_PKEY_CTX_str2ctrl(ctx, EVP_PKEY_CTRL_HKDF_KEY, value);

	if (strcmp(type, "hexkey") == 0)
		return EVP_PKEY_CTX_hex2ctrl(ctx, EVP_PKEY_CTRL_HKDF_KEY, value);

	if (strcmp(type, "info") == 0)
		return EVP_PKEY_CTX_str2ctrl(ctx, EVP_PKEY_CTRL_HKDF_INFO,
		    value);

	if (strcmp(type, "hexinfo") == 0)
		return EVP_PKEY_CTX_hex2ctrl(ctx, EVP_PKEY_CTRL_HKDF_INFO,
		    value);

	KDFerror(KDF_R_UNKNOWN_PARAMETER_TYPE);
	return -2;
}

static int
pkey_hkdf_derive_init(EVP_PKEY_CTX *ctx)
{
	HKDF_PKEY_CTX *kctx = ctx->data;

	freezero(kctx->key, kctx->key_len);
	freezero(kctx->salt, kctx->salt_len);
	explicit_bzero(kctx, sizeof(*kctx));

	return 1;
}

static int
pkey_hkdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
    size_t *keylen)
{
	HKDF_PKEY_CTX *kctx = ctx->data;

	if (kctx->md == NULL) {
		KDFerror(KDF_R_MISSING_MESSAGE_DIGEST);
		return 0;
	}
	if (kctx->key == NULL) {
		KDFerror(KDF_R_MISSING_KEY);
		return 0;
	}

	switch (kctx->mode) {
	case EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND:
		return HKDF(key, *keylen, kctx->md, kctx->key, kctx->key_len,
		    kctx->salt, kctx->salt_len, kctx->info, kctx->info_len);

	case EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY:
		if (key == NULL) {
			*keylen = EVP_MD_size(kctx->md);
			return 1;
		}
		return HKDF_extract(key, keylen, kctx->md, kctx->key,
		    kctx->key_len, kctx->salt, kctx->salt_len);

	case EVP_PKEY_HKDEF_MODE_EXPAND_ONLY:
		return HKDF_expand(key, *keylen, kctx->md, kctx->key,
		    kctx->key_len, kctx->info, kctx->info_len);

	default:
		return 0;
	}
}

const EVP_PKEY_METHOD hkdf_pkey_meth = {
	.pkey_id = EVP_PKEY_HKDF,
	.flags = 0,

	.init = pkey_hkdf_init,
	.copy = NULL,
	.cleanup = pkey_hkdf_cleanup,

	.derive_init = pkey_hkdf_derive_init,
	.derive = pkey_hkdf_derive,
	.ctrl = pkey_hkdf_ctrl,
	.ctrl_str = pkey_hkdf_ctrl_str,
};
Added jni/libressl/crypto/kdf/kdf_err.c.


















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*	$OpenBSD: kdf_err.c,v 1.9 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2018 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    openssl-core@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include <openssl/err.h>
#include <openssl/kdf.h>

#ifndef OPENSSL_NO_ERR

static ERR_STRING_DATA KDF_str_functs[] = {
	{ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_CTRL_STR, 0), "pkey_hkdf_ctrl_str"},
	{ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_DERIVE, 0), "pkey_hkdf_derive"},
	{ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_INIT, 0), "pkey_hkdf_init"},
	{0, NULL},
};

static ERR_STRING_DATA KDF_str_reasons[] = {
	{ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_KEY), "missing key"},
	{ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_MESSAGE_DIGEST),
	 "missing message digest"},
	{ERR_PACK(ERR_LIB_KDF, 0, KDF_R_UNKNOWN_PARAMETER_TYPE),
	 "unknown parameter type"},
	{0, NULL},
};

#endif

int
ERR_load_KDF_strings(void)
{
#ifndef OPENSSL_NO_ERR
	if (ERR_func_error_string(KDF_str_functs[0].error) == NULL) {
		ERR_load_strings(0, KDF_str_functs);
		ERR_load_strings(0, KDF_str_reasons);
	}
#endif
	return 1;
}
Changes to jni/libressl/crypto/objects/obj_dat.h.
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#define NUM_NID 1022
#define NUM_SN 1015
#define NUM_LN 1015
#define NUM_OBJ 945

static const unsigned char lvalues[6677]={
0x2A,0x86,0x48,0x86,0xF7,0x0D,               /* [  0] OBJ_rsadsi */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,          /* [  6] OBJ_pkcs */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02,     /* [ 13] OBJ_md2 */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x05,     /* [ 21] OBJ_md5 */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x04,     /* [ 29] OBJ_rc4 */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,/* [ 37] OBJ_rsaEncryption */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,/* [ 46] OBJ_md2WithRSAEncryption */







|
|
|
|

|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#define NUM_NID 1025
#define NUM_SN 1018
#define NUM_LN 1018
#define NUM_OBJ 947

static const unsigned char lvalues[6699]={
0x2A,0x86,0x48,0x86,0xF7,0x0D,               /* [  0] OBJ_rsadsi */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,          /* [  6] OBJ_pkcs */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02,     /* [ 13] OBJ_md2 */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x05,     /* [ 21] OBJ_md5 */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x04,     /* [ 29] OBJ_rc4 */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,/* [ 37] OBJ_rsaEncryption */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,/* [ 46] OBJ_md2WithRSAEncryption */
1003
1004
1005
1006
1007
1008
1009


1010
1011
1012
1013
1014
1015
1016
0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1E,     /* [6609] OBJ_id_kp_bgpsec_router */
0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x18,     /* [6617] OBJ_tlsfeature */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x31,/* [6625] OBJ_id_ct_ASPA */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x02,/* [6636] OBJ_ct_precert_scts */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x03,/* [6646] OBJ_ct_precert_poison */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x04,/* [6656] OBJ_ct_precert_signer */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x05,/* [6666] OBJ_ct_cert_scts */


};

static const ASN1_OBJECT nid_objs[NUM_NID]={
{"UNDEF","undefined",NID_undef,0,NULL,0},
{"rsadsi","RSA Data Security, Inc.",NID_rsadsi,6,&(lvalues[0]),0},
{"pkcs","RSA Data Security, Inc. PKCS",NID_pkcs,7,&(lvalues[6]),0},
{"MD2","md2",NID_md2,8,&(lvalues[13]),0},







>
>







1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1E,     /* [6609] OBJ_id_kp_bgpsec_router */
0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x18,     /* [6617] OBJ_tlsfeature */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x31,/* [6625] OBJ_id_ct_ASPA */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x02,/* [6636] OBJ_ct_precert_scts */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x03,/* [6646] OBJ_ct_precert_poison */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x04,/* [6656] OBJ_ct_precert_signer */
0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x05,/* [6666] OBJ_ct_cert_scts */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x2F,/* [6676] OBJ_id_smime_aa_signingCertificateV2 */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x32,/* [6687] OBJ_id_ct_signedTAL */
};

static const ASN1_OBJECT nid_objs[NUM_NID]={
{"UNDEF","undefined",NID_undef,0,NULL,0},
{"rsadsi","RSA Data Security, Inc.",NID_rsadsi,6,&(lvalues[0]),0},
{"pkcs","RSA Data Security, Inc. PKCS",NID_pkcs,7,&(lvalues[6]),0},
{"MD2","md2",NID_md2,8,&(lvalues[13]),0},
2665
2666
2667
2668
2669
2670
2671






2672
2673
2674
2675
2676
2677
2678
	&(lvalues[6636]),0},
{"ct_precert_poison","CT Precertificate Poison",NID_ct_precert_poison,
	10,&(lvalues[6646]),0},
{"ct_precert_signer","CT Precertificate Signer",NID_ct_precert_signer,
	10,&(lvalues[6656]),0},
{"ct_cert_scts","CT Certificate SCTs",NID_ct_cert_scts,10,
	&(lvalues[6666]),0},






};

static const unsigned int sn_objs[NUM_SN]={
364,	/* "AD_DVCS" */
419,	/* "AES-128-CBC" */
916,	/* "AES-128-CBC-HMAC-SHA1" */
421,	/* "AES-128-CFB" */







>
>
>
>
>
>







2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
	&(lvalues[6636]),0},
{"ct_precert_poison","CT Precertificate Poison",NID_ct_precert_poison,
	10,&(lvalues[6646]),0},
{"ct_precert_signer","CT Precertificate Signer",NID_ct_precert_signer,
	10,&(lvalues[6656]),0},
{"ct_cert_scts","CT Certificate SCTs",NID_ct_cert_scts,10,
	&(lvalues[6666]),0},
{"HKDF","hkdf",NID_hkdf,0,NULL,0},
{"id-smime-aa-signingCertificateV2",
	"id-smime-aa-signingCertificateV2",
	NID_id_smime_aa_signingCertificateV2,11,&(lvalues[6676]),0},
{"id-ct-signedTAL","id-ct-signedTAL",NID_id_ct_signedTAL,11,
	&(lvalues[6687]),0},
};

static const unsigned int sn_objs[NUM_SN]={
364,	/* "AD_DVCS" */
419,	/* "AES-128-CBC" */
916,	/* "AES-128-CBC-HMAC-SHA1" */
421,	/* "AES-128-CFB" */
2765
2766
2767
2768
2769
2770
2771

2772
2773
2774
2775
2776
2777
2778
297,	/* "DVCS" */
952,	/* "Ed25519" */
954,	/* "Ed25519ph" */
953,	/* "Ed448" */
955,	/* "Ed448ph" */
936,	/* "FRP256v1" */
99,	/* "GN" */

855,	/* "HMAC" */
780,	/* "HMAC-MD5" */
781,	/* "HMAC-SHA1" */
381,	/* "IANA" */
34,	/* "IDEA-CBC" */
35,	/* "IDEA-CFB" */
36,	/* "IDEA-ECB" */







>







2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
297,	/* "DVCS" */
952,	/* "Ed25519" */
954,	/* "Ed25519ph" */
953,	/* "Ed448" */
955,	/* "Ed448ph" */
936,	/* "FRP256v1" */
99,	/* "GN" */
1022,	/* "HKDF" */
855,	/* "HMAC" */
780,	/* "HMAC-MD5" */
781,	/* "HMAC-SHA1" */
381,	/* "IANA" */
34,	/* "IDEA-CBC" */
35,	/* "IDEA-CFB" */
36,	/* "IDEA-ECB" */
3162
3163
3164
3165
3166
3167
3168

3169
3170
3171
3172
3173
3174
3175
787,	/* "id-ct-asciiTextWithCRLF" */
1013,	/* "id-ct-geofeedCSVwithCRLF" */
1004,	/* "id-ct-resourceTaggedAttest" */
1001,	/* "id-ct-routeOriginAuthz" */
1003,	/* "id-ct-rpkiGhostbusters" */
1002,	/* "id-ct-rpkiManifest" */
1014,	/* "id-ct-signedChecklist" */

408,	/* "id-ecPublicKey" */
508,	/* "id-hex-multipart-message" */
507,	/* "id-hex-partial-message" */
260,	/* "id-it" */
302,	/* "id-it-caKeyUpdateInfo" */
298,	/* "id-it-caProtEncCert" */
311,	/* "id-it-confirmWaitTime" */







>







3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
787,	/* "id-ct-asciiTextWithCRLF" */
1013,	/* "id-ct-geofeedCSVwithCRLF" */
1004,	/* "id-ct-resourceTaggedAttest" */
1001,	/* "id-ct-routeOriginAuthz" */
1003,	/* "id-ct-rpkiGhostbusters" */
1002,	/* "id-ct-rpkiManifest" */
1014,	/* "id-ct-signedChecklist" */
1024,	/* "id-ct-signedTAL" */
408,	/* "id-ecPublicKey" */
508,	/* "id-hex-multipart-message" */
507,	/* "id-hex-partial-message" */
260,	/* "id-it" */
302,	/* "id-it-caKeyUpdateInfo" */
298,	/* "id-it-caProtEncCert" */
311,	/* "id-it-confirmWaitTime" */
3260
3261
3262
3263
3264
3265
3266

3267
3268
3269
3270
3271
3272
3273
219,	/* "id-smime-aa-macValue" */
214,	/* "id-smime-aa-mlExpandHistory" */
216,	/* "id-smime-aa-msgSigDigest" */
212,	/* "id-smime-aa-receiptRequest" */
213,	/* "id-smime-aa-securityLabel" */
239,	/* "id-smime-aa-signatureType" */
223,	/* "id-smime-aa-signingCertificate" */

224,	/* "id-smime-aa-smimeEncryptCerts" */
225,	/* "id-smime-aa-timeStampToken" */
192,	/* "id-smime-alg" */
243,	/* "id-smime-alg-3DESwrap" */
246,	/* "id-smime-alg-CMS3DESwrap" */
247,	/* "id-smime-alg-CMSRC2wrap" */
245,	/* "id-smime-alg-ESDH" */







>







3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
219,	/* "id-smime-aa-macValue" */
214,	/* "id-smime-aa-mlExpandHistory" */
216,	/* "id-smime-aa-msgSigDigest" */
212,	/* "id-smime-aa-receiptRequest" */
213,	/* "id-smime-aa-securityLabel" */
239,	/* "id-smime-aa-signatureType" */
223,	/* "id-smime-aa-signingCertificate" */
1023,	/* "id-smime-aa-signingCertificateV2" */
224,	/* "id-smime-aa-smimeEncryptCerts" */
225,	/* "id-smime-aa-timeStampToken" */
192,	/* "id-smime-alg" */
243,	/* "id-smime-alg-3DESwrap" */
246,	/* "id-smime-alg-CMS3DESwrap" */
247,	/* "id-smime-alg-CMSRC2wrap" */
245,	/* "id-smime-alg-ESDH" */
4075
4076
4077
4078
4079
4080
4081

4082
4083
4084
4085
4086
4087
4088
631,	/* "generate cryptogram" */
509,	/* "generationQualifier" */
601,	/* "generic cryptogram" */
99,	/* "givenName" */
939,	/* "gost89-cbc" */
814,	/* "gost89-cnt" */
938,	/* "gost89-ecb" */

855,	/* "hmac" */
780,	/* "hmac-md5" */
781,	/* "hmac-sha1" */
797,	/* "hmacWithMD5" */
163,	/* "hmacWithSHA1" */
798,	/* "hmacWithSHA224" */
799,	/* "hmacWithSHA256" */







>







4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
631,	/* "generate cryptogram" */
509,	/* "generationQualifier" */
601,	/* "generic cryptogram" */
99,	/* "givenName" */
939,	/* "gost89-cbc" */
814,	/* "gost89-cnt" */
938,	/* "gost89-ecb" */
1022,	/* "hkdf" */
855,	/* "hmac" */
780,	/* "hmac-md5" */
781,	/* "hmac-sha1" */
797,	/* "hmacWithMD5" */
163,	/* "hmacWithSHA1" */
798,	/* "hmacWithSHA224" */
799,	/* "hmacWithSHA256" */
4179
4180
4181
4182
4183
4184
4185

4186
4187
4188
4189
4190
4191
4192
787,	/* "id-ct-asciiTextWithCRLF" */
1013,	/* "id-ct-geofeedCSVwithCRLF" */
1004,	/* "id-ct-resourceTaggedAttest" */
1001,	/* "id-ct-routeOriginAuthz" */
1003,	/* "id-ct-rpkiGhostbusters" */
1002,	/* "id-ct-rpkiManifest" */
1014,	/* "id-ct-signedChecklist" */

408,	/* "id-ecPublicKey" */
508,	/* "id-hex-multipart-message" */
507,	/* "id-hex-partial-message" */
260,	/* "id-it" */
302,	/* "id-it-caKeyUpdateInfo" */
298,	/* "id-it-caProtEncCert" */
311,	/* "id-it-confirmWaitTime" */







>







4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
787,	/* "id-ct-asciiTextWithCRLF" */
1013,	/* "id-ct-geofeedCSVwithCRLF" */
1004,	/* "id-ct-resourceTaggedAttest" */
1001,	/* "id-ct-routeOriginAuthz" */
1003,	/* "id-ct-rpkiGhostbusters" */
1002,	/* "id-ct-rpkiManifest" */
1014,	/* "id-ct-signedChecklist" */
1024,	/* "id-ct-signedTAL" */
408,	/* "id-ecPublicKey" */
508,	/* "id-hex-multipart-message" */
507,	/* "id-hex-partial-message" */
260,	/* "id-it" */
302,	/* "id-it-caKeyUpdateInfo" */
298,	/* "id-it-caProtEncCert" */
311,	/* "id-it-confirmWaitTime" */
4269
4270
4271
4272
4273
4274
4275

4276
4277
4278
4279
4280
4281
4282
219,	/* "id-smime-aa-macValue" */
214,	/* "id-smime-aa-mlExpandHistory" */
216,	/* "id-smime-aa-msgSigDigest" */
212,	/* "id-smime-aa-receiptRequest" */
213,	/* "id-smime-aa-securityLabel" */
239,	/* "id-smime-aa-signatureType" */
223,	/* "id-smime-aa-signingCertificate" */

224,	/* "id-smime-aa-smimeEncryptCerts" */
225,	/* "id-smime-aa-timeStampToken" */
192,	/* "id-smime-alg" */
243,	/* "id-smime-alg-3DESwrap" */
246,	/* "id-smime-alg-CMS3DESwrap" */
247,	/* "id-smime-alg-CMSRC2wrap" */
245,	/* "id-smime-alg-ESDH" */







>







4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
219,	/* "id-smime-aa-macValue" */
214,	/* "id-smime-aa-mlExpandHistory" */
216,	/* "id-smime-aa-msgSigDigest" */
212,	/* "id-smime-aa-receiptRequest" */
213,	/* "id-smime-aa-securityLabel" */
239,	/* "id-smime-aa-signatureType" */
223,	/* "id-smime-aa-signingCertificate" */
1023,	/* "id-smime-aa-signingCertificateV2" */
224,	/* "id-smime-aa-smimeEncryptCerts" */
225,	/* "id-smime-aa-timeStampToken" */
192,	/* "id-smime-alg" */
243,	/* "id-smime-alg-3DESwrap" */
246,	/* "id-smime-alg-CMS3DESwrap" */
247,	/* "id-smime-alg-CMSRC2wrap" */
245,	/* "id-smime-alg-ESDH" */
5592
5593
5594
5595
5596
5597
5598

5599
5600
5601
5602
5603
5604
5605
1002,	/* OBJ_id_ct_rpkiManifest           1 2 840 113549 1 9 16 1 26 */
787,	/* OBJ_id_ct_asciiTextWithCRLF      1 2 840 113549 1 9 16 1 27 */
1003,	/* OBJ_id_ct_rpkiGhostbusters       1 2 840 113549 1 9 16 1 35 */
1004,	/* OBJ_id_ct_resourceTaggedAttest   1 2 840 113549 1 9 16 1 36 */
1013,	/* OBJ_id_ct_geofeedCSVwithCRLF     1 2 840 113549 1 9 16 1 47 */
1014,	/* OBJ_id_ct_signedChecklist        1 2 840 113549 1 9 16 1 48 */
1017,	/* OBJ_id_ct_ASPA                   1 2 840 113549 1 9 16 1 49 */

212,	/* OBJ_id_smime_aa_receiptRequest   1 2 840 113549 1 9 16 2 1 */
213,	/* OBJ_id_smime_aa_securityLabel    1 2 840 113549 1 9 16 2 2 */
214,	/* OBJ_id_smime_aa_mlExpandHistory  1 2 840 113549 1 9 16 2 3 */
215,	/* OBJ_id_smime_aa_contentHint      1 2 840 113549 1 9 16 2 4 */
216,	/* OBJ_id_smime_aa_msgSigDigest     1 2 840 113549 1 9 16 2 5 */
217,	/* OBJ_id_smime_aa_encapContentType 1 2 840 113549 1 9 16 2 6 */
218,	/* OBJ_id_smime_aa_contentIdentifier 1 2 840 113549 1 9 16 2 7 */







>







5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
1002,	/* OBJ_id_ct_rpkiManifest           1 2 840 113549 1 9 16 1 26 */
787,	/* OBJ_id_ct_asciiTextWithCRLF      1 2 840 113549 1 9 16 1 27 */
1003,	/* OBJ_id_ct_rpkiGhostbusters       1 2 840 113549 1 9 16 1 35 */
1004,	/* OBJ_id_ct_resourceTaggedAttest   1 2 840 113549 1 9 16 1 36 */
1013,	/* OBJ_id_ct_geofeedCSVwithCRLF     1 2 840 113549 1 9 16 1 47 */
1014,	/* OBJ_id_ct_signedChecklist        1 2 840 113549 1 9 16 1 48 */
1017,	/* OBJ_id_ct_ASPA                   1 2 840 113549 1 9 16 1 49 */
1024,	/* OBJ_id_ct_signedTAL              1 2 840 113549 1 9 16 1 50 */
212,	/* OBJ_id_smime_aa_receiptRequest   1 2 840 113549 1 9 16 2 1 */
213,	/* OBJ_id_smime_aa_securityLabel    1 2 840 113549 1 9 16 2 2 */
214,	/* OBJ_id_smime_aa_mlExpandHistory  1 2 840 113549 1 9 16 2 3 */
215,	/* OBJ_id_smime_aa_contentHint      1 2 840 113549 1 9 16 2 4 */
216,	/* OBJ_id_smime_aa_msgSigDigest     1 2 840 113549 1 9 16 2 5 */
217,	/* OBJ_id_smime_aa_encapContentType 1 2 840 113549 1 9 16 2 6 */
218,	/* OBJ_id_smime_aa_contentIdentifier 1 2 840 113549 1 9 16 2 7 */
5621
5622
5623
5624
5625
5626
5627

5628
5629
5630
5631
5632
5633
5634
234,	/* OBJ_id_smime_aa_ets_certValues   1 2 840 113549 1 9 16 2 23 */
235,	/* OBJ_id_smime_aa_ets_revocationValues 1 2 840 113549 1 9 16 2 24 */
236,	/* OBJ_id_smime_aa_ets_escTimeStamp 1 2 840 113549 1 9 16 2 25 */
237,	/* OBJ_id_smime_aa_ets_certCRLTimestamp 1 2 840 113549 1 9 16 2 26 */
238,	/* OBJ_id_smime_aa_ets_archiveTimeStamp 1 2 840 113549 1 9 16 2 27 */
239,	/* OBJ_id_smime_aa_signatureType    1 2 840 113549 1 9 16 2 28 */
240,	/* OBJ_id_smime_aa_dvcs_dvc         1 2 840 113549 1 9 16 2 29 */

241,	/* OBJ_id_smime_alg_ESDHwith3DES    1 2 840 113549 1 9 16 3 1 */
242,	/* OBJ_id_smime_alg_ESDHwithRC2     1 2 840 113549 1 9 16 3 2 */
243,	/* OBJ_id_smime_alg_3DESwrap        1 2 840 113549 1 9 16 3 3 */
244,	/* OBJ_id_smime_alg_RC2wrap         1 2 840 113549 1 9 16 3 4 */
245,	/* OBJ_id_smime_alg_ESDH            1 2 840 113549 1 9 16 3 5 */
246,	/* OBJ_id_smime_alg_CMS3DESwrap     1 2 840 113549 1 9 16 3 6 */
247,	/* OBJ_id_smime_alg_CMSRC2wrap      1 2 840 113549 1 9 16 3 7 */







>







5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
234,	/* OBJ_id_smime_aa_ets_certValues   1 2 840 113549 1 9 16 2 23 */
235,	/* OBJ_id_smime_aa_ets_revocationValues 1 2 840 113549 1 9 16 2 24 */
236,	/* OBJ_id_smime_aa_ets_escTimeStamp 1 2 840 113549 1 9 16 2 25 */
237,	/* OBJ_id_smime_aa_ets_certCRLTimestamp 1 2 840 113549 1 9 16 2 26 */
238,	/* OBJ_id_smime_aa_ets_archiveTimeStamp 1 2 840 113549 1 9 16 2 27 */
239,	/* OBJ_id_smime_aa_signatureType    1 2 840 113549 1 9 16 2 28 */
240,	/* OBJ_id_smime_aa_dvcs_dvc         1 2 840 113549 1 9 16 2 29 */
1023,	/* OBJ_id_smime_aa_signingCertificateV2 1 2 840 113549 1 9 16 2 47 */
241,	/* OBJ_id_smime_alg_ESDHwith3DES    1 2 840 113549 1 9 16 3 1 */
242,	/* OBJ_id_smime_alg_ESDHwithRC2     1 2 840 113549 1 9 16 3 2 */
243,	/* OBJ_id_smime_alg_3DESwrap        1 2 840 113549 1 9 16 3 3 */
244,	/* OBJ_id_smime_alg_RC2wrap         1 2 840 113549 1 9 16 3 4 */
245,	/* OBJ_id_smime_alg_ESDH            1 2 840 113549 1 9 16 3 5 */
246,	/* OBJ_id_smime_alg_CMS3DESwrap     1 2 840 113549 1 9 16 3 6 */
247,	/* OBJ_id_smime_alg_CMSRC2wrap      1 2 840 113549 1 9 16 3 7 */
Changes to jni/libressl/crypto/objects/obj_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: obj_err.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: obj_err.c,v 1.13 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/objects.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OBJ,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OBJ,0,reason)

static ERR_STRING_DATA OBJ_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/objects.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OBJ,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OBJ,0,reason)

static ERR_STRING_DATA OBJ_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/ocsp/ocsp_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ocsp_err.c,v 1.8 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ocsp_err.c,v 1.9 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ocsp.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OCSP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OCSP,0,reason)

static ERR_STRING_DATA OCSP_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ocsp.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OCSP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OCSP,0,reason)

static ERR_STRING_DATA OCSP_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/pem/pem_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: pem_err.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pem_err.c,v 1.13 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/pem.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PEM,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PEM,0,reason)

static ERR_STRING_DATA PEM_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/pem.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PEM,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PEM,0,reason)

static ERR_STRING_DATA PEM_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/pem/pem_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: pem_lib.c,v 1.50 2021/12/12 21:30:14 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pem_lib.c,v 1.51 2022/07/31 09:48:27 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
	nlen = strlen(name);

	if ((BIO_write(bp, "-----BEGIN ", 11) != 11) ||
	    (BIO_write(bp, name, nlen) != nlen) ||
	    (BIO_write(bp, "-----\n", 6) != 6))
		goto err;

	i = strlen(header);
	if (i > 0) {
		if ((BIO_write(bp, header, i) != i) ||
		    (BIO_write(bp, "\n", 1) != 1))
			goto err;
	}

	buf = reallocarray(NULL, PEM_BUFSIZE, 8);
	if (buf == NULL) {







|
<







604
605
606
607
608
609
610
611

612
613
614
615
616
617
618
	nlen = strlen(name);

	if ((BIO_write(bp, "-----BEGIN ", 11) != 11) ||
	    (BIO_write(bp, name, nlen) != nlen) ||
	    (BIO_write(bp, "-----\n", 6) != 6))
		goto err;

	if (header != NULL && (i = strlen(header)) > 0) {

		if ((BIO_write(bp, header, i) != i) ||
		    (BIO_write(bp, "\n", 1) != 1))
			goto err;
	}

	buf = reallocarray(NULL, PEM_BUFSIZE, 8);
	if (buf == NULL) {
Changes to jni/libressl/crypto/pkcs12/p12_add.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_add.c,v 1.17 2018/05/13 14:24:07 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_add.c,v 1.20 2022/09/11 17:30:13 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62


63
64
65
66
67
68
69
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>



/* Pack an object into an OCTET STRING and turn into a safebag */

PKCS12_SAFEBAG *
PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1, int nid2)
{
	PKCS12_BAGS *bag;







>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>

#include "pkcs12_local.h"

/* Pack an object into an OCTET STRING and turn into a safebag */

PKCS12_SAFEBAG *
PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1, int nid2)
{
	PKCS12_BAGS *bag;
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
		return NULL;
	}
	safebag->value.bag = bag;
	safebag->type = OBJ_nid2obj(nid2);
	return safebag;
}

/* Turn PKCS8 object into a keybag */

PKCS12_SAFEBAG *
PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8)
{
	PKCS12_SAFEBAG *bag;

	if (!(bag = PKCS12_SAFEBAG_new())) {
		PKCS12error(ERR_R_MALLOC_FAILURE);
		return NULL;
	}
	bag->type = OBJ_nid2obj(NID_keyBag);
	bag->value.keybag = p8;
	return bag;
}

/* Turn PKCS8 object into a shrouded keybag */

PKCS12_SAFEBAG *
PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, int passlen,
    unsigned char *salt, int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8)
{
	PKCS12_SAFEBAG *bag;
	const EVP_CIPHER *pbe_ciph;

	/* Set up the safe bag */
	if (!(bag = PKCS12_SAFEBAG_new())) {
		PKCS12error(ERR_R_MALLOC_FAILURE);
		return NULL;
	}

	bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag);

	pbe_ciph = EVP_get_cipherbynid(pbe_nid);

	if (pbe_ciph)
		pbe_nid = -1;

	if (!(bag->value.shkeybag = PKCS8_encrypt(pbe_nid, pbe_ciph, pass,
	    passlen, salt, saltlen, iter, p8))) {
		PKCS12error(ERR_R_MALLOC_FAILURE);
		PKCS12_SAFEBAG_free(bag);
		return NULL;
	}

	return bag;
}

/* Turn a stack of SAFEBAGS into a PKCS#7 data Contentinfo */
PKCS7 *
PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk)
{
	PKCS7 *p7;

	if (!(p7 = PKCS7_new())) {







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







87
88
89
90
91
92
93
















































94
95
96
97
98
99
100
		return NULL;
	}
	safebag->value.bag = bag;
	safebag->type = OBJ_nid2obj(nid2);
	return safebag;
}

















































/* Turn a stack of SAFEBAGS into a PKCS#7 data Contentinfo */
PKCS7 *
PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk)
{
	PKCS7 *p7;

	if (!(p7 = PKCS7_new())) {
Changes to jni/libressl/crypto/pkcs12/p12_asn.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_asn.c,v 1.10 2022/01/14 08:16:13 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_asn.c,v 1.12 2022/08/20 09:16:18 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62


63
64
65
66
67
68
69
 *
 */

#include <stdio.h>

#include <openssl/asn1t.h>
#include <openssl/pkcs12.h>



/* PKCS#12 ASN1 module */

static const ASN1_TEMPLATE PKCS12_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,







>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 *
 */

#include <stdio.h>

#include <openssl/asn1t.h>
#include <openssl/pkcs12.h>

#include "pkcs12_local.h"

/* PKCS#12 ASN1 module */

static const ASN1_TEMPLATE PKCS12_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
			.item = &X509_SIG_it,
		},
	
	},
	{
		.value = NID_safeContentsBag,
		.tt = {
			.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_SET_OF,
			.tag = 0,
			.offset = offsetof(PKCS12_SAFEBAG, value.safes),
			.field_name = "value.safes",
			.item = &PKCS12_SAFEBAG_it,
		},
	},
	{







|







321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
			.item = &X509_SIG_it,
		},
	
	},
	{
		.value = NID_safeContentsBag,
		.tt = {
			.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_SEQUENCE_OF,
			.tag = 0,
			.offset = offsetof(PKCS12_SAFEBAG, value.safes),
			.field_name = "value.safes",
			.item = &PKCS12_SAFEBAG_it,
		},
	},
	{
Changes to jni/libressl/crypto/pkcs12/p12_attr.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_attr.c,v 1.14 2021/11/01 20:53:08 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_attr.c,v 1.17 2022/08/20 09:16:18 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 */

#include <stdio.h>

#include <openssl/pkcs12.h>


#include "x509_lcl.h"

/* Add a local keyid to a safebag */

int
PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen)
{







>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 *
 */

#include <stdio.h>

#include <openssl/pkcs12.h>

#include "pkcs12_local.h"
#include "x509_lcl.h"

/* Add a local keyid to a safebag */

int
PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen)
{
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153






	X509_ATTRIBUTE *attrib;
	int i;

	if (!attrs)
		return NULL;
	for (i = 0; i < sk_X509_ATTRIBUTE_num(attrs); i++) {
		attrib = sk_X509_ATTRIBUTE_value(attrs, i);
		if (OBJ_obj2nid(attrib->object) == attr_nid) {
			if (sk_ASN1_TYPE_num(attrib->value.set))
				return sk_ASN1_TYPE_value(attrib->value.set, 0);
			else
				return NULL;
		}
	}
	return NULL;
}

char *
PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag)
{
	ASN1_TYPE *atype;

	if (!(atype = PKCS12_get_attr(bag, NID_friendlyName)))
		return NULL;
	if (atype->type != V_ASN1_BMPSTRING)
		return NULL;
	return OPENSSL_uni2asc(atype->value.bmpstring->data,
	    atype->value.bmpstring->length);
}













|
<
|
<
<
<







|

|






>
>
>
>
>
>
126
127
128
129
130
131
132
133

134



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
	X509_ATTRIBUTE *attrib;
	int i;

	if (!attrs)
		return NULL;
	for (i = 0; i < sk_X509_ATTRIBUTE_num(attrs); i++) {
		attrib = sk_X509_ATTRIBUTE_value(attrs, i);
		if (OBJ_obj2nid(attrib->object) == attr_nid)

			return sk_ASN1_TYPE_value(attrib->set, 0);



	}
	return NULL;
}

char *
PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag)
{
	const ASN1_TYPE *atype;

	if (!(atype = PKCS12_SAFEBAG_get0_attr(bag, NID_friendlyName)))
		return NULL;
	if (atype->type != V_ASN1_BMPSTRING)
		return NULL;
	return OPENSSL_uni2asc(atype->value.bmpstring->data,
	    atype->value.bmpstring->length);
}

const STACK_OF(X509_ATTRIBUTE) *
PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag)
{
	return bag->attrib;
}
Changes to jni/libressl/crypto/pkcs12/p12_crt.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_crt.c,v 1.18 2018/05/13 13:46:55 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 1999-2002 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_crt.c,v 1.20 2022/08/20 09:16:18 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 1999-2002 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62


63
64
65
66
67
68
69
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>



static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
    PKCS12_SAFEBAG *bag);

static int
copy_bag_attr(PKCS12_SAFEBAG *bag, EVP_PKEY *pkey, int nid)
{







>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>

#include "pkcs12_local.h"

static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
    PKCS12_SAFEBAG *bag);

static int
copy_bag_attr(PKCS12_SAFEBAG *bag, EVP_PKEY *pkey, int nid)
{
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247

	/* Make a PKCS#8 structure */
	if (!(p8 = EVP_PKEY2PKCS8(key)))
		goto err;
	if (key_usage && !PKCS8_add_keyusage(p8, key_usage))
		goto err;
	if (nid_key != -1) {
		bag = PKCS12_MAKE_SHKEYBAG(nid_key, pass, -1, NULL, 0,
		    iter, p8);
		PKCS8_PRIV_KEY_INFO_free(p8);
		p8 = NULL;
	} else {
		bag = PKCS12_MAKE_KEYBAG(p8);
		if (bag != NULL)
			p8 = NULL;
	}

	if (!bag)
		goto err;








|
|



|







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249

	/* Make a PKCS#8 structure */
	if (!(p8 = EVP_PKEY2PKCS8(key)))
		goto err;
	if (key_usage && !PKCS8_add_keyusage(p8, key_usage))
		goto err;
	if (nid_key != -1) {
		bag = PKCS12_SAFEBAG_create_pkcs8_encrypt(nid_key, pass, -1,
		    NULL, 0, iter, p8);
		PKCS8_PRIV_KEY_INFO_free(p8);
		p8 = NULL;
	} else {
		bag = PKCS12_SAFEBAG_create0_p8inf(p8);
		if (bag != NULL)
			p8 = NULL;
	}

	if (!bag)
		goto err;

Changes to jni/libressl/crypto/pkcs12/p12_init.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_init.c,v 1.13 2022/01/20 11:18:49 inoguchi Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_init.c,v 1.14 2022/08/20 09:16:18 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62


63
64
65
66
67
68
69
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>



/* Initialise a PKCS12 structure to take data */

PKCS12 *
PKCS12_init(int mode)
{
	PKCS12 *pkcs12;







>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>

#include "pkcs12_local.h"

/* Initialise a PKCS12 structure to take data */

PKCS12 *
PKCS12_init(int mode)
{
	PKCS12 *pkcs12;
Changes to jni/libressl/crypto/pkcs12/p12_key.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_key.c,v 1.28 2021/12/12 21:30:14 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_key.c,v 1.31 2022/07/30 11:27:06 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
95
96
97
98
99
100
101


102
103
104
105
106
107

108
109

110
111
112
113
114
115

116

117


118


119
120
121
122
123

124
125
126
127
128

129
130

131
132
133
134
135

136
137

138

139

140
141
142
143

144

145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186

187
188
189
190
191
192
193
194
195
196
197
198
199
}

int
PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
    int saltlen, int id, int iter, int n, unsigned char *out,
    const EVP_MD *md_type)
{


	unsigned char *B, *D, *I, *p, *Ai;
	int Slen, Plen, Ilen, Ijlen;
	int i, j, u, v;
	int ret = 0;
	BIGNUM *Ij, *Bpl1;	/* These hold Ij and B + 1 */
	EVP_MD_CTX ctx;


	v = EVP_MD_block_size(md_type);

	u = EVP_MD_size(md_type);
	if (u < 0)
		return 0;

	EVP_MD_CTX_init(&ctx);
	D = malloc(v);

	Ai = malloc(u);

	B = malloc(v + 1);


	Slen = v * ((saltlen + v - 1) / v);


	if (passlen)
		Plen = v * ((passlen + v - 1)/v);
	else
		Plen = 0;
	Ilen = Slen + Plen;

	I = malloc(Ilen);
	Ij = BN_new();
	Bpl1 = BN_new();
	if (!D || !Ai || !B || !I || !Ij || !Bpl1)
		goto err;

	for (i = 0; i < v; i++)
		D[i] = id;

	p = I;
	for (i = 0; i < Slen; i++)
		*p++ = salt[i % saltlen];
	for (i = 0; i < Plen; i++)
		*p++ = pass[i % passlen];

	for (;;) {
		if (!EVP_DigestInit_ex(&ctx, md_type, NULL) ||

		    !EVP_DigestUpdate(&ctx, D, v) ||

		    !EVP_DigestUpdate(&ctx, I, Ilen) ||

		    !EVP_DigestFinal_ex(&ctx, Ai, NULL))
			goto err;
		for (j = 1; j < iter; j++) {
			if (!EVP_DigestInit_ex(&ctx, md_type, NULL) ||

			    !EVP_DigestUpdate(&ctx, Ai, u) ||

			    !EVP_DigestFinal_ex(&ctx, Ai, NULL))
				goto err;
		}
		memcpy(out, Ai, min(n, u));
		if (u >= n) {
			ret = 1;
			goto end;
		}
		n -= u;
		out += u;
		for (j = 0; j < v; j++)
			B[j] = Ai[j % u];
		/* Work out B + 1 first then can use B as tmp space */
		if (!BN_bin2bn(B, v, Bpl1))
			goto err;
		if (!BN_add_word(Bpl1, 1))
			goto err;
		for (j = 0; j < Ilen; j += v) {
			if (!BN_bin2bn(I + j, v, Ij))
				goto err;
			if (!BN_add(Ij, Ij, Bpl1))
				goto err;
			if (!BN_bn2bin(Ij, B))
				goto err;
			Ijlen = BN_num_bytes(Ij);
			/* If more than 2^(v*8) - 1 cut off MSB */
			if (Ijlen > v) {
				if (!BN_bn2bin(Ij, B))
					goto err;
				memcpy(I + j, B + 1, v);
#ifndef PKCS12_BROKEN_KEYGEN
				/* If less than v bytes pad with zeroes */
			} else if (Ijlen < v) {
				memset(I + j, 0, v - Ijlen);
				if (!BN_bn2bin(Ij, I + j + v - Ijlen))
					goto err;
#endif
			} else if (!BN_bn2bin(Ij, I + j))
				goto err;
		}
	}


err:
	PKCS12error(ERR_R_MALLOC_FAILURE);

end:
	free(Ai);
	free(B);
	free(D);
	free(I);
	BN_free(Ij);
	BN_free(Bpl1);
	EVP_MD_CTX_cleanup(&ctx);
	return ret;
}







>
>
|
|


|
|
>

|
>
|
|
<

<
|
>
|
>
|
>
>

>
>

|
|
<

>
|
<
<
<

>


>





>

|
>
|
>
|
>
|


|
>
|
>
|











|
<
<
<
<

<
<
<
<
<
<
|
<
<
|
|
|
<
<
<
|
|
<
<
|
|
|
|
|
>
|


|




|
|
<


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

116

117
118
119
120
121
122
123
124
125
126
127
128
129

130
131
132



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170




171






172


173
174
175



176
177


178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

194
195
}

int
PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
    int saltlen, int id, int iter, int n, unsigned char *out,
    const EVP_MD *md_type)
{
	EVP_MD_CTX *ctx = NULL;
	unsigned char *B = NULL, *D = NULL, *I = NULL, *Ai = NULL;
	unsigned char *p;
	int Slen, Plen, Ilen;
	int i, j, u, v;
	int ret = 0;

	if ((ctx = EVP_MD_CTX_new()) == NULL)
		goto err;

	if ((v = EVP_MD_block_size(md_type)) <= 0)
		goto err;
	if ((u = EVP_MD_size(md_type)) <= 0)
		goto err;



	if ((D = malloc(v)) == NULL)
		goto err;
	if ((Ai = malloc(u)) == NULL)
		goto err;
	if ((B = malloc(v + 1)) == NULL)
		goto err;

	Slen = v * ((saltlen + v - 1) / v);

	Plen = 0;
	if (passlen)
		Plen = v * ((passlen + v - 1) / v);


	Ilen = Slen + Plen;

	if ((I = malloc(Ilen)) == NULL)



		goto err;

	for (i = 0; i < v; i++)
		D[i] = id;

	p = I;
	for (i = 0; i < Slen; i++)
		*p++ = salt[i % saltlen];
	for (i = 0; i < Plen; i++)
		*p++ = pass[i % passlen];

	for (;;) {
		if (!EVP_DigestInit_ex(ctx, md_type, NULL))
			goto err;
		if (!EVP_DigestUpdate(ctx, D, v))
			goto err;
		if (!EVP_DigestUpdate(ctx, I, Ilen))
			goto err;
		if (!EVP_DigestFinal_ex(ctx, Ai, NULL))
			goto err;
		for (j = 1; j < iter; j++) {
			if (!EVP_DigestInit_ex(ctx, md_type, NULL))
				goto err;
			if (!EVP_DigestUpdate(ctx, Ai, u))
				goto err;
			if (!EVP_DigestFinal_ex(ctx, Ai, NULL))
				goto err;
		}
		memcpy(out, Ai, min(n, u));
		if (u >= n) {
			ret = 1;
			goto end;
		}
		n -= u;
		out += u;
		for (j = 0; j < v; j++)
			B[j] = Ai[j % u];





		for (j = 0; j < Ilen; j += v) {






			uint16_t c = 1;


			int k;

			/* Work out I[j] = I[j] + B + 1. */



			for (k = v - 1; k >= 0; k--) {
				c += I[j + k] + B[k];


				I[j + k] = (unsigned char)c;
				c >>= 8;
			}
		}
	}

 err:
	PKCS12error(ERR_R_MALLOC_FAILURE);

 end:
	free(Ai);
	free(B);
	free(D);
	free(I);
	EVP_MD_CTX_free(ctx);


	return ret;
}
Changes to jni/libressl/crypto/pkcs12/p12_kiss.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_kiss.c,v 1.21 2021/07/09 14:08:00 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_kiss.c,v 1.25 2022/08/20 09:16:18 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
56
57
58
59
60
61
62


63
64
65
66
67
68
69
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>



/* Simplified PKCS#12 routines */

static int parse_pk12( PKCS12 *p12, const char *pass, int passlen,
    EVP_PKEY **pkey, STACK_OF(X509) *ocerts);

static int parse_bags( STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass,







>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>

#include "pkcs12_local.h"

/* Simplified PKCS#12 routines */

static int parse_pk12( PKCS12 *p12, const char *pass, int passlen,
    EVP_PKEY **pkey, STACK_OF(X509) *ocerts);

static int parse_bags( STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass,
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98





99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

168
169
170
171
172
173
174

int
PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
    STACK_OF(X509) **ca)
{
	STACK_OF(X509) *ocerts = NULL;
	X509 *x = NULL;
	/* Check for NULL PKCS12 structure */

	if (!p12) {
		PKCS12error(PKCS12_R_INVALID_NULL_PKCS12_POINTER);
		return 0;
	}

	if (pkey)
		*pkey = NULL;
	if (cert)
		*cert = NULL;






	/* Check the mac */

	/* If password is zero length or NULL then try verifying both cases
	 * to determine which password is correct. The reason for this is that
	 * under PKCS#12 password based encryption no password and a zero length
	 * password are two different things...
	 */

	if (!pass || !*pass) {
		if (PKCS12_verify_mac(p12, NULL, 0))
			pass = NULL;
		else if (PKCS12_verify_mac(p12, "", 0))
			pass = "";
		else {
			PKCS12error(PKCS12_R_MAC_VERIFY_FAILURE);
			goto err;
		}
	} else if (!PKCS12_verify_mac(p12, pass, -1)) {
		PKCS12error(PKCS12_R_MAC_VERIFY_FAILURE);
		goto err;
	}

	/* Allocate stack for other certificates */
	ocerts = sk_X509_new_null();
	if (!ocerts) {
		PKCS12error(ERR_R_MALLOC_FAILURE);
		return 0;
	}

	if (!parse_pk12(p12, pass, -1, pkey, ocerts)) {
		PKCS12error(PKCS12_R_PARSE_ERROR);
		goto err;
	}

	while ((x = sk_X509_pop(ocerts))) {
		if (pkey && *pkey && cert && !*cert) {

			ERR_set_mark();
			if (X509_check_private_key(x, *pkey)) {
				*cert = x;
				x = NULL;
			}
			ERR_pop_to_mark();
		}

		if (ca && x) {
			if (!*ca)
				*ca = sk_X509_new_null();
			if (!*ca)
				goto err;
			if (!sk_X509_push(*ca, x))
				goto err;
			x = NULL;
		}
		X509_free(x);

	}

	if (ocerts)
		sk_X509_pop_free(ocerts, X509_free);

	return 1;

err:
	if (pkey && *pkey)
		EVP_PKEY_free(*pkey);
	if (cert)
		X509_free(*cert);
	X509_free(x);
	if (ocerts)
		sk_X509_pop_free(ocerts, X509_free);

	return 0;
}

/* Parse the outer PKCS#12 structure */

static int
parse_pk12(PKCS12 *p12, const char *pass, int passlen, EVP_PKEY **pkey,







<

<
<
<
<
<
|

|


>
>
>
>
>








|














|
<

|







|
|
>








|
|

|






>


<
|




|

|


<
|
>







82
83
84
85
86
87
88

89





90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175

int
PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
    STACK_OF(X509) **ca)
{
	STACK_OF(X509) *ocerts = NULL;
	X509 *x = NULL;







	if (pkey != NULL)
		*pkey = NULL;
	if (cert != NULL)
		*cert = NULL;

	if (p12 == NULL) {
		PKCS12error(PKCS12_R_INVALID_NULL_PKCS12_POINTER);
		goto err;
	}

	/* Check the mac */

	/* If password is zero length or NULL then try verifying both cases
	 * to determine which password is correct. The reason for this is that
	 * under PKCS#12 password based encryption no password and a zero length
	 * password are two different things...
	 */

	if (pass == NULL || *pass == '\0') {
		if (PKCS12_verify_mac(p12, NULL, 0))
			pass = NULL;
		else if (PKCS12_verify_mac(p12, "", 0))
			pass = "";
		else {
			PKCS12error(PKCS12_R_MAC_VERIFY_FAILURE);
			goto err;
		}
	} else if (!PKCS12_verify_mac(p12, pass, -1)) {
		PKCS12error(PKCS12_R_MAC_VERIFY_FAILURE);
		goto err;
	}

	/* Allocate stack for other certificates */
	if ((ocerts = sk_X509_new_null()) == NULL) {

		PKCS12error(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	if (!parse_pk12(p12, pass, -1, pkey, ocerts)) {
		PKCS12error(PKCS12_R_PARSE_ERROR);
		goto err;
	}

	while ((x = sk_X509_pop(ocerts)) != NULL) {
		if (pkey != NULL && *pkey != NULL &&
		    cert != NULL && *cert == NULL) {
			ERR_set_mark();
			if (X509_check_private_key(x, *pkey)) {
				*cert = x;
				x = NULL;
			}
			ERR_pop_to_mark();
		}

		if (ca != NULL && x != NULL) {
			if (*ca == NULL)
				*ca = sk_X509_new_null();
			if (*ca == NULL)
				goto err;
			if (!sk_X509_push(*ca, x))
				goto err;
			x = NULL;
		}
		X509_free(x);
		x = NULL;
	}


	sk_X509_pop_free(ocerts, X509_free);

	return 1;

err:
	if (pkey != NULL)
		EVP_PKEY_free(*pkey);
	if (cert != NULL)
		X509_free(*cert);
	X509_free(x);

	sk_X509_pop_free(ocerts, X509_free);

	return 0;
}

/* Parse the outer PKCS#12 structure */

static int
parse_pk12(PKCS12 *p12, const char *pass, int passlen, EVP_PKEY **pkey,
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

static int
parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, EVP_PKEY **pkey,
    STACK_OF(X509) *ocerts)
{
	PKCS8_PRIV_KEY_INFO *p8;
	X509 *x509;
	ASN1_TYPE *attrib;
	ASN1_BMPSTRING *fname = NULL;
	ASN1_OCTET_STRING *lkid = NULL;

	if ((attrib = PKCS12_get_attr(bag, NID_friendlyName)))
		fname = attrib->value.bmpstring;

	if ((attrib = PKCS12_get_attr(bag, NID_localKeyID)))
		lkid = attrib->value.octet_string;

	switch (OBJ_obj2nid(bag->type)) {
	case NID_keyBag:
		if (!pkey || *pkey)
			return 1;
		if (!(*pkey = EVP_PKCS82PKEY(bag->value.keybag)))







|



|


|







222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243

static int
parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, EVP_PKEY **pkey,
    STACK_OF(X509) *ocerts)
{
	PKCS8_PRIV_KEY_INFO *p8;
	X509 *x509;
	const ASN1_TYPE *attrib;
	ASN1_BMPSTRING *fname = NULL;
	ASN1_OCTET_STRING *lkid = NULL;

	if ((attrib = PKCS12_SAFEBAG_get0_attr(bag, NID_friendlyName)))
		fname = attrib->value.bmpstring;

	if ((attrib = PKCS12_SAFEBAG_get0_attr(bag, NID_localKeyID)))
		lkid = attrib->value.octet_string;

	switch (OBJ_obj2nid(bag->type)) {
	case NID_keyBag:
		if (!pkey || *pkey)
			return 1;
		if (!(*pkey = EVP_PKCS82PKEY(bag->value.keybag)))
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
			return 0;
		if (lkid && !X509_keyid_set1(x509, lkid->data, lkid->length)) {
			X509_free(x509);
			return 0;
		}
		if (fname) {
			int len, r;
			unsigned char *data;
			len = ASN1_STRING_to_UTF8(&data, fname);
			if (len >= 0) {
				r = X509_alias_set1(x509, data, len);
				free(data);
				if (!r) {
					X509_free(x509);
					return 0;







|







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
			return 0;
		if (lkid && !X509_keyid_set1(x509, lkid->data, lkid->length)) {
			X509_free(x509);
			return 0;
		}
		if (fname) {
			int len, r;
			unsigned char *data = NULL;
			len = ASN1_STRING_to_UTF8(&data, fname);
			if (len >= 0) {
				r = X509_alias_set1(x509, data, len);
				free(data);
				if (!r) {
					X509_free(x509);
					return 0;
Changes to jni/libressl/crypto/pkcs12/p12_mutl.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_mutl.c,v 1.27 2021/12/12 21:30:14 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_mutl.c,v 1.32 2022/08/20 09:16:18 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
66
67
68
69
70
71
72

73

































74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94

95
96
97
98

99
100

101
102
103

104

105
106
107
108
109
110
111
112


113

114
115

116

117
118
119


120

121
122
123
124
125
126
127
128

#include <openssl/err.h>
#include <openssl/hmac.h>
#include <openssl/pkcs12.h>

#include "evp_locl.h"
#include "hmac_local.h"

#include "x509_lcl.h"


































/* Generate a MAC */
int
PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
    unsigned char *mac, unsigned int *maclen)
{
	const EVP_MD *md_type;
	HMAC_CTX hmac;
	unsigned char key[EVP_MAX_MD_SIZE], *salt;
	int saltlen, iter;
	int md_size;


	if (!PKCS7_type_is_data(p12->authsafes)) {
		PKCS12error(PKCS12_R_CONTENT_TYPE_NOT_DATA);
		return 0;
	}

	salt = p12->mac->salt->data;
	saltlen = p12->mac->salt->length;
	if (!p12->mac->iter)
		iter = 1;

	else if ((iter = ASN1_INTEGER_get(p12->mac->iter)) <= 0) {
		PKCS12error(PKCS12_R_DECODE_ERROR);
		return 0;
	}

	if (!(md_type = EVP_get_digestbyobj(
	    p12->mac->dinfo->algor->algorithm))) {

		PKCS12error(PKCS12_R_UNKNOWN_DIGEST_ALGORITHM);
		return 0;
	}

	md_size = EVP_MD_size(md_type);

	if (md_size < 0)
		return 0;
	if (!PKCS12_key_gen(pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter,
	    md_size, key, md_type)) {
		PKCS12error(PKCS12_R_KEY_GEN_ERROR);
		return 0;
	}
	HMAC_CTX_init(&hmac);


	if (!HMAC_Init_ex(&hmac, key, md_size, md_type, NULL) ||

	    !HMAC_Update(&hmac, p12->authsafes->d.data->data,
	    p12->authsafes->d.data->length) ||

	    !HMAC_Final(&hmac, mac, maclen)) {

		HMAC_CTX_cleanup(&hmac);
		return 0;
	}


	HMAC_CTX_cleanup(&hmac);

	return 1;
}

/* Verify the mac */
int
PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen)
{
	unsigned char mac[EVP_MAX_MD_SIZE];







>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







|



>



|




|
|
>
|
|
|
|
>
|
|
>

|

>
|
>
|
<



|

|
>
>
|
>
|
|
>
|
>
|
|
|
>
>
|
>
|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

#include <openssl/err.h>
#include <openssl/hmac.h>
#include <openssl/pkcs12.h>

#include "evp_locl.h"
#include "hmac_local.h"
#include "pkcs12_local.h"
#include "x509_lcl.h"

int
PKCS12_mac_present(const PKCS12 *p12)
{
	return p12->mac != NULL;
}

void
PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, const X509_ALGOR **pmacalg,
    const ASN1_OCTET_STRING **psalt, const ASN1_INTEGER **piter,
    const PKCS12 *p12)
{
	if (p12->mac == NULL) {
		if (pmac != NULL)
			*pmac = NULL;
		if (pmacalg != NULL)
			*pmacalg = NULL;
		if (psalt != NULL)
			*psalt = NULL;
		if (piter != NULL)
			*piter = NULL;
		return;
	}

	if (pmac != NULL)
		*pmac = p12->mac->dinfo->digest;
	if (pmacalg != NULL)
		*pmacalg = p12->mac->dinfo->algor;
	if (psalt != NULL)
		*psalt = p12->mac->salt;
	if (piter != NULL)
		*piter = p12->mac->iter;
}

/* Generate a MAC */
int
PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
    unsigned char *mac, unsigned int *maclen)
{
	const EVP_MD *md_type;
	HMAC_CTX *hmac = NULL;
	unsigned char key[EVP_MAX_MD_SIZE], *salt;
	int saltlen, iter;
	int md_size;
	int ret = 0;

	if (!PKCS7_type_is_data(p12->authsafes)) {
		PKCS12error(PKCS12_R_CONTENT_TYPE_NOT_DATA);
		goto err;
	}

	salt = p12->mac->salt->data;
	saltlen = p12->mac->salt->length;

	iter = 1;
	if (p12->mac->iter != NULL) {
		if ((iter = ASN1_INTEGER_get(p12->mac->iter)) <= 0) {
			PKCS12error(PKCS12_R_DECODE_ERROR);
			goto err;
		}
	}

	md_type = EVP_get_digestbyobj(p12->mac->dinfo->algor->algorithm);
	if (md_type == NULL) {
		PKCS12error(PKCS12_R_UNKNOWN_DIGEST_ALGORITHM);
		goto err;
	}

	if ((md_size = EVP_MD_size(md_type)) < 0)
		goto err;


	if (!PKCS12_key_gen(pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter,
	    md_size, key, md_type)) {
		PKCS12error(PKCS12_R_KEY_GEN_ERROR);
		goto err;
	}

	if ((hmac = HMAC_CTX_new()) == NULL)
		goto err;
	if (!HMAC_Init_ex(hmac, key, md_size, md_type, NULL))
		goto err;
	if (!HMAC_Update(hmac, p12->authsafes->d.data->data,
	    p12->authsafes->d.data->length))
		goto err;
	if (!HMAC_Final(hmac, mac, maclen))
		goto err;

	ret = 1;

 err:
	explicit_bzero(key, sizeof(key));
	HMAC_CTX_free(hmac);

	return ret;
}

/* Verify the mac */
int
PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen)
{
	unsigned char mac[EVP_MAX_MD_SIZE];
170
171
172
173
174
175
176

177
178
179
180
181
182
183
184
}

/* Set up a mac structure */
int
PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
    const EVP_MD *md_type)
{

	if (!(p12->mac = PKCS12_MAC_DATA_new()))
		return PKCS12_ERROR;
	if (iter > 1) {
		if (!(p12->mac->iter = ASN1_INTEGER_new())) {
			PKCS12error(ERR_R_MALLOC_FAILURE);
			return 0;
		}
		if (!ASN1_INTEGER_set(p12->mac->iter, iter)) {







>
|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
}

/* Set up a mac structure */
int
PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
    const EVP_MD *md_type)
{
	PKCS12_MAC_DATA_free(p12->mac);
	if ((p12->mac = PKCS12_MAC_DATA_new()) == NULL)
		return PKCS12_ERROR;
	if (iter > 1) {
		if (!(p12->mac->iter = ASN1_INTEGER_new())) {
			PKCS12error(ERR_R_MALLOC_FAILURE);
			return 0;
		}
		if (!ASN1_INTEGER_set(p12->mac->iter, iter)) {
Changes to jni/libressl/crypto/pkcs12/p12_npas.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_npas.c,v 1.14 2021/11/01 20:53:08 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_npas.c,v 1.15 2022/08/20 09:16:18 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
59
60
61
62
63
64
65

66
67
68
69
70
71
72
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/pkcs12.h>


#include "x509_lcl.h"

/* PKCS#12 password change routine */

static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass);
static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *oldpass,
    const char *newpass);







>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/pkcs12.h>

#include "pkcs12_local.h"
#include "x509_lcl.h"

/* PKCS#12 password change routine */

static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass);
static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *oldpass,
    const char *newpass);
Added jni/libressl/crypto/pkcs12/p12_sbag.c.


































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* $OpenBSD: p12_sbag.c,v 1.5 2022/08/20 09:16:18 tb Exp $ */
/*
 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
 * 1999-2018.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licensing@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>

#include "pkcs12_local.h"
#include "x509_lcl.h"

const ASN1_TYPE *
PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, int attr_nid)
{
	return PKCS12_get_attr_gen(bag->attrib, attr_nid);
}

ASN1_TYPE *
PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid)
{
	return PKCS12_get_attr_gen(p8->attributes, attr_nid);
}

const PKCS8_PRIV_KEY_INFO *
PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag)
{
	if (PKCS12_SAFEBAG_get_nid(bag) != NID_keyBag)
		return NULL;

	return bag->value.keybag;
}

const X509_SIG *
PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag)
{
	if (PKCS12_SAFEBAG_get_nid(bag) != NID_pkcs8ShroudedKeyBag)
		return NULL;

	return bag->value.shkeybag;
}

const STACK_OF(PKCS12_SAFEBAG) *
PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag)
{
	if (PKCS12_SAFEBAG_get_nid(bag) != NID_safeContentsBag)
		return NULL;

	return bag->value.safes;
}

const ASN1_OBJECT *
PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag)
{
	return bag->type;
}

int
PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag)
{
	return OBJ_obj2nid(bag->type);
}

int
PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag)
{
	int bag_type;

	bag_type = PKCS12_SAFEBAG_get_nid(bag);

	if (bag_type == NID_certBag || bag_type == NID_crlBag ||
	    bag_type == NID_secretBag)
		return OBJ_obj2nid(bag->value.bag->type);

	return -1;
}

X509 *
PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag)
{
	if (OBJ_obj2nid(bag->type) != NID_certBag)
		return NULL;
	if (OBJ_obj2nid(bag->value.bag->type) != NID_x509Certificate)
		return NULL;
	return ASN1_item_unpack(bag->value.bag->value.octet, &X509_it);
}

X509_CRL *
PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag)
{
	if (OBJ_obj2nid(bag->type) != NID_crlBag)
		return NULL;
	if (OBJ_obj2nid(bag->value.bag->type) != NID_x509Crl)
		return NULL;
	return ASN1_item_unpack(bag->value.bag->value.octet, &X509_CRL_it);
}

PKCS12_SAFEBAG *
PKCS12_SAFEBAG_create_cert(X509 *x509)
{
	return PKCS12_item_pack_safebag(x509, &X509_it,
	    NID_x509Certificate, NID_certBag);
}

PKCS12_SAFEBAG *
PKCS12_SAFEBAG_create_crl(X509_CRL *crl)
{
	return PKCS12_item_pack_safebag(crl, &X509_CRL_it,
	    NID_x509Crl, NID_crlBag);
}

/* Turn PKCS8 object into a keybag */

PKCS12_SAFEBAG *
PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8)
{
	PKCS12_SAFEBAG *bag;

	if ((bag = PKCS12_SAFEBAG_new()) == NULL) {
		PKCS12error(ERR_R_MALLOC_FAILURE);
		return NULL;
	}

	bag->type = OBJ_nid2obj(NID_keyBag);
	bag->value.keybag = p8;

	return bag;
}

/* Turn PKCS8 object into a shrouded keybag */

PKCS12_SAFEBAG *
PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8)
{
	PKCS12_SAFEBAG *bag;

	/* Set up the safe bag */
	if ((bag = PKCS12_SAFEBAG_new()) == NULL) {
		PKCS12error(ERR_R_MALLOC_FAILURE);
		return NULL;
	}

	bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag);
	bag->value.shkeybag = p8;

	return bag;
}

PKCS12_SAFEBAG *
PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, const char *pass, int passlen,
    unsigned char *salt, int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8info)
{
	const EVP_CIPHER *pbe_ciph;
	X509_SIG *p8;
	PKCS12_SAFEBAG *bag;

	if ((pbe_ciph = EVP_get_cipherbynid(pbe_nid)) != NULL)
		pbe_nid = -1;

	if ((p8 = PKCS8_encrypt(pbe_nid, pbe_ciph, pass, passlen, salt, saltlen,
	    iter, p8info)) == NULL)
		return NULL;

	if ((bag = PKCS12_SAFEBAG_create0_pkcs8(p8)) == NULL) {
		X509_SIG_free(p8);
		return NULL;
	}

	return bag;
}
Changes to jni/libressl/crypto/pkcs12/p12_utl.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: p12_utl.c,v 1.16 2018/05/30 15:32:11 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: p12_utl.c,v 1.19 2022/09/11 17:30:13 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
57
58
59
60
61
62
63


64
65
66
67
68
69
70
 */

#include <limits.h>
#include <stdio.h>
#include <string.h>

#include <openssl/pkcs12.h>



/* Cheap and nasty Unicode stuff */

unsigned char *
OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen)
{
	size_t ulen, i;







>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 */

#include <limits.h>
#include <stdio.h>
#include <string.h>

#include <openssl/pkcs12.h>

#include "pkcs12_local.h"

/* Cheap and nasty Unicode stuff */

unsigned char *
OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen)
{
	size_t ulen, i;
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
}

PKCS12 *
d2i_PKCS12_fp(FILE *fp, PKCS12 **p12)
{
	    return ASN1_item_d2i_fp(&PKCS12_it, fp, p12);
}

PKCS12_SAFEBAG *
PKCS12_x5092certbag(X509 *x509)
{
	return PKCS12_item_pack_safebag(x509, &X509_it,
	    NID_x509Certificate, NID_certBag);
}

PKCS12_SAFEBAG *
PKCS12_x509crl2certbag(X509_CRL *crl)
{
	return PKCS12_item_pack_safebag(crl, &X509_CRL_it,
	    NID_x509Crl, NID_crlBag);
}

X509 *
PKCS12_certbag2x509(PKCS12_SAFEBAG *bag)
{
	if (OBJ_obj2nid(bag->type) != NID_certBag)
		return NULL;
	if (OBJ_obj2nid(bag->value.bag->type) != NID_x509Certificate)
		return NULL;
	return ASN1_item_unpack(bag->value.bag->value.octet,
	    &X509_it);
}

X509_CRL *
PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag)
{
	if (OBJ_obj2nid(bag->type) != NID_crlBag)
		return NULL;
	if (OBJ_obj2nid(bag->value.bag->type) != NID_x509Crl)
		return NULL;
	return ASN1_item_unpack(bag->value.bag->value.octet,
	    &X509_CRL_it);
}







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
145
146
147
148
149
150
151




































}

PKCS12 *
d2i_PKCS12_fp(FILE *fp, PKCS12 **p12)
{
	    return ASN1_item_d2i_fp(&PKCS12_it, fp, p12);
}




































Changes to jni/libressl/crypto/pkcs12/pk12err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: pk12err.c,v 1.11 2020/06/05 16:51:12 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pk12err.c,v 1.12 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS12,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS12,0,reason)

static ERR_STRING_DATA PKCS12_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/pkcs12.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS12,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS12,0,reason)

static ERR_STRING_DATA PKCS12_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Added jni/libressl/crypto/pkcs12/pkcs12_local.h.










































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* $OpenBSD: pkcs12_local.h,v 1.2 2022/09/11 17:30:13 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licensing@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#ifndef HEADER_PKCS12_LOCAL_H
#define HEADER_PKCS12_LOCAL_H

__BEGIN_HIDDEN_DECLS

struct PKCS12_MAC_DATA_st {
	X509_SIG *dinfo;
	ASN1_OCTET_STRING *salt;
	ASN1_INTEGER *iter;	/* defaults to 1 */
};

struct PKCS12_st {
	ASN1_INTEGER *version;
	PKCS12_MAC_DATA *mac;
	PKCS7 *authsafes;
};

struct PKCS12_SAFEBAG_st {
	ASN1_OBJECT *type;
	union {
	struct pkcs12_bag_st *bag; /* secret, crl and certbag */
	struct pkcs8_priv_key_info_st	*keybag; /* keybag */
	X509_SIG *shkeybag; /* shrouded key bag */
		STACK_OF(PKCS12_SAFEBAG) *safes;
		ASN1_TYPE *other;
	} value;
	STACK_OF(X509_ATTRIBUTE) *attrib;
};

struct pkcs12_bag_st {
	ASN1_OBJECT *type;
	union {
		ASN1_OCTET_STRING *x509cert;
		ASN1_OCTET_STRING *x509crl;
		ASN1_OCTET_STRING *octet;
		ASN1_IA5STRING *sdsicert;
		ASN1_TYPE *other; /* Secret or other bag */
	} value;
};

__END_HIDDEN_DECLS

#endif /* HEADER_PKCS12_LOCAL_H */
Changes to jni/libressl/crypto/pkcs7/pk7_doit.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: pk7_doit.c,v 1.46 2021/12/12 21:30:14 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pk7_doit.c,v 1.47 2022/05/09 19:19:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
	ASN1_OBJECT *o;

	o = OBJ_nid2obj(nid);
	if (!o || !sk)
		return (NULL);
	for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) {
		xa = sk_X509_ATTRIBUTE_value(sk, i);
		if (OBJ_cmp(xa->object, o) == 0) {
			if (!xa->single && sk_ASN1_TYPE_num(xa->value.set))
				return (sk_ASN1_TYPE_value(xa->value.set, 0));
			else
				return (NULL);
		}
	}
	return (NULL);
}

ASN1_OCTET_STRING *
PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk)
{







|
<
|
<
<
<







1125
1126
1127
1128
1129
1130
1131
1132

1133



1134
1135
1136
1137
1138
1139
1140
	ASN1_OBJECT *o;

	o = OBJ_nid2obj(nid);
	if (!o || !sk)
		return (NULL);
	for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) {
		xa = sk_X509_ATTRIBUTE_value(sk, i);
		if (OBJ_cmp(xa->object, o) == 0)

			return (sk_ASN1_TYPE_value(xa->set, 0));



	}
	return (NULL);
}

ASN1_OCTET_STRING *
PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk)
{
Changes to jni/libressl/crypto/pkcs7/pkcs7err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs7err.c,v 1.12 2020/06/05 16:51:12 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs7err.c,v 1.13 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/pkcs7.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS7,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS7,0,reason)

static ERR_STRING_DATA PKCS7_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/pkcs7.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS7,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS7,0,reason)

static ERR_STRING_DATA PKCS7_str_functs[]= {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/rand/rand_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: rand_err.c,v 1.15 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: rand_err.c,v 1.16 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/rand.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RAND,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RAND,0,reason)

static ERR_STRING_DATA RAND_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/rand.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RAND,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RAND,0,reason)

static ERR_STRING_DATA RAND_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/rsa/rsa_ameth.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: rsa_ameth.c,v 1.25 2022/01/10 11:52:43 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: rsa_ameth.c,v 1.26 2022/06/27 12:36:06 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2006.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
266
267
268
269
270
271
272






273
274
275
276
277
278
279
}

static int
rsa_bits(const EVP_PKEY *pkey)
{
	return BN_num_bits(pkey->pkey.rsa->n);
}







static void
int_rsa_free(EVP_PKEY *pkey)
{
	RSA_free(pkey->pkey.rsa);
}








>
>
>
>
>
>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
}

static int
rsa_bits(const EVP_PKEY *pkey)
{
	return BN_num_bits(pkey->pkey.rsa->n);
}

static int
rsa_security_bits(const EVP_PKEY *pkey)
{
	return RSA_security_bits(pkey->pkey.rsa);
}

static void
int_rsa_free(EVP_PKEY *pkey)
{
	RSA_free(pkey->pkey.rsa);
}

1099
1100
1101
1102
1103
1104
1105

1106
1107
1108
1109
1110
1111
1112

		.priv_decode = rsa_priv_decode,
		.priv_encode = rsa_priv_encode,
		.priv_print = rsa_priv_print,

		.pkey_size = int_rsa_size,
		.pkey_bits = rsa_bits,


		.sig_print = rsa_sig_print,

		.pkey_free = int_rsa_free,
		.pkey_ctrl = rsa_pkey_ctrl,
		.old_priv_decode = old_rsa_priv_decode,
		.old_priv_encode = old_rsa_priv_encode,







>







1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119

		.priv_decode = rsa_priv_decode,
		.priv_encode = rsa_priv_encode,
		.priv_print = rsa_priv_print,

		.pkey_size = int_rsa_size,
		.pkey_bits = rsa_bits,
		.pkey_security_bits = rsa_security_bits,

		.sig_print = rsa_sig_print,

		.pkey_free = int_rsa_free,
		.pkey_ctrl = rsa_pkey_ctrl,
		.old_priv_decode = old_rsa_priv_decode,
		.old_priv_encode = old_rsa_priv_encode,
Changes to jni/libressl/crypto/rsa/rsa_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: rsa_err.c,v 1.20 2019/11/01 15:13:05 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: rsa_err.c,v 1.21 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/rsa.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason)

static ERR_STRING_DATA RSA_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/rsa.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason)

static ERR_STRING_DATA RSA_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/rsa/rsa_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: rsa_lib.c,v 1.42 2022/01/07 09:55:32 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: rsa_lib.c,v 1.43 2022/06/27 12:30:28 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
236
237
238
239
240
241
242






243
244
245
246
247
248
249
}

void *
RSA_get_ex_data(const RSA *r, int idx)
{
	return CRYPTO_get_ex_data(&r->ex_data, idx);
}







void
RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
{
	if (n != NULL)
		*n = r->n;
	if (e != NULL)







>
>
>
>
>
>







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
}

void *
RSA_get_ex_data(const RSA *r, int idx)
{
	return CRYPTO_get_ex_data(&r->ex_data, idx);
}

int
RSA_security_bits(const RSA *rsa)
{
	return BN_security_bits(RSA_bits(rsa), -1);
}

void
RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
{
	if (n != NULL)
		*n = r->n;
	if (e != NULL)
Changes to jni/libressl/crypto/rsa/rsa_locl.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* $OpenBSD: rsa_locl.h,v 1.12 2022/01/14 08:34:39 tb Exp $ */

__BEGIN_HIDDEN_DECLS

#define RSA_MIN_MODULUS_BITS	512

/* Macros to test if a pkey or ctx is for a PSS key */
#define pkey_is_pss(pkey) (pkey->ameth->pkey_id == EVP_PKEY_RSA_PSS)
#define pkey_ctx_is_pss(ctx) (ctx->pmeth->pkey_id == EVP_PKEY_RSA_PSS)

struct rsa_meth_st {
	const char *name;
	int (*rsa_pub_enc)(int flen, const unsigned char *from,
	    unsigned char *to, RSA *rsa, int padding);
	int (*rsa_pub_dec)(int flen, const unsigned char *from,
	    unsigned char *to, RSA *rsa, int padding);
	int (*rsa_priv_enc)(int flen, const unsigned char *from,
	    unsigned char *to, RSA *rsa, int padding);
	int (*rsa_priv_dec)(int flen, const unsigned char *from,
|










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* $OpenBSD: rsa_locl.h,v 1.13 2022/07/04 12:23:30 tb Exp $ */

__BEGIN_HIDDEN_DECLS

#define RSA_MIN_MODULUS_BITS	512

/* Macros to test if a pkey or ctx is for a PSS key */
#define pkey_is_pss(pkey) (pkey->ameth->pkey_id == EVP_PKEY_RSA_PSS)
#define pkey_ctx_is_pss(ctx) (ctx->pmeth->pkey_id == EVP_PKEY_RSA_PSS)

struct rsa_meth_st {
	char *name;
	int (*rsa_pub_enc)(int flen, const unsigned char *from,
	    unsigned char *to, RSA *rsa, int padding);
	int (*rsa_pub_dec)(int flen, const unsigned char *from,
	    unsigned char *to, RSA *rsa, int padding);
	int (*rsa_priv_enc)(int flen, const unsigned char *from,
	    unsigned char *to, RSA *rsa, int padding);
	int (*rsa_priv_dec)(int flen, const unsigned char *from,
Changes to jni/libressl/crypto/rsa/rsa_meth.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: rsa_meth.c,v 1.4 2022/01/07 09:55:32 tb Exp $	*/
/*
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: rsa_meth.c,v 1.5 2022/07/04 12:23:30 tb Exp $	*/
/*
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
38
39
40
41
42
43
44
45


46
47
48
49
50
51
52
53
54
55

	return meth;
}

void
RSA_meth_free(RSA_METHOD *meth)
{
	if (meth != NULL) {


		free((char *)meth->name);
		free(meth);
	}
}

RSA_METHOD *
RSA_meth_dup(const RSA_METHOD *meth)
{
	RSA_METHOD *copy;








|
>
>
|
|
<







38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56

	return meth;
}

void
RSA_meth_free(RSA_METHOD *meth)
{
	if (meth == NULL)
		return;

	free(meth->name);
	free(meth);

}

RSA_METHOD *
RSA_meth_dup(const RSA_METHOD *meth)
{
	RSA_METHOD *copy;

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

	return copy;
}

int
RSA_meth_set1_name(RSA_METHOD *meth, const char *name)
{
	char *copy;

	if ((copy = strdup(name)) == NULL)
		return 0;
	free((char *)meth->name);
	meth->name = copy;
	return 1;
}

int
(*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa)
{
	return meth->finish;







|

|

|
|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

	return copy;
}

int
RSA_meth_set1_name(RSA_METHOD *meth, const char *name)
{
	char *new_name;

	if ((new_name = strdup(name)) == NULL)
		return 0;
	free(meth->name);
	meth->name = new_name;
	return 1;
}

int
(*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa)
{
	return meth->finish;
Changes to jni/libressl/crypto/ts/ts_asn1.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_asn1.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */
/* Written by Nils Larsch for the OpenSSL project 2004.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_asn1.c,v 1.13 2022/07/24 08:16:47 tb Exp $ */
/* Written by Nils Larsch for the OpenSSL project 2004.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
56
57
58
59
60
61
62


63
64
65
66
67
68
69
 */

#include <openssl/opensslconf.h>

#include <openssl/ts.h>
#include <openssl/err.h>
#include <openssl/asn1t.h>



static const ASN1_TEMPLATE TS_MSG_IMPRINT_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(TS_MSG_IMPRINT, hash_algo),
		.field_name = "hash_algo",







>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 */

#include <openssl/opensslconf.h>

#include <openssl/ts.h>
#include <openssl/err.h>
#include <openssl/asn1t.h>

#include "ts_local.h"

static const ASN1_TEMPLATE TS_MSG_IMPRINT_seq_tt[] = {
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(TS_MSG_IMPRINT, hash_algo),
		.field_name = "hash_algo",
841
842
843
844
845
846
847



























































































































848
849
850
851
852
853
854
}

ESS_SIGNING_CERT *
ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *x)
{
	return ASN1_item_dup(&ESS_SIGNING_CERT_it, x);
}




























































































































/* Getting encapsulated TS_TST_INFO object from PKCS7. */
TS_TST_INFO *
PKCS7_to_TS_TST_INFO(PKCS7 *token)
{
	PKCS7_SIGNED *pkcs7_signed;
	PKCS7 *enveloped;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
}

ESS_SIGNING_CERT *
ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *x)
{
	return ASN1_item_dup(&ESS_SIGNING_CERT_it, x);
}

static const ASN1_TEMPLATE ESS_CERT_ID_V2_seq_tt[] = {
	{
		.flags = ASN1_TFLG_OPTIONAL,
		.tag = 0,
		.offset = offsetof(ESS_CERT_ID_V2, hash_alg),
		.field_name = "hash_alg",
		.item = &X509_ALGOR_it,
	},
	{
		.flags = 0,
		.tag = 0,
		.offset = offsetof(ESS_CERT_ID_V2, hash),
		.field_name = "hash",
		.item = &ASN1_OCTET_STRING_it,
	},
	{
		.flags = ASN1_TFLG_OPTIONAL,
		.tag = 0,
		.offset = offsetof(ESS_CERT_ID_V2, issuer_serial),
		.field_name = "issuer_serial",
		.item = &ESS_ISSUER_SERIAL_it,
	},
};

static const ASN1_ITEM ESS_CERT_ID_V2_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = ESS_CERT_ID_V2_seq_tt,
	.tcount = sizeof(ESS_CERT_ID_V2_seq_tt) / sizeof(ASN1_TEMPLATE),
	.funcs = NULL,
	.size = sizeof(ESS_CERT_ID_V2),
	.sname = "ESS_CERT_ID_V2",
};

ESS_CERT_ID_V2 *
d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, const unsigned char **in, long len)
{
	return (ESS_CERT_ID_V2 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
	    &ESS_CERT_ID_V2_it);
}

int
i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ESS_CERT_ID_V2_it);
}

ESS_CERT_ID_V2 *
ESS_CERT_ID_V2_new(void)
{
	return (ESS_CERT_ID_V2 *)ASN1_item_new(&ESS_CERT_ID_V2_it);
}

void
ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ESS_CERT_ID_V2_it);
}

ESS_CERT_ID_V2 *
ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *x)
{
	return ASN1_item_dup(&ESS_CERT_ID_V2_it, x);
}

static const ASN1_TEMPLATE ESS_SIGNING_CERT_V2_seq_tt[] = {
	{
		.flags = ASN1_TFLG_SEQUENCE_OF,
		.tag = 0,
		.offset = offsetof(ESS_SIGNING_CERT_V2, cert_ids),
		.field_name = "cert_ids",
		.item = &ESS_CERT_ID_V2_it,
	},
	{
		.flags = ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL,
		.tag = 0,
		.offset = offsetof(ESS_SIGNING_CERT_V2, policy_info),
		.field_name = "policy_info",
		.item = &POLICYINFO_it,
	},
};

static const ASN1_ITEM ESS_SIGNING_CERT_V2_it = {
	.itype = ASN1_ITYPE_SEQUENCE,
	.utype = V_ASN1_SEQUENCE,
	.templates = ESS_SIGNING_CERT_V2_seq_tt,
	.tcount = sizeof(ESS_SIGNING_CERT_V2_seq_tt) / sizeof(ASN1_TEMPLATE),
	.funcs = NULL,
	.size = sizeof(ESS_SIGNING_CERT_V2),
	.sname = "ESS_SIGNING_CERT_V2",
};

ESS_SIGNING_CERT_V2 *
d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, const unsigned char **in, long len)
{
	return (ESS_SIGNING_CERT_V2 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
	    &ESS_SIGNING_CERT_V2_it);
}

int
i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **out)
{
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &ESS_SIGNING_CERT_V2_it);
}

ESS_SIGNING_CERT_V2 *
ESS_SIGNING_CERT_V2_new(void)
{
	return (ESS_SIGNING_CERT_V2 *)ASN1_item_new(&ESS_SIGNING_CERT_V2_it);
}

void
ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a)
{
	ASN1_item_free((ASN1_VALUE *)a, &ESS_SIGNING_CERT_V2_it);
}

ESS_SIGNING_CERT_V2 *
ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *x)
{
	return ASN1_item_dup(&ESS_SIGNING_CERT_V2_it, x);
}

/* Getting encapsulated TS_TST_INFO object from PKCS7. */
TS_TST_INFO *
PKCS7_to_TS_TST_INFO(PKCS7 *token)
{
	PKCS7_SIGNED *pkcs7_signed;
	PKCS7 *enveloped;
Changes to jni/libressl/crypto/ts/ts_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_err.c,v 1.5 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_err.c,v 1.6 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ts.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason)

static ERR_STRING_DATA TS_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ts.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason)

static ERR_STRING_DATA TS_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Added jni/libressl/crypto/ts/ts_local.h.
























































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/* $OpenBSD: ts_local.h,v 1.2 2022/09/11 17:31:19 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL
 * project 2002, 2003, 2004.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licensing@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#ifndef HEADER_TS_LOCAL_H
#define HEADER_TS_LOCAL_H

__BEGIN_HIDDEN_DECLS

/*
 * MessageImprint ::= SEQUENCE  {
 *      hashAlgorithm                AlgorithmIdentifier,
 *      hashedMessage                OCTET STRING  }
 */

struct TS_msg_imprint_st {
	X509_ALGOR *hash_algo;
	ASN1_OCTET_STRING *hashed_msg;
};

/*
 * TimeStampReq ::= SEQUENCE  {
 *    version                  INTEGER  { v1(1) },
 *    messageImprint           MessageImprint,
 *      --a hash algorithm OID and the hash value of the data to be
 *      --time-stamped
 *    reqPolicy                TSAPolicyId                OPTIONAL,
 *    nonce                    INTEGER                    OPTIONAL,
 *    certReq                  BOOLEAN                    DEFAULT FALSE,
 *    extensions               [0] IMPLICIT Extensions    OPTIONAL  }
 */

struct TS_req_st {
	ASN1_INTEGER *version;
	TS_MSG_IMPRINT *msg_imprint;
	ASN1_OBJECT *policy_id;		/* OPTIONAL */
	ASN1_INTEGER *nonce;		/* OPTIONAL */
	ASN1_BOOLEAN cert_req;		/* DEFAULT FALSE */
	STACK_OF(X509_EXTENSION) *extensions;	/* [0] OPTIONAL */
};

/*
 * Accuracy ::= SEQUENCE {
 *                 seconds        INTEGER           OPTIONAL,
 *                 millis     [0] INTEGER  (1..999) OPTIONAL,
 *                 micros     [1] INTEGER  (1..999) OPTIONAL  }
 */

struct TS_accuracy_st {
	ASN1_INTEGER *seconds;
	ASN1_INTEGER *millis;
	ASN1_INTEGER *micros;
};

/*
 * TSTInfo ::= SEQUENCE  {
 *     version                      INTEGER  { v1(1) },
 *     policy                       TSAPolicyId,
 *     messageImprint               MessageImprint,
 *       -- MUST have the same value as the similar field in
 *       -- TimeStampReq
 *     serialNumber                 INTEGER,
 *      -- Time-Stamping users MUST be ready to accommodate integers
 *      -- up to 160 bits.
 *     genTime                      GeneralizedTime,
 *     accuracy                     Accuracy                 OPTIONAL,
 *     ordering                     BOOLEAN             DEFAULT FALSE,
 *     nonce                        INTEGER                  OPTIONAL,
 *       -- MUST be present if the similar field was present
 *       -- in TimeStampReq.  In that case it MUST have the same value.
 *     tsa                          [0] GeneralName          OPTIONAL,
 *     extensions                   [1] IMPLICIT Extensions  OPTIONAL   }
 */

struct TS_tst_info_st {
	ASN1_INTEGER *version;
	ASN1_OBJECT *policy_id;
	TS_MSG_IMPRINT *msg_imprint;
	ASN1_INTEGER *serial;
	ASN1_GENERALIZEDTIME *time;
	TS_ACCURACY *accuracy;
	ASN1_BOOLEAN ordering;
	ASN1_INTEGER *nonce;
	GENERAL_NAME *tsa;
	STACK_OF(X509_EXTENSION) *extensions;
};

/*
 * PKIStatusInfo ::= SEQUENCE {
 *     status        PKIStatus,
 *     statusString  PKIFreeText     OPTIONAL,
 *     failInfo      PKIFailureInfo  OPTIONAL  }
 *
 * From RFC 1510 - section 3.1.1:
 * PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
 *	-- text encoded as UTF-8 String (note:  each UTF8String SHOULD
 *	-- include an RFC 1766 language tag to indicate the language
 *	-- of the contained text)
 */

struct TS_status_info_st {
	ASN1_INTEGER *status;
	STACK_OF(ASN1_UTF8STRING) *text;
	ASN1_BIT_STRING *failure_info;
};

/*
 * TimeStampResp ::= SEQUENCE  {
 *      status                  PKIStatusInfo,
 *      timeStampToken          TimeStampToken     OPTIONAL }
 */

struct TS_resp_st {
	TS_STATUS_INFO *status_info;
	PKCS7 *token;
	TS_TST_INFO *tst_info;
};

/* The structure below would belong to the ESS component. */

/*
 * IssuerSerial ::= SEQUENCE {
 *	issuer                   GeneralNames,
 *	serialNumber             CertificateSerialNumber
 *	}
 */

struct ESS_issuer_serial {
	STACK_OF(GENERAL_NAME)	*issuer;
	ASN1_INTEGER		*serial;
};

/*
 * ESSCertID ::=  SEQUENCE {
 *      certHash                 Hash,
 *      issuerSerial             IssuerSerial OPTIONAL
 * }
 */

struct ESS_cert_id {
	ASN1_OCTET_STRING *hash;	/* Always SHA-1 digest. */
	ESS_ISSUER_SERIAL *issuer_serial;
};

/*
 * SigningCertificate ::=  SEQUENCE {
 *        certs        SEQUENCE OF ESSCertID,
 *        policies     SEQUENCE OF PolicyInformation OPTIONAL
 * }
 */

struct ESS_signing_cert {
	STACK_OF(ESS_CERT_ID) *cert_ids;
	STACK_OF(POLICYINFO) *policy_info;
};

/*
 * ESSCertIDv2 ::=  SEQUENCE {
 *     hashAlgorithm           AlgorithmIdentifier
 *            DEFAULT {algorithm id-sha256},
 *     certHash                 Hash,
 *     issuerSerial             IssuerSerial OPTIONAL }
 */

struct ESS_cert_id_v2 {
	X509_ALGOR *hash_alg;	/* Default SHA-256. */
	ASN1_OCTET_STRING *hash;
	ESS_ISSUER_SERIAL *issuer_serial;
};

/*
 * SigningCertificateV2 ::=  SEQUENCE {
 *     certs        SEQUENCE OF ESSCertIDv2,
 *     policies     SEQUENCE OF PolicyInformation OPTIONAL }
 */

struct ESS_signing_cert_v2 {
	STACK_OF(ESS_CERT_ID_V2) *cert_ids;
	STACK_OF(POLICYINFO) *policy_info;
};

struct TS_resp_ctx {
	X509		*signer_cert;
	EVP_PKEY	*signer_key;
	STACK_OF(X509)	*certs;	/* Certs to include in signed data. */
	STACK_OF(ASN1_OBJECT)	*policies;	/* Acceptable policies. */
	ASN1_OBJECT	*default_policy; /* It may appear in policies, too. */
	STACK_OF(EVP_MD)	*mds;	/* Acceptable message digests. */
	ASN1_INTEGER	*seconds;	/* accuracy, 0 means not specified. */
	ASN1_INTEGER	*millis;	/* accuracy, 0 means not specified. */
	ASN1_INTEGER	*micros;	/* accuracy, 0 means not specified. */
	unsigned	clock_precision_digits; /* fraction of seconds in
						   time stamp token. */
	unsigned	flags;		/* Optional info, see values above. */

	/* Callback functions. */
	TS_serial_cb serial_cb;
	void *serial_cb_data;	/* User data for serial_cb. */

	TS_time_cb time_cb;
	void *time_cb_data;	/* User data for time_cb. */

	TS_extension_cb extension_cb;
	void *extension_cb_data;	/* User data for extension_cb. */

	/* These members are used only while creating the response. */
	TS_REQ		*request;
	TS_RESP		*response;
	TS_TST_INFO	*tst_info;
};

/* Context structure for the generic verify method. */

struct TS_verify_ctx {
	/* Set this to the union of TS_VFY_... flags you want to carry out. */
	unsigned	flags;

	/* Must be set only with TS_VFY_SIGNATURE. certs is optional. */
	X509_STORE	*store;
	STACK_OF(X509)	*certs;

	/* Must be set only with TS_VFY_POLICY. */
	ASN1_OBJECT	*policy;

	/* Must be set only with TS_VFY_IMPRINT. If md_alg is NULL,
	   the algorithm from the response is used. */
	X509_ALGOR	*md_alg;
	unsigned char	*imprint;
	unsigned	imprint_len;

	/* Must be set only with TS_VFY_DATA. */
	BIO		*data;

	/* Must be set only with TS_VFY_TSA_NAME. */
	ASN1_INTEGER	*nonce;

	/* Must be set only with TS_VFY_TSA_NAME. */
	GENERAL_NAME	*tsa_name;
};

/*
 * Public OpenSSL API that we do not currently want to expose.
 */

ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void);
void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a);
int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp);
ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, const unsigned char **pp,
    long length);
ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a);

ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void);
void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a);
int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a,
    unsigned char **pp);
ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a,
    const unsigned char **pp, long length);
ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a);

__END_HIDDEN_DECLS

#endif /* HEADER_TS_LOCAL_H */
Changes to jni/libressl/crypto/ts/ts_req_utils.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_req_utils.c,v 1.6 2018/05/13 15:04:05 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_req_utils.c,v 1.7 2022/07/24 08:16:47 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
58
59
60
61
62
63
64


65
66
67
68
69
70
71

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/ts.h>
#include <openssl/x509v3.h>



int
TS_REQ_set_version(TS_REQ *a, long version)
{
	return ASN1_INTEGER_set(a->version, version);
}








>
>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/ts.h>
#include <openssl/x509v3.h>

#include "ts_local.h"

int
TS_REQ_set_version(TS_REQ *a, long version)
{
	return ASN1_INTEGER_set(a->version, version);
}

Changes to jni/libressl/crypto/ts/ts_rsp_print.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_print.c,v 1.5 2014/07/11 08:44:49 jsing Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_print.c,v 1.6 2022/07/24 08:16:47 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
58
59
60
61
62
63
64


65
66
67
68
69
70
71

#include <stdio.h>

#include <openssl/bn.h>
#include <openssl/objects.h>
#include <openssl/ts.h>
#include <openssl/x509v3.h>



struct status_map_st {
	int bit;
	const char *text;
};

/* Local function declarations. */







>
>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

#include <stdio.h>

#include <openssl/bn.h>
#include <openssl/objects.h>
#include <openssl/ts.h>
#include <openssl/x509v3.h>

#include "ts_local.h"

struct status_map_st {
	int bit;
	const char *text;
};

/* Local function declarations. */
Changes to jni/libressl/crypto/ts/ts_rsp_sign.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_sign.c,v 1.26 2021/12/12 21:30:14 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_sign.c,v 1.29 2022/07/24 20:02:04 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
62
63
64
65
66
67
68

69
70
71
72
73
74
75

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>
#include <openssl/ts.h>

#include "evp_locl.h"

#include "x509_lcl.h"

/* Private function declarations. */

static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *, void *);
static int def_time_cb(struct TS_resp_ctx *, void *, time_t *sec, long *usec);
static int def_extension_cb(struct TS_resp_ctx *, X509_EXTENSION *, void *);







>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>
#include <openssl/ts.h>

#include "evp_locl.h"
#include "ts_local.h"
#include "x509_lcl.h"

/* Private function declarations. */

static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *, void *);
static int def_time_cb(struct TS_resp_ctx *, void *, time_t *sec, long *usec);
static int def_extension_cb(struct TS_resp_ctx *, X509_EXTENSION *, void *);
137
138
139
140
141
142
143







144
145
146
147
148
149
150
{
	/* No extensions are processed here. */
	TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
	    "Unsupported extension.");
	TS_RESP_CTX_add_failure_info(ctx, TS_INFO_UNACCEPTED_EXTENSION);
	return 0;
}








/* TS_RESP_CTX management functions. */

TS_RESP_CTX *
TS_RESP_CTX_new(void)
{
	TS_RESP_CTX *ctx;







>
>
>
>
>
>
>







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
{
	/* No extensions are processed here. */
	TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
	    "Unsupported extension.");
	TS_RESP_CTX_add_failure_info(ctx, TS_INFO_UNACCEPTED_EXTENSION);
	return 0;
}

void
TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data)
{
	ctx->time_cb = cb;
	ctx->time_cb_data = data;
}

/* TS_RESP_CTX management functions. */

TS_RESP_CTX *
TS_RESP_CTX_new(void)
{
	TS_RESP_CTX *ctx;
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664

	/* Setting TSA name to subject of signer certificate. */
	if (ctx->flags & TS_TSA_NAME) {
		if (!(tsa_name = GENERAL_NAME_new()))
			goto end;
		tsa_name->type = GEN_DIRNAME;
		tsa_name->d.dirn =
		    X509_NAME_dup(ctx->signer_cert->cert_info->subject);
		if (!tsa_name->d.dirn)
			goto end;
		if (!TS_TST_INFO_set_tsa(tst_info, tsa_name))
			goto end;
	}

	result = 1;







|







658
659
660
661
662
663
664
665
666
667
668
669
670
671
672

	/* Setting TSA name to subject of signer certificate. */
	if (ctx->flags & TS_TSA_NAME) {
		if (!(tsa_name = GENERAL_NAME_new()))
			goto end;
		tsa_name->type = GEN_DIRNAME;
		tsa_name->d.dirn =
		    X509_NAME_dup(X509_get_subject_name(ctx->signer_cert));
		if (!tsa_name->d.dirn)
			goto end;
		if (!TS_TST_INFO_set_tsa(tst_info, tsa_name))
			goto end;
	}

	result = 1;
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
		if (!cid->issuer_serial &&
		    !(cid->issuer_serial = ESS_ISSUER_SERIAL_new()))
			goto err;
		/* Creating general name from the certificate issuer. */
		if (!(name = GENERAL_NAME_new()))
			goto err;
		name->type = GEN_DIRNAME;
		if (!(name->d.dirn = X509_NAME_dup(cert->cert_info->issuer)))
			goto err;
		if (!sk_GENERAL_NAME_push(cid->issuer_serial->issuer, name))
			goto err;
		name = NULL;	/* Ownership is lost. */
		/* Setting the serial number. */
		ASN1_INTEGER_free(cid->issuer_serial->serial);
		if (!(cid->issuer_serial->serial =
		    ASN1_INTEGER_dup(cert->cert_info->serialNumber)))
			goto err;
	}

	return cid;

err:
	GENERAL_NAME_free(name);







|







|







878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
		if (!cid->issuer_serial &&
		    !(cid->issuer_serial = ESS_ISSUER_SERIAL_new()))
			goto err;
		/* Creating general name from the certificate issuer. */
		if (!(name = GENERAL_NAME_new()))
			goto err;
		name->type = GEN_DIRNAME;
		if ((name->d.dirn = X509_NAME_dup(X509_get_issuer_name(cert))) == NULL)
			goto err;
		if (!sk_GENERAL_NAME_push(cid->issuer_serial->issuer, name))
			goto err;
		name = NULL;	/* Ownership is lost. */
		/* Setting the serial number. */
		ASN1_INTEGER_free(cid->issuer_serial->serial);
		if (!(cid->issuer_serial->serial =
		    ASN1_INTEGER_dup(X509_get_serialNumber(cert))))
			goto err;
	}

	return cid;

err:
	GENERAL_NAME_free(name);
Changes to jni/libressl/crypto/ts/ts_rsp_utils.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_utils.c,v 1.7 2018/05/13 15:35:46 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_utils.c,v 1.9 2022/07/24 19:25:36 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
58
59
60
61
62
63
64


65
66
67
68
69
70
71

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>
#include <openssl/ts.h>



/* Function definitions. */

int
TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *status_info)
{
	TS_STATUS_INFO *new_status_info;







>
>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>
#include <openssl/ts.h>

#include "ts_local.h"

/* Function definitions. */

int
TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *status_info)
{
	TS_STATUS_INFO *new_status_info;
84
85
86
87
88
89
90
























91
92
93
94
95
96
97
}

TS_STATUS_INFO *
TS_RESP_get_status_info(TS_RESP *a)
{
	return a->status_info;
}

























/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
void
TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info)
{
	/* Set new PKCS7 and TST_INFO objects. */
	PKCS7_free(a->token);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
}

TS_STATUS_INFO *
TS_RESP_get_status_info(TS_RESP *a)
{
	return a->status_info;
}

const ASN1_UTF8STRING *
TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *si)
{
	return si->failure_info;
}

const STACK_OF(ASN1_UTF8STRING) *
TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *si)
{
	return si->text;
}

const ASN1_INTEGER *
TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *si)
{
	return si->status;
}

int
TS_STATUS_INFO_set_status(TS_STATUS_INFO *si, int i)
{
	return ASN1_INTEGER_set(si->status, i);
}

/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
void
TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info)
{
	/* Set new PKCS7 and TST_INFO objects. */
	PKCS7_free(a->token);
Changes to jni/libressl/crypto/ts/ts_rsp_verify.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_verify.c,v 1.24 2021/12/12 21:30:14 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_rsp_verify.c,v 1.28 2022/07/24 08:16:47 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2002.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76


77
78
79
80
81
82
83
84

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>
#include <openssl/ts.h>

#include "evp_locl.h"

#include "x509_lcl.h"

/* Private function declarations. */

static int TS_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted,
    X509 *signer, STACK_OF(X509) **chain);
static int TS_check_signing_certs(PKCS7_SIGNER_INFO *si, STACK_OF(X509) *chain);
static ESS_SIGNING_CERT *ESS_get_signing_cert(PKCS7_SIGNER_INFO *si);
static int TS_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert);


static int TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509_CINF *cinfo);
static int int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx,
    PKCS7 *token, TS_TST_INFO *tst_info);
static int TS_check_status_info(TS_RESP *response);
static char *TS_get_status_text(STACK_OF(ASN1_UTF8STRING) *text);
static int TS_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info);
static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info,
    X509_ALGOR **md_alg,







>









>
>
|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>
#include <openssl/ts.h>

#include "evp_locl.h"
#include "ts_local.h"
#include "x509_lcl.h"

/* Private function declarations. */

static int TS_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted,
    X509 *signer, STACK_OF(X509) **chain);
static int TS_check_signing_certs(PKCS7_SIGNER_INFO *si, STACK_OF(X509) *chain);
static ESS_SIGNING_CERT *ESS_get_signing_cert(PKCS7_SIGNER_INFO *si);
static int TS_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert);
static ESS_SIGNING_CERT_V2 *ESS_get_signing_cert_v2(PKCS7_SIGNER_INFO *si);
static int TS_find_cert_v2(STACK_OF(ESS_CERT_ID_V2) *cert_ids, X509 *cert);
static int TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509 *cert);
static int int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx,
    PKCS7 *token, TS_TST_INFO *tst_info);
static int TS_check_status_info(TS_RESP *response);
static char *TS_get_status_text(STACK_OF(ASN1_UTF8STRING) *text);
static int TS_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info);
static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info,
    X509_ALGOR **md_alg,
268
269
270
271
272
273
274
275
276


277
278
279
280
281
282
283
284
285

286
287
288

289
290

291
292
293
294

295
296
297
298

























299
300
301
302
303
304

305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322













323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338

339
340
341
342
343
344
345
346
347
348

349



































350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379

	return ret;
}

static int
TS_check_signing_certs(PKCS7_SIGNER_INFO *si, STACK_OF(X509) *chain)
{
	ESS_SIGNING_CERT *ss = ESS_get_signing_cert(si);
	STACK_OF(ESS_CERT_ID) *cert_ids = NULL;


	X509 *cert;
	int i = 0;
	int ret = 0;

	if (!ss)
		goto err;
	cert_ids = ss->cert_ids;
	/* The signer certificate must be the first in cert_ids. */
	cert = sk_X509_value(chain, 0);

	if (TS_find_cert(cert_ids, cert) != 0)
		goto err;


	/* Check the other certificates of the chain if there are more
	   than one certificate ids in cert_ids. */

	if (sk_ESS_CERT_ID_num(cert_ids) > 1) {
		/* All the certificates of the chain must be in cert_ids. */
		for (i = 1; i < sk_X509_num(chain); ++i) {
			cert = sk_X509_value(chain, i);

			if (TS_find_cert(cert_ids, cert) < 0)
				goto err;
		}
	}

























	ret = 1;

err:
	if (!ret)
		TSerror(TS_R_ESS_SIGNING_CERTIFICATE_ERROR);
	ESS_SIGNING_CERT_free(ss);

	return ret;
}

static ESS_SIGNING_CERT *
ESS_get_signing_cert(PKCS7_SIGNER_INFO *si)
{
	ASN1_TYPE *attr;
	const unsigned char *p;

	attr = PKCS7_get_signed_attribute(si,
	    NID_id_smime_aa_signingCertificate);
	if (!attr)
		return NULL;
	if (attr->type != V_ASN1_SEQUENCE)
		return NULL;
	p = attr->value.sequence->data;
	return d2i_ESS_SIGNING_CERT(NULL, &p, attr->value.sequence->length);
}














/* Returns < 0 if certificate is not found, certificate index otherwise. */
static int
TS_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert)
{
	int i;
	unsigned char cert_hash[TS_HASH_LEN];

	if (!cert_ids || !cert)
		return -1;

	if (!X509_digest(cert, TS_HASH_EVP, cert_hash, NULL))
		return -1;

	/* Recompute SHA1 hash of certificate if necessary (side effect). */
	X509_check_purpose(cert, -1, 0);


	/* Look for cert in the cert_ids vector. */
	for (i = 0; i < sk_ESS_CERT_ID_num(cert_ids); ++i) {
		ESS_CERT_ID *cid = sk_ESS_CERT_ID_value(cert_ids, i);

		/* Check the SHA-1 hash first. */
		if (cid->hash->length == TS_HASH_LEN && !memcmp(cid->hash->data,
		    cert_hash, TS_HASH_LEN)) {
			/* Check the issuer/serial as well if specified. */
			ESS_ISSUER_SERIAL *is = cid->issuer_serial;

			if (!is || !TS_issuer_serial_cmp(is, cert->cert_info))



































				return i;
		}
	}

	return -1;
}

static int
TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509_CINF *cinfo)
{
	GENERAL_NAME *issuer;

	if (!is || !cinfo || sk_GENERAL_NAME_num(is->issuer) != 1)
		return -1;

	/* Check the issuer first. It must be a directory name. */
	issuer = sk_GENERAL_NAME_value(is->issuer, 0);
	if (issuer->type != GEN_DIRNAME ||
	    X509_NAME_cmp(issuer->d.dirn, cinfo->issuer))
		return -1;

	/* Check the serial number, too. */
	if (ASN1_INTEGER_cmp(is->serial, cinfo->serialNumber))
		return -1;

	return 0;
}

/*
 * Verifies whether 'response' contains a valid response with regards







|
|
>
>




|
<
|
|
|
>
|
|

>
|
|
>
|
|
|
|
>
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






>


















>
>
>
>
>
>
>
>
>
>
>
>
>















|
>










>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|



|





|



|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463

	return ret;
}

static int
TS_check_signing_certs(PKCS7_SIGNER_INFO *si, STACK_OF(X509) *chain)
{
	ESS_SIGNING_CERT *ss = NULL;
	STACK_OF(ESS_CERT_ID) *cert_ids;
	ESS_SIGNING_CERT_V2 *ssv2 = NULL;
	STACK_OF(ESS_CERT_ID_V2) *cert_ids_v2;
	X509 *cert;
	int i = 0;
	int ret = 0;

	if ((ss = ESS_get_signing_cert(si)) != NULL) {

		cert_ids = ss->cert_ids;
		/* The signer certificate must be the first in cert_ids. */
		cert = sk_X509_value(chain, 0);

		if (TS_find_cert(cert_ids, cert) != 0)
			goto err;

		/*
		 * Check the other certificates of the chain if there are more
		 * than one certificate ids in cert_ids.
		 */
		if (sk_ESS_CERT_ID_num(cert_ids) > 1) {
			/* All the certificates of the chain must be in cert_ids. */
			for (i = 1; i < sk_X509_num(chain); i++) {
				cert = sk_X509_value(chain, i);

				if (TS_find_cert(cert_ids, cert) < 0)
					goto err;
			}
		}
	}

	if ((ssv2 = ESS_get_signing_cert_v2(si)) != NULL) {
		cert_ids_v2 = ssv2->cert_ids;
		/* The signer certificate must be the first in cert_ids_v2. */
		cert = sk_X509_value(chain, 0);

		if (TS_find_cert_v2(cert_ids_v2, cert) != 0)
			goto err;

		/*
		 * Check the other certificates of the chain if there are more
		 * than one certificate ids in cert_ids_v2.
		 */
		if (sk_ESS_CERT_ID_V2_num(cert_ids_v2) > 1) {
			/* All the certificates of the chain must be in cert_ids_v2. */
			for (i = 1; i < sk_X509_num(chain); i++) {
				cert = sk_X509_value(chain, i);

				if (TS_find_cert_v2(cert_ids_v2, cert) < 0)
					goto err;
			}
		}
	}

	ret = 1;

err:
	if (!ret)
		TSerror(TS_R_ESS_SIGNING_CERTIFICATE_ERROR);
	ESS_SIGNING_CERT_free(ss);
	ESS_SIGNING_CERT_V2_free(ssv2);
	return ret;
}

static ESS_SIGNING_CERT *
ESS_get_signing_cert(PKCS7_SIGNER_INFO *si)
{
	ASN1_TYPE *attr;
	const unsigned char *p;

	attr = PKCS7_get_signed_attribute(si,
	    NID_id_smime_aa_signingCertificate);
	if (!attr)
		return NULL;
	if (attr->type != V_ASN1_SEQUENCE)
		return NULL;
	p = attr->value.sequence->data;
	return d2i_ESS_SIGNING_CERT(NULL, &p, attr->value.sequence->length);
}

static ESS_SIGNING_CERT_V2 *
ESS_get_signing_cert_v2(PKCS7_SIGNER_INFO *si)
{
	ASN1_TYPE *attr;
	const unsigned char *p;

	attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificateV2);
	if (attr == NULL)
		return NULL;
	p = attr->value.sequence->data;
	return d2i_ESS_SIGNING_CERT_V2(NULL, &p, attr->value.sequence->length);
}

/* Returns < 0 if certificate is not found, certificate index otherwise. */
static int
TS_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert)
{
	int i;
	unsigned char cert_hash[TS_HASH_LEN];

	if (!cert_ids || !cert)
		return -1;

	if (!X509_digest(cert, TS_HASH_EVP, cert_hash, NULL))
		return -1;

	/* Recompute SHA1 hash of certificate if necessary (side effect). */
	if (X509_check_purpose(cert, -1, 0) == -1)
		return -1;

	/* Look for cert in the cert_ids vector. */
	for (i = 0; i < sk_ESS_CERT_ID_num(cert_ids); ++i) {
		ESS_CERT_ID *cid = sk_ESS_CERT_ID_value(cert_ids, i);

		/* Check the SHA-1 hash first. */
		if (cid->hash->length == TS_HASH_LEN && !memcmp(cid->hash->data,
		    cert_hash, TS_HASH_LEN)) {
			/* Check the issuer/serial as well if specified. */
			ESS_ISSUER_SERIAL *is = cid->issuer_serial;

			if (is == NULL || TS_issuer_serial_cmp(is, cert) == 0)
				return i;
		}
	}

	return -1;
}

/* Returns < 0 if certificate is not found, certificate index otherwise. */
static int
TS_find_cert_v2(STACK_OF(ESS_CERT_ID_V2) *cert_ids, X509 *cert)
{
	int i;
	unsigned char cert_digest[EVP_MAX_MD_SIZE];
	unsigned int len;

	/* Look for cert in the cert_ids vector. */
	for (i = 0; i < sk_ESS_CERT_ID_V2_num(cert_ids); ++i) {
		ESS_CERT_ID_V2 *cid = sk_ESS_CERT_ID_V2_value(cert_ids, i);
		const EVP_MD *md = EVP_sha256();

		if (cid->hash_alg != NULL)
			md = EVP_get_digestbyobj(cid->hash_alg->algorithm);
		if (md == NULL)
			return -1;

		if (!X509_digest(cert, md, cert_digest, &len))
			return -1;

		if ((unsigned int)cid->hash->length != len)
			return -1;

		if (memcmp(cid->hash->data, cert_digest, cid->hash->length) == 0) {
			ESS_ISSUER_SERIAL *is = cid->issuer_serial;

			if (is == NULL || TS_issuer_serial_cmp(is, cert) == 0)
				return i;
		}
	}

	return -1;
}

static int
TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509 *cert)
{
	GENERAL_NAME *issuer;

	if (is == NULL || cert == NULL || sk_GENERAL_NAME_num(is->issuer) != 1)
		return -1;

	/* Check the issuer first. It must be a directory name. */
	issuer = sk_GENERAL_NAME_value(is->issuer, 0);
	if (issuer->type != GEN_DIRNAME ||
	    X509_NAME_cmp(issuer->d.dirn, X509_get_issuer_name(cert)))
		return -1;

	/* Check the serial number, too. */
	if (ASN1_INTEGER_cmp(is->serial, X509_get_serialNumber(cert)))
		return -1;

	return 0;
}

/*
 * Verifies whether 'response' contains a valid response with regards
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
	int found = 0;

	if (signer == NULL)
		return 0;

	/* Check the subject name first. */
	if (tsa_name->type == GEN_DIRNAME &&
	    X509_NAME_cmp(tsa_name->d.dirn, signer->cert_info->subject) == 0)
		return 1;

	/* Check all the alternative names. */
	gen_names = X509_get_ext_d2i(signer, NID_subject_alt_name,
	    NULL, &idx);
	while (gen_names != NULL &&
	    !(found = (TS_find_name(gen_names, tsa_name) >= 0))) {







|







806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
	int found = 0;

	if (signer == NULL)
		return 0;

	/* Check the subject name first. */
	if (tsa_name->type == GEN_DIRNAME &&
	    X509_name_cmp(tsa_name->d.dirn, X509_get_subject_name(signer)) == 0)
		return 1;

	/* Check all the alternative names. */
	gen_names = X509_get_ext_d2i(signer, NID_subject_alt_name,
	    NULL, &idx);
	while (gen_names != NULL &&
	    !(found = (TS_find_name(gen_names, tsa_name) >= 0))) {
Changes to jni/libressl/crypto/ts/ts_verify_ctx.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts_verify_ctx.c,v 1.9 2017/01/29 17:49:23 beck Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2003.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts_verify_ctx.c,v 1.11 2022/07/24 19:54:46 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
 * project 2003.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
58
59
60
61
62
63
64


65
66
67
68
69
70
71

#include <string.h>

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/ts.h>



TS_VERIFY_CTX *
TS_VERIFY_CTX_new(void)
{
	TS_VERIFY_CTX *ctx = calloc(1, sizeof(TS_VERIFY_CTX));

	if (!ctx)
		TSerror(ERR_R_MALLOC_FAILURE);







>
>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

#include <string.h>

#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/ts.h>

#include "ts_local.h"

TS_VERIFY_CTX *
TS_VERIFY_CTX_new(void)
{
	TS_VERIFY_CTX *ctx = calloc(1, sizeof(TS_VERIFY_CTX));

	if (!ctx)
		TSerror(ERR_R_MALLOC_FAILURE);
107
108
109
110
111
112
113
































































114
115
116
117
118
119
120

	ASN1_INTEGER_free(ctx->nonce);

	GENERAL_NAME_free(ctx->tsa_name);

	TS_VERIFY_CTX_init(ctx);
}

































































TS_VERIFY_CTX *
TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx)
{
	TS_VERIFY_CTX *ret = ctx;
	ASN1_OBJECT *policy;
	TS_MSG_IMPRINT *imprint;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186

	ASN1_INTEGER_free(ctx->nonce);

	GENERAL_NAME_free(ctx->tsa_name);

	TS_VERIFY_CTX_init(ctx);
}

/*
 * XXX: The following accessors demonstrate the amount of care and thought that
 * went into OpenSSL 1.1 API design and the review thereof: for whatever reason
 * these functions return what was passed in. Correct memory management is left
 * as an exercise for the reader... Unfortunately, careful consumers like
 * openssl-ruby assume this behavior, so we're stuck with this insanity. The
 * cherry on top is the TS_VERIFY_CTS_set_certs() [sic!] function that made it
 * into the public API.
 *
 * Outstanding job, R$ and tjh, A+.
 */

int
TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int flags)
{
	ctx->flags |= flags;

	return ctx->flags;
}

int
TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int flags)
{
	ctx->flags = flags;

	return ctx->flags;
}

BIO *
TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *bio)
{
	ctx->data = bio;

	return ctx->data;
}

X509_STORE *
TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *store)
{
	ctx->store = store;

	return ctx->store;
}

STACK_OF(X509) *
TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs)
{
	ctx->certs = certs;

	return ctx->certs;
}

unsigned char *
TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, unsigned char *imprint,
    long imprint_len)
{
	free(ctx->imprint);

	ctx->imprint = imprint;
	ctx->imprint_len = imprint_len;

	return ctx->imprint;
}

TS_VERIFY_CTX *
TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx)
{
	TS_VERIFY_CTX *ret = ctx;
	ASN1_OBJECT *policy;
	TS_MSG_IMPRINT *imprint;
Changes to jni/libressl/crypto/ui/ui_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ui_err.c,v 1.9 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ui_err.c,v 1.10 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ui.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason)

static ERR_STRING_DATA UI_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<







<







49
50
51
52
53
54
55





56
57
58
59
60
61
62

63
64
65
66
67
68
69
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/ui.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason)

static ERR_STRING_DATA UI_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/x509/x509_addr.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: x509_addr.c,v 1.78 2022/03/16 11:44:36 tb Exp $ */
/*
 * Contributed to the OpenSSL Project by the American Registry for
 * Internet Numbers ("ARIN").
 */
/* ====================================================================
 * Copyright (c) 2006-2016 The OpenSSL Project.  All rights reserved.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: x509_addr.c,v 1.83 2022/05/25 17:10:30 tb Exp $ */
/*
 * Contributed to the OpenSSL Project by the American Registry for
 * Internet Numbers ("ARIN").
 */
/* ====================================================================
 * Copyright (c) 2006-2016 The OpenSSL Project.  All rights reserved.
 *
69
70
71
72
73
74
75

76
77
78
79
80
81
82
#include <openssl/asn1t.h>
#include <openssl/buffer.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>


#include "bytestring.h"
#include "x509_lcl.h"

#ifndef OPENSSL_NO_RFC3779

/*
 * OpenSSL ASN.1 template translation of RFC 3779 2.2.3.







>







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <openssl/asn1t.h>
#include <openssl/buffer.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>

#include "asn1_locl.h"
#include "bytestring.h"
#include "x509_lcl.h"

#ifndef OPENSSL_NO_RFC3779

/*
 * OpenSSL ASN.1 template translation of RFC 3779 2.2.3.
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857

858
859
860
861
862
863
864
865
866
867
868
869
870




871

872
873

874
875
876
877
878
879
880
881
882
883
884

885
886
887
888
889
890
891
892
893
894




895


896


897


898




















899
900
901
902
903
904

905




906
907

908




909
910
911
912










































913

914
915

916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945

946
947
948
949
950
951
952
953
954
	if ((min[i] & mask) != 0 || (max[i] & mask) != mask)
		return -1;
	else
		return i * 8 + j;
}

/*
 * Construct a prefix.
 */
static int
make_addressPrefix(IPAddressOrRange **result, unsigned char *addr,
    unsigned int afi, int prefix_len)
{
	IPAddressOrRange *aor;
	int afi_len, byte_len, bit_len, max_len;


	if (prefix_len < 0)
		return 0;

	max_len = 16;
	if ((afi_len = length_from_afi(afi)) > 0)
		max_len = afi_len;
	if (prefix_len > 8 * max_len)
		return 0;

	byte_len = (prefix_len + 7) / 8;
	bit_len = prefix_len % 8;





	if ((aor = IPAddressOrRange_new()) == NULL)

		return 0;
	aor->type = IPAddressOrRange_addressPrefix;

	if ((aor->u.addressPrefix = ASN1_BIT_STRING_new()) == NULL)
		goto err;

	if (!ASN1_BIT_STRING_set(aor->u.addressPrefix, addr, byte_len))
		goto err;

	aor->u.addressPrefix->flags &= ~7;
	aor->u.addressPrefix->flags |= ASN1_STRING_FLAG_BITS_LEFT;
	if (bit_len > 0) {
		aor->u.addressPrefix->data[byte_len - 1] &= ~(0xff >> bit_len);
		aor->u.addressPrefix->flags |= 8 - bit_len;

	}

	*result = aor;
	return 1;

 err:
	IPAddressOrRange_free(aor);
	return 0;
}





/*


 * Construct a range.  If it can be expressed as a prefix,


 * return a prefix instead.  Doing this here simplifies


 * the rest of the code considerably.




















 */
static int
make_addressRange(IPAddressOrRange **result, unsigned char *min,
    unsigned char *max, unsigned int afi, int length)
{
	IPAddressOrRange *aor;

	int i, prefix_len;





	if (memcmp(min, max, length) > 0)

		return 0;





	if ((prefix_len = range_should_be_prefix(min, max, length)) >= 0)
		return make_addressPrefix(result, min, afi, prefix_len);











































	if ((aor = IPAddressOrRange_new()) == NULL)

		return 0;
	aor->type = IPAddressOrRange_addressRange;

	if ((aor->u.addressRange = IPAddressRange_new()) == NULL)
		goto err;

	for (i = length; i > 0 && min[i - 1] == 0x00; --i)
		continue;
	if (!ASN1_BIT_STRING_set(aor->u.addressRange->min, min, i))
		goto err;
	aor->u.addressRange->min->flags &= ~7;
	aor->u.addressRange->min->flags |= ASN1_STRING_FLAG_BITS_LEFT;
	if (i > 0) {
		unsigned char b = min[i - 1];
		int j = 1;
		while ((b & (0xffU >> j)) != 0)
			++j;
		aor->u.addressRange->min->flags |= 8 - j;
	}

	for (i = length; i > 0 && max[i - 1] == 0xff; --i)
		continue;
	if (!ASN1_BIT_STRING_set(aor->u.addressRange->max, max, i))
		goto err;
	aor->u.addressRange->max->flags &= ~7;
	aor->u.addressRange->max->flags |= ASN1_STRING_FLAG_BITS_LEFT;
	if (i > 0) {
		unsigned char b = max[i - 1];
		int j = 1;
		while ((b & (0xffU >> j)) != (0xffU >> j))
			++j;
		aor->u.addressRange->max->flags |= 8 - j;
	}


	*result = aor;
	return 1;

 err:
	IPAddressOrRange_free(aor);
	return 0;
}








|


|
|

|
|
>


|





|

|
|

>
>
>
>

>
|

>


<
|

<
|
<
<
<
<
>
|
<
|







>
>
>
>
|
>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|
|

|
>
|
>
>
>
>


>
|
>
>
>
>


|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
|

>
|


<
<
|

|
<
<
<
|
<
<
<
|
<
<
<
|

|
<
<
<
|
<
<
<
|
>

<







844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883

884
885

886




887
888

889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004


1005
1006
1007



1008



1009



1010
1011
1012



1013



1014
1015
1016

1017
1018
1019
1020
1021
1022
1023
	if ((min[i] & mask) != 0 || (max[i] & mask) != mask)
		return -1;
	else
		return i * 8 + j;
}

/*
 * Fill IPAddressOrRange with bit string encoding of a prefix - RFC 3779, 2.1.1.
 */
static int
make_addressPrefix(IPAddressOrRange **out_aor, uint8_t *addr, uint32_t afi,
    int prefix_len)
{
	IPAddressOrRange *aor = NULL;
	int afi_len, max_len, num_bits, num_octets;
	uint8_t unused_bits;

	if (prefix_len < 0)
		goto err;

	max_len = 16;
	if ((afi_len = length_from_afi(afi)) > 0)
		max_len = afi_len;
	if (prefix_len > 8 * max_len)
		goto err;

	num_octets = (prefix_len + 7) / 8;
	num_bits = prefix_len % 8;

	unused_bits = 0;
	if (num_bits > 0)
		unused_bits = 8 - num_bits;

	if ((aor = IPAddressOrRange_new()) == NULL)
		goto err;

	aor->type = IPAddressOrRange_addressPrefix;

	if ((aor->u.addressPrefix = ASN1_BIT_STRING_new()) == NULL)
		goto err;

	if (!ASN1_BIT_STRING_set(aor->u.addressPrefix, addr, num_octets))
		goto err;

	if (!asn1_abs_set_unused_bits(aor->u.addressPrefix, unused_bits))




		goto err;


	*out_aor = aor;
	return 1;

 err:
	IPAddressOrRange_free(aor);
	return 0;
}

static uint8_t
count_trailing_zeroes(uint8_t octet)
{
	uint8_t count = 0;

	if (octet == 0)
		return 8;

	while ((octet & (1 << count)) == 0)
		count++;

	return count;
}

static int
trim_end_u8(CBS *cbs, uint8_t trim)
{
	uint8_t octet;

	while (CBS_len(cbs) > 0) {
		if (!CBS_peek_last_u8(cbs, &octet))
			return 0;
		if (octet != trim)
			return 1;
		if (!CBS_get_last_u8(cbs, &octet))
			return 0;
	}

	return 1;
}

/*
 * Populate IPAddressOrRange with bit string encoding of a range, see
 * RFC 3779, 2.1.2.
 */
static int
make_addressRange(IPAddressOrRange **out_aor, uint8_t *min, uint8_t *max,
    uint32_t afi, int length)
{
	IPAddressOrRange *aor = NULL;
	IPAddressRange *range;
	int prefix_len;
	CBS cbs;
	size_t max_len, min_len;
	uint8_t unused_bits_min, unused_bits_max;
	uint8_t octet;

	if (memcmp(min, max, length) > 0)
		goto err;

	/*
	 * RFC 3779, 2.2.3.6 - a range that can be expressed as a prefix
	 * must be encoded as a prefix.
	 */

	if ((prefix_len = range_should_be_prefix(min, max, length)) >= 0)
		return make_addressPrefix(out_aor, min, afi, prefix_len);

	/*
	 * The bit string representing min is formed by removing all its
	 * trailing zero bits, so remove all trailing zero octets and count
	 * the trailing zero bits of the last octet.
	 */

	CBS_init(&cbs, min, length);

	if (!trim_end_u8(&cbs, 0x00))
		goto err;

	unused_bits_min = 0;
	if ((min_len = CBS_len(&cbs)) > 0) {
		if (!CBS_peek_last_u8(&cbs, &octet))
			goto err;

		unused_bits_min = count_trailing_zeroes(octet);
	}

	/*
	 * The bit string representing max is formed by removing all its
	 * trailing one bits, so remove all trailing 0xff octets and count
	 * the trailing ones of the last octet.
	 */

	CBS_init(&cbs, max, length);

	if (!trim_end_u8(&cbs, 0xff))
		goto err;

	unused_bits_max = 0;
	if ((max_len = CBS_len(&cbs)) > 0) {
		if (!CBS_peek_last_u8(&cbs, &octet))
			goto err;

		unused_bits_max = count_trailing_zeroes(octet + 1);
	}

	/*
	 * Populate IPAddressOrRange.
	 */

	if ((aor = IPAddressOrRange_new()) == NULL)
		goto err;

	aor->type = IPAddressOrRange_addressRange;

	if ((range = aor->u.addressRange = IPAddressRange_new()) == NULL)
		goto err;



	if (!ASN1_BIT_STRING_set(range->min, min, min_len))
		goto err;
	if (!asn1_abs_set_unused_bits(range->min, unused_bits_min))



		goto err;







	if (!ASN1_BIT_STRING_set(range->max, max, max_len))
		goto err;
	if (!asn1_abs_set_unused_bits(range->max, unused_bits_max))



		goto err;




	*out_aor = aor;


	return 1;

 err:
	IPAddressOrRange_free(aor);
	return 0;
}

1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
		if (sk_IPAddressOrRange_num(aors) == 0)
			return 0;

		for (j = 0; j < sk_IPAddressOrRange_num(aors) - 1; j++) {
			aor_a = sk_IPAddressOrRange_value(aors, j);
			aor_b = sk_IPAddressOrRange_value(aors, j + 1);

			/*
			 * XXX - check that both are either a prefix or a range.
			 */

			if (!extract_min_max(aor_a, a_min, a_max, length) ||
			    !extract_min_max(aor_b, b_min, b_max, length))
				return 0;

			/*
			 * Punt misordered list, overlapping start, or inverted
			 * range.







<
<
<
<







1304
1305
1306
1307
1308
1309
1310




1311
1312
1313
1314
1315
1316
1317
		if (sk_IPAddressOrRange_num(aors) == 0)
			return 0;

		for (j = 0; j < sk_IPAddressOrRange_num(aors) - 1; j++) {
			aor_a = sk_IPAddressOrRange_value(aors, j);
			aor_b = sk_IPAddressOrRange_value(aors, j + 1);





			if (!extract_min_max(aor_a, a_min, a_max, length) ||
			    !extract_min_max(aor_b, b_min, b_max, length))
				return 0;

			/*
			 * Punt misordered list, overlapping start, or inverted
			 * range.
1770
1771
1772
1773
1774
1775
1776

1777
1778
1779
1780
1781
1782


1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807






1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
		goto err;
	/* If there is a store ctx, it needs a verify_cb. */
	if (ctx != NULL && ctx->verify_cb == NULL)
		goto err;

	/*
	 * Figure out where to start. If we don't have an extension to check,

	 * we're done.  Otherwise, check canonical form and set up for walking
	 * up the chain.
	 */
	if (ext == NULL) {
		depth = 0;
		cert = sk_X509_value(chain, depth);


		if ((ext = cert->rfc3779_addr) == NULL)
			goto done;
	}

	if (!X509v3_addr_is_canonical(ext)) {
		if ((ret = verify_error(ctx, cert,
		    X509_V_ERR_INVALID_EXTENSION, depth)) == 0)
			goto done;
	}

	(void)sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp);
	if ((child = sk_IPAddressFamily_dup(ext)) == NULL) {
		X509V3error(ERR_R_MALLOC_FAILURE);
		if (ctx != NULL)
			ctx->error = X509_V_ERR_OUT_OF_MEM;
		ret = 0;
		goto done;
	}

	/*
	 * Now walk up the chain. No cert may list resources that its parent
	 * doesn't list.
	 */
	for (depth++; depth < sk_X509_num(chain); depth++) {
		cert = sk_X509_value(chain, depth);







		if ((parent = cert->rfc3779_addr) == NULL) {
			for (i = 0; i < sk_IPAddressFamily_num(child); i++) {
				child_af = sk_IPAddressFamily_value(child, i);

				if (IPAddressFamily_inheritance(child_af) !=
				    NULL)
					continue;

				if ((ret = verify_error(ctx, cert,
				    X509_V_ERR_UNNESTED_RESOURCE, depth)) == 0)
					goto done;
				break;
			}
			continue;
		}

		if (!X509v3_addr_is_canonical(parent)) {
			if ((ret = verify_error(ctx, cert,
			    X509_V_ERR_INVALID_EXTENSION, depth)) == 0)
				goto done;
		}

		/*
		 * Check that the child's resources are covered by the parent.
		 * Each covered resource is replaced with the parent's resource
		 * covering it, so the next iteration will check that the
		 * parent's resources are covered by the grandparent.
		 */
		for (i = 0; i < sk_IPAddressFamily_num(child); i++) {







>
|
<




>
>


<
<
|




















>
>
>
>
>
>

















<
<
<
<
<
<







1835
1836
1837
1838
1839
1840
1841
1842
1843

1844
1845
1846
1847
1848
1849
1850
1851


1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895






1896
1897
1898
1899
1900
1901
1902
		goto err;
	/* If there is a store ctx, it needs a verify_cb. */
	if (ctx != NULL && ctx->verify_cb == NULL)
		goto err;

	/*
	 * Figure out where to start. If we don't have an extension to check,
	 * (either extracted from the leaf or passed by the caller), we're done.
	 * Otherwise, check canonical form and set up for walking up the chain.

	 */
	if (ext == NULL) {
		depth = 0;
		cert = sk_X509_value(chain, depth);
		if ((X509_get_extension_flags(cert) & EXFLAG_INVALID) != 0)
			goto done;
		if ((ext = cert->rfc3779_addr) == NULL)
			goto done;


	} else if (!X509v3_addr_is_canonical(ext)) {
		if ((ret = verify_error(ctx, cert,
		    X509_V_ERR_INVALID_EXTENSION, depth)) == 0)
			goto done;
	}

	(void)sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp);
	if ((child = sk_IPAddressFamily_dup(ext)) == NULL) {
		X509V3error(ERR_R_MALLOC_FAILURE);
		if (ctx != NULL)
			ctx->error = X509_V_ERR_OUT_OF_MEM;
		ret = 0;
		goto done;
	}

	/*
	 * Now walk up the chain. No cert may list resources that its parent
	 * doesn't list.
	 */
	for (depth++; depth < sk_X509_num(chain); depth++) {
		cert = sk_X509_value(chain, depth);

		if ((X509_get_extension_flags(cert) & EXFLAG_INVALID) != 0) {
			if ((ret = verify_error(ctx, cert,
			    X509_V_ERR_INVALID_EXTENSION, depth)) == 0)
				goto done;
		}

		if ((parent = cert->rfc3779_addr) == NULL) {
			for (i = 0; i < sk_IPAddressFamily_num(child); i++) {
				child_af = sk_IPAddressFamily_value(child, i);

				if (IPAddressFamily_inheritance(child_af) !=
				    NULL)
					continue;

				if ((ret = verify_error(ctx, cert,
				    X509_V_ERR_UNNESTED_RESOURCE, depth)) == 0)
					goto done;
				break;
			}
			continue;
		}







		/*
		 * Check that the child's resources are covered by the parent.
		 * Each covered resource is replaced with the parent's resource
		 * covering it, so the next iteration will check that the
		 * parent's resources are covered by the grandparent.
		 */
		for (i = 0; i < sk_IPAddressFamily_num(child); i++) {
Changes to jni/libressl/crypto/x509/x509_asid.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: x509_asid.c,v 1.30 2021/12/25 15:46:05 tb Exp $ */
/*
 * Contributed to the OpenSSL Project by the American Registry for
 * Internet Numbers ("ARIN").
 */
/* ====================================================================
 * Copyright (c) 2006-2018 The OpenSSL Project.  All rights reserved.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: x509_asid.c,v 1.35 2022/07/30 17:50:17 tb Exp $ */
/*
 * Contributed to the OpenSSL Project by the American Registry for
 * Internet Numbers ("ARIN").
 */
/* ====================================================================
 * Copyright (c) 2006-2018 The OpenSSL Project.  All rights reserved.
 *
749
750
751
752
753
754
755
756


757


758
759
760
761
762
763
764
765

/*
 * Whack an ASIdentifier extension into canonical form.
 */
int
X509v3_asid_canonize(ASIdentifiers *asid)
{
	return (asid == NULL ||


	    (ASIdentifierChoice_canonize(asid->asnum) &&


	     ASIdentifierChoice_canonize(asid->rdi)));
}

/*
 * v2i method for an ASIdentifier extension.
 */
static void *
v2i_ASIdentifiers(const struct v3_ext_method *method, struct v3_ext_ctx *ctx,







|
>
>
|
>
>
|







749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769

/*
 * Whack an ASIdentifier extension into canonical form.
 */
int
X509v3_asid_canonize(ASIdentifiers *asid)
{
	if (asid == NULL)
		return 1;

	if (!ASIdentifierChoice_canonize(asid->asnum))
		return 0;

	return ASIdentifierChoice_canonize(asid->rdi);
}

/*
 * v2i method for an ASIdentifier extension.
 */
static void *
v2i_ASIdentifiers(const struct v3_ext_method *method, struct v3_ext_ctx *ctx,
896
897
898
899
900
901
902

903

904
905



906
907




908
909
910
911
912
913
914
915
916
917
918
919
920

921
922
923
924
925
926
927

/*
 * Figure out whether extension uses inheritance.
 */
int
X509v3_asid_inherits(ASIdentifiers *asid)
{

	return (asid != NULL &&

	    ((asid->asnum != NULL &&
	      asid->asnum->type == ASIdentifierChoice_inherit) ||



	     (asid->rdi != NULL &&
	      asid->rdi->type == ASIdentifierChoice_inherit)));




}

/*
 * Figure out whether parent contains child.
 */
static int
asid_contains(ASIdOrRanges *parent, ASIdOrRanges *child)
{
	ASN1_INTEGER *p_min = NULL, *p_max = NULL, *c_min = NULL, *c_max = NULL;
	int p, c;

	if (child == NULL || parent == child)
		return 1;

	if (parent == NULL)
		return 0;

	p = 0;
	for (c = 0; c < sk_ASIdOrRange_num(child); c++) {
		if (!extract_min_max(sk_ASIdOrRange_value(child, c), &c_min,
		    &c_max))







>
|
>
|
|
>
>
>
|
|
>
>
>
>













>







900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941

/*
 * Figure out whether extension uses inheritance.
 */
int
X509v3_asid_inherits(ASIdentifiers *asid)
{
	if (asid == NULL)
		return 0;

	if (asid->asnum != NULL) {
		if (asid->asnum->type == ASIdentifierChoice_inherit)
			return 1;
	}

	if (asid->rdi != NULL) {
		if (asid->rdi->type == ASIdentifierChoice_inherit)
			return 1;
	}

	return 0;
}

/*
 * Figure out whether parent contains child.
 */
static int
asid_contains(ASIdOrRanges *parent, ASIdOrRanges *child)
{
	ASN1_INTEGER *p_min = NULL, *p_max = NULL, *c_min = NULL, *c_max = NULL;
	int p, c;

	if (child == NULL || parent == child)
		return 1;

	if (parent == NULL)
		return 0;

	p = 0;
	for (c = 0; c < sk_ASIdOrRange_num(child); c++) {
		if (!extract_min_max(sk_ASIdOrRange_value(child, c), &c_min,
		    &c_max))
940
941
942
943
944
945
946
947
948
949
950
951

952
953
954

955
956






957
958







959
960




961
962
963
964
965
966
967
		}
	}

	return 1;
}

/*
 * Test whether a is a subset of b.
 */
int
X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b)
{

	return (a == NULL ||
	    a == b ||
	    (b != NULL &&

	     !X509v3_asid_inherits(a) &&
	     !X509v3_asid_inherits(b) &&






	     asid_contains(b->asnum->u.asIdsOrRanges,
	     a->asnum->u.asIdsOrRanges) &&







	     asid_contains(b->rdi->u.asIdsOrRanges,
	     a->rdi->u.asIdsOrRanges)));




}

/*
 * Validation error handling via callback.
 */
#define validation_err(_err_)           \
  do {                                  \







|


|

>
|
|
|
>
|
|
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
|
|
>
>
>
>







954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
		}
	}

	return 1;
}

/*
 * Test whether child is a subset of parent.
 */
int
X509v3_asid_subset(ASIdentifiers *child, ASIdentifiers *parent)
{
	if (child == NULL || child == parent)
		return 1;

	if (parent == NULL)
		return 0;

	if (X509v3_asid_inherits(child) || X509v3_asid_inherits(parent))
		return 0;

	if (child->asnum != NULL) {
		if (parent->asnum == NULL)
			return 0;

		if (!asid_contains(parent->asnum->u.asIdsOrRanges,
		    child->asnum->u.asIdsOrRanges))
			return 0;
	}

	if (child->rdi != NULL) {
		if (parent->rdi == NULL)
			return 0;

		if (!asid_contains(parent->rdi->u.asIdsOrRanges,
		    child->rdi->u.asIdsOrRanges))
			return 0;
	}

	return 1;
}

/*
 * Validation error handling via callback.
 */
#define validation_err(_err_)           \
  do {                                  \
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008


1009
1010
1011


1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
	if (ctx == NULL && ext == NULL)
		goto err;
	/* If there is a store ctx, it needs a verify_cb. */
	if (ctx != NULL && ctx->verify_cb == NULL)
		goto err;

	/*
	 * Figure out where to start.  If we don't have an extension to
	 * check, we're done.  Otherwise, check canonical form and
	 * set up for walking up the chain.
	 */
	if (ext != NULL) {
		i = -1;
		x = NULL;


	} else {
		i = 0;
		x = sk_X509_value(chain, i);


		if ((ext = x->rfc3779_asid) == NULL)
			goto done;
	}
	if (!X509v3_asid_is_canonical(ext))
		validation_err(X509_V_ERR_INVALID_EXTENSION);
	if (ext->asnum != NULL) {
		switch (ext->asnum->type) {
		case ASIdentifierChoice_inherit:
			inherit_as = 1;
			break;
		case ASIdentifierChoice_asIdsOrRanges:
			child_as = ext->asnum->u.asIdsOrRanges;







|
|
|




>
>



>
>



<
<







1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051


1052
1053
1054
1055
1056
1057
1058
	if (ctx == NULL && ext == NULL)
		goto err;
	/* If there is a store ctx, it needs a verify_cb. */
	if (ctx != NULL && ctx->verify_cb == NULL)
		goto err;

	/*
	 * Figure out where to start. If we don't have an extension to check,
	 * (either extracted from the leaf or passed by the caller), we're done.
	 * Otherwise, check canonical form and set up for walking up the chain.
	 */
	if (ext != NULL) {
		i = -1;
		x = NULL;
		if (!X509v3_asid_is_canonical(ext))
			validation_err(X509_V_ERR_INVALID_EXTENSION);
	} else {
		i = 0;
		x = sk_X509_value(chain, i);
		if ((X509_get_extension_flags(x) & EXFLAG_INVALID) != 0)
			goto done;
		if ((ext = x->rfc3779_asid) == NULL)
			goto done;
	}


	if (ext->asnum != NULL) {
		switch (ext->asnum->type) {
		case ASIdentifierChoice_inherit:
			inherit_as = 1;
			break;
		case ASIdentifierChoice_asIdsOrRanges:
			child_as = ext->asnum->u.asIdsOrRanges;
1038
1039
1040
1041
1042
1043
1044


1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
	/*
	 * Now walk up the chain.  Extensions must be in canonical form, no
	 * cert may list resources that its parent doesn't list.
	 */
	for (i++; i < sk_X509_num(chain); i++) {
		x = sk_X509_value(chain, i);



		if (x->rfc3779_asid == NULL) {
			if (child_as != NULL || child_rdi != NULL)
				validation_err(X509_V_ERR_UNNESTED_RESOURCE);
			continue;
		}
		if (!X509v3_asid_is_canonical(x->rfc3779_asid))
			validation_err(X509_V_ERR_INVALID_EXTENSION);
		if (x->rfc3779_asid->asnum == NULL && child_as != NULL) {
			validation_err(X509_V_ERR_UNNESTED_RESOURCE);
			child_as = NULL;
			inherit_as = 0;
		}
		if (x->rfc3779_asid->asnum != NULL &&
		    x->rfc3779_asid->asnum->type ==







>
>





<
<







1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086


1087
1088
1089
1090
1091
1092
1093
	/*
	 * Now walk up the chain.  Extensions must be in canonical form, no
	 * cert may list resources that its parent doesn't list.
	 */
	for (i++; i < sk_X509_num(chain); i++) {
		x = sk_X509_value(chain, i);

		if ((X509_get_extension_flags(x) & EXFLAG_INVALID) != 0)
			validation_err(X509_V_ERR_INVALID_EXTENSION);
		if (x->rfc3779_asid == NULL) {
			if (child_as != NULL || child_rdi != NULL)
				validation_err(X509_V_ERR_UNNESTED_RESOURCE);
			continue;
		}


		if (x->rfc3779_asid->asnum == NULL && child_as != NULL) {
			validation_err(X509_V_ERR_UNNESTED_RESOURCE);
			child_as = NULL;
			inherit_as = 0;
		}
		if (x->rfc3779_asid->asnum != NULL &&
		    x->rfc3779_asid->asnum->type ==
Changes to jni/libressl/crypto/x509/x509_att.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_att.c,v 1.18 2021/11/01 20:53:08 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_att.c,v 1.19 2022/05/09 19:19:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
320
321
322
323
324
325
326
327
328
329

330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363

364
365
366
367
368
369
370
371
	} else if (len != -1){
		if (!(stmp = ASN1_STRING_type_new(attrtype)))
			goto err;
		if (!ASN1_STRING_set(stmp, data, len))
			goto err;
		atype = attrtype;
	}
	if (!(attr->value.set = sk_ASN1_TYPE_new_null()))
		goto err;
	attr->single = 0;

	/* This is a bit naughty because the attribute should really have
	 * at least one value but some types use and zero length SET and
	 * require this.
	 */
	if (attrtype == 0) {
		ASN1_STRING_free(stmp);
		return 1;
	}

	if (!(ttmp = ASN1_TYPE_new()))
		goto err;
	if ((len == -1) && !(attrtype & MBSTRING_FLAG)) {
		if (!ASN1_TYPE_set1(ttmp, attrtype, data))
			goto err;
	} else
		ASN1_TYPE_set(ttmp, atype, stmp);
	if (!sk_ASN1_TYPE_push(attr->value.set, ttmp))
		goto err;
	return 1;

err:
	ASN1_TYPE_free(ttmp);
	ASN1_STRING_free(stmp);
	X509error(ERR_R_MALLOC_FAILURE);
	return 0;
}

int
X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr)
{
	if (!attr->single)
		return sk_ASN1_TYPE_num(attr->value.set);
	if (attr->value.single)
		return 1;

	return 0;
}

ASN1_OBJECT *
X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr)
{
	if (attr == NULL)
		return (NULL);







<
<
<
>
|















|













<
<
|
|
>
|







320
321
322
323
324
325
326



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357


358
359
360
361
362
363
364
365
366
367
368
	} else if (len != -1){
		if (!(stmp = ASN1_STRING_type_new(attrtype)))
			goto err;
		if (!ASN1_STRING_set(stmp, data, len))
			goto err;
		atype = attrtype;
	}



	/*
	 * This is a bit naughty because the attribute should really have
	 * at least one value but some types use and zero length SET and
	 * require this.
	 */
	if (attrtype == 0) {
		ASN1_STRING_free(stmp);
		return 1;
	}

	if (!(ttmp = ASN1_TYPE_new()))
		goto err;
	if ((len == -1) && !(attrtype & MBSTRING_FLAG)) {
		if (!ASN1_TYPE_set1(ttmp, attrtype, data))
			goto err;
	} else
		ASN1_TYPE_set(ttmp, atype, stmp);
	if (!sk_ASN1_TYPE_push(attr->set, ttmp))
		goto err;
	return 1;

err:
	ASN1_TYPE_free(ttmp);
	ASN1_STRING_free(stmp);
	X509error(ERR_R_MALLOC_FAILURE);
	return 0;
}

int
X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr)
{


	if (attr == NULL)
		return 0;

	return sk_ASN1_TYPE_num(attr->set);
}

ASN1_OBJECT *
X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr)
{
	if (attr == NULL)
		return (NULL);
388
389
390
391
392
393
394
395
396
397
398
399
400
401
}

ASN1_TYPE *
X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx)
{
	if (attr == NULL)
		return (NULL);
	if (idx >= X509_ATTRIBUTE_count(attr))
		return NULL;
	if (!attr->single)
		return sk_ASN1_TYPE_value(attr->value.set, idx);
	else
		return attr->value.single;
}







|
<
<
|
<
<

385
386
387
388
389
390
391
392


393


394
}

ASN1_TYPE *
X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx)
{
	if (attr == NULL)
		return (NULL);



	return sk_ASN1_TYPE_value(attr->set, idx);


}
Changes to jni/libressl/crypto/x509/x509_constraints.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_constraints.c,v 1.26 2022/03/26 16:34:21 tb Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_constraints.c,v 1.28 2022/06/27 15:03:11 beck Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
455
456
457
458
459
460
461
462
463
464






465
466
467
468
469
470
471
	 */
	if (len < 3 && constraint[0] == '.')
		return 0;
	return x509_constraints_valid_domain_internal(constraint, len, 0);
}

/*
 * Extract the host part of a URI, returns the host part as a c string
 * the caller must free, or or NULL if it could not be found or is
 * invalid.






 *
 * RFC 3986:
 * the authority part of a uri starts with // and is terminated with
 * the next '/', '?', '#' or end of the URI.
 *
 * The authority itself contains [userinfo '@'] host [: port]
 *







|
|
|
>
>
>
>
>
>







455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
	 */
	if (len < 3 && constraint[0] == '.')
		return 0;
	return x509_constraints_valid_domain_internal(constraint, len, 0);
}

/*
 * Extract the host part of a URI. On failure to parse a valid host part of the
 * URI, 0 is returned indicating an invalid URI. If the host part parses as
 * valid, or is not present, 1 is returned indicating a possibly valid URI.
 *
 * In the case of a valid URI, *hostpart will be set to a copy of the host part
 * of the URI, or the empty string if no URI is present. If memory allocation
 * fails *hostpart will be set to NULL, even though we returned 1. It is the
 * caller's responsibility to indicate an error for memory allocation failure,
 * and the callers responsibility to free *hostpart.
 *
 * RFC 3986:
 * the authority part of a uri starts with // and is terminated with
 * the next '/', '?', '#' or end of the URI.
 *
 * The authority itself contains [userinfo '@'] host [: port]
 *
489
490
491
492
493
494
495
496








497

498
499
500
501
502
503
504
		if (!isascii(uri[i]))
			return 0;
		if (uri[i] == '/' && uri[i + 1] == '/') {
			authority = uri + i + 2;
			break;
		}
	}
	if (authority == NULL)








		return 0;

	for (i = authority - uri; i < len; i++) {
		if (!isascii(uri[i]))
			return 0;
		/* it has a userinfo part */
		if (uri[i] == '@') {
			hostlen = 0;
			/* it can only have one */







|
>
>
>
>
>
>
>
>
|
>







495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
		if (!isascii(uri[i]))
			return 0;
		if (uri[i] == '/' && uri[i + 1] == '/') {
			authority = uri + i + 2;
			break;
		}
	}
	if (authority == NULL) {
		/*
		 * There is no authority, so no host part in this
		 * URI. This might be ok or might not, but it must
		 * fail if we run into a name constraint later, so
		 * we indicate that we have a URI with an empty
		 * host part, and succeed.
		 */
		*hostpart = strdup("");
		return 1;
	}
	for (i = authority - uri; i < len; i++) {
		if (!isascii(uri[i]))
			return 0;
		/* it has a userinfo part */
		if (uri[i] == '@') {
			hostlen = 0;
			/* it can only have one */
Changes to jni/libressl/crypto/x509/x509_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_err.c,v 1.16 2021/11/10 13:57:42 schwarze Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_err.c,v 1.17 2022/07/12 14:42:50 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason)

static ERR_STRING_DATA X509_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},







<
<
<
<
<








<







49
50
51
52
53
54
55





56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/opensslconf.h>

#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason)

static ERR_STRING_DATA X509_str_functs[] = {
	{ERR_FUNC(0xfff), "CRYPTO_internal"},
Changes to jni/libressl/crypto/x509/x509_internal.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_internal.h,v 1.18 2022/03/14 21:15:49 tb Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_internal.h,v 1.19 2022/06/27 14:10:22 tb Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
131
132
133
134
135
136
137

138
139
140
141
    struct x509_constraints_name **out_name, int *error);
int x509_constraints_check(struct x509_constraints_names *names,
    struct x509_constraints_names *permitted,
    struct x509_constraints_names *excluded, int *error);
int x509_constraints_chain(STACK_OF(X509) *chain, int *error,
    int *depth);
void x509_verify_cert_info_populate(X509 *cert);


__END_HIDDEN_DECLS

#endif







>




131
132
133
134
135
136
137
138
139
140
141
142
    struct x509_constraints_name **out_name, int *error);
int x509_constraints_check(struct x509_constraints_names *names,
    struct x509_constraints_names *permitted,
    struct x509_constraints_names *excluded, int *error);
int x509_constraints_chain(STACK_OF(X509) *chain, int *error,
    int *depth);
void x509_verify_cert_info_populate(X509 *cert);
int x509_vfy_check_security_level(X509_STORE_CTX *ctx);

__END_HIDDEN_DECLS

#endif
Changes to jni/libressl/crypto/x509/x509_issuer_cache.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_issuer_cache.c,v 1.2 2020/11/18 17:00:59 tb Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_issuer_cache.c,v 1.3 2022/06/27 14:23:40 beck Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
102
103
104
105
106
107
108











































109
110
111
112
113
114
115
	LeaveCriticalSection(&x509_issuer_tree_cs);
#else
	(void) pthread_mutex_unlock(&x509_issuer_tree_mutex);
#endif

	return 1;
}












































/*
 * Find a previous result of checking if parent signed child
 *
 * Returns:
 *	-1 : No entry exists in the cache. signature must be checked.
 *	0 : The signature of parent signing child is invalid.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
	LeaveCriticalSection(&x509_issuer_tree_cs);
#else
	(void) pthread_mutex_unlock(&x509_issuer_tree_mutex);
#endif

	return 1;
}

/*
 * Free the oldest entry in the issuer cache. Returns 1
 * if an entry was successfuly freed, 0 otherwise. Must
 * be called with x509_issuer_tree_mutex held.
 */
void
x509_issuer_cache_free_oldest()
{
	struct x509_issuer *old;

	if (x509_issuer_cache_count == 0)
		return;
	old = TAILQ_LAST(&x509_issuer_lru, lruqueue);
	TAILQ_REMOVE(&x509_issuer_lru, old, queue);
	RB_REMOVE(x509_issuer_tree, &x509_issuer_cache, old);
	free(old->parent_md);
	free(old->child_md);
	free(old);
	x509_issuer_cache_count--;
}

/*
 * Free the entire issuer cache, discarding all entries.
 */
void
x509_issuer_cache_free()
{
#ifdef _WIN32
	x509_issuer_cache_init_once();
	EnterCriticalSection(&x509_issuer_tree_cs);
#else
	if (pthread_mutex_lock(&x509_issuer_tree_mutex) != 0)
		return;
#endif
	while (x509_issuer_cache_count > 0)
		x509_issuer_cache_free_oldest();
#ifdef _WIN32
	LeaveCriticalSection(&x509_issuer_tree_cs);
#else
	(void) pthread_mutex_unlock(&x509_issuer_tree_mutex);
#endif
}

/*
 * Find a previous result of checking if parent signed child
 *
 * Returns:
 *	-1 : No entry exists in the cache. signature must be checked.
 *	0 : The signature of parent signing child is invalid.
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#ifdef _WIN32
	x509_issuer_cache_init_once();
	EnterCriticalSection(&x509_issuer_tree_cs);
#else
	if (pthread_mutex_lock(&x509_issuer_tree_mutex) != 0)
		goto err_not_locked;
#endif
	while (x509_issuer_cache_count >= x509_issuer_cache_max) {
		struct x509_issuer *old;
		if ((old = TAILQ_LAST(&x509_issuer_lru, lruqueue)) == NULL)
			goto err;
		TAILQ_REMOVE(&x509_issuer_lru, old, queue);
		RB_REMOVE(x509_issuer_tree, &x509_issuer_cache, old);
		free(old->parent_md);
		free(old->child_md);
		free(old);
		x509_issuer_cache_count--;
	}
	if (RB_INSERT(x509_issuer_tree, &x509_issuer_cache, new) == NULL) {
		TAILQ_INSERT_HEAD(&x509_issuer_lru, new, queue);
		x509_issuer_cache_count++;
		new = NULL;
	}
 err:
#ifdef _WIN32
	LeaveCriticalSection(&x509_issuer_tree_cs);
#else
	(void) pthread_mutex_unlock(&x509_issuer_tree_mutex);
#endif
 err_not_locked:
	if (new != NULL) {
		free(new->parent_md);
		free(new->child_md);
	}
	free(new);
	return;
}







|
<
<
<
<
<
<
<
<
|
<





|













227
228
229
230
231
232
233
234








235

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#ifdef _WIN32
	x509_issuer_cache_init_once();
	EnterCriticalSection(&x509_issuer_tree_cs);
#else
	if (pthread_mutex_lock(&x509_issuer_tree_mutex) != 0)
		goto err_not_locked;
#endif
	while (x509_issuer_cache_count >= x509_issuer_cache_max)








		x509_issuer_cache_free_oldest();

	if (RB_INSERT(x509_issuer_tree, &x509_issuer_cache, new) == NULL) {
		TAILQ_INSERT_HEAD(&x509_issuer_lru, new, queue);
		x509_issuer_cache_count++;
		new = NULL;
	}

#ifdef _WIN32
	LeaveCriticalSection(&x509_issuer_tree_cs);
#else
	(void) pthread_mutex_unlock(&x509_issuer_tree_mutex);
#endif
 err_not_locked:
	if (new != NULL) {
		free(new->parent_md);
		free(new->child_md);
	}
	free(new);
	return;
}
Changes to jni/libressl/crypto/x509/x509_issuer_cache.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_issuer_cache.h,v 1.1 2020/09/11 14:30:51 beck Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_issuer_cache.h,v 1.2 2022/09/03 17:47:47 jsing Exp $ */
/*
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
37
38
39
40
41
42
43

44
45
46
47

#define X509_ISSUER_CACHE_MAX 40000	/* Approx 7.5 MB, entries 200 bytes */

int x509_issuer_cache_set_max(size_t max);
int x509_issuer_cache_find(unsigned char *parent_md, unsigned char *child_md);
void x509_issuer_cache_add(unsigned char *parent_md, unsigned char *child_md,
    int valid);


__END_HIDDEN_DECLS

#endif







>




37
38
39
40
41
42
43
44
45
46
47
48

#define X509_ISSUER_CACHE_MAX 40000	/* Approx 7.5 MB, entries 200 bytes */

int x509_issuer_cache_set_max(size_t max);
int x509_issuer_cache_find(unsigned char *parent_md, unsigned char *child_md);
void x509_issuer_cache_add(unsigned char *parent_md, unsigned char *child_md,
    int valid);
void x509_issuer_cache_free();

__END_HIDDEN_DECLS

#endif
Changes to jni/libressl/crypto/x509/x509_lcl.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* x509_lcl.h */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2013.
 */
/* ====================================================================
 * Copyright (c) 2013 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
|











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*	$OpenBSD: x509_lcl.h,v 1.16 2022/08/15 11:52:37 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2013.
 */
/* ====================================================================
 * Copyright (c) 2013 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
	ASN1_OBJECT *object;
	ASN1_BOOLEAN critical;
	ASN1_OCTET_STRING *value;
} /* X509_EXTENSION */;

struct x509_attributes_st {
	ASN1_OBJECT *object;
	int single; /* 0 for a set, 1 for a single item (which is wrong) */
	union {
		char		*ptr;
/* 0 */		STACK_OF(ASN1_TYPE) *set;
/* 1 */		ASN1_TYPE	*single;
	} value;
} /* X509_ATTRIBUTE */;

struct X509_req_info_st {
	ASN1_ENCODING enc;
	ASN1_INTEGER *version;
	X509_NAME *subject;
	X509_PUBKEY *pubkey;







<
<
<
|
<
<







105
106
107
108
109
110
111



112


113
114
115
116
117
118
119
	ASN1_OBJECT *object;
	ASN1_BOOLEAN critical;
	ASN1_OCTET_STRING *value;
} /* X509_EXTENSION */;

struct x509_attributes_st {
	ASN1_OBJECT *object;



	STACK_OF(ASN1_TYPE) *set;


} /* X509_ATTRIBUTE */;

struct X509_req_info_st {
	ASN1_ENCODING enc;
	ASN1_INTEGER *version;
	X509_NAME *subject;
	X509_PUBKEY *pubkey;
273
274
275
276
277
278
279

280
281
282
283
284
285
286
	char *name;
	time_t check_time;	/* Time to use */
	unsigned long inh_flags; /* Inheritance flags */
	unsigned long flags;	/* Various verify flags */
	int purpose;		/* purpose to check untrusted certificates */
	int trust;		/* trust setting to check */
	int depth;		/* Verify depth */

	STACK_OF(ASN1_OBJECT) *policies;	/* Permissible policies */
	X509_VERIFY_PARAM_ID *id;	/* opaque ID data */
} /* X509_VERIFY_PARAM */;

/*
 * This is used to hold everything.  It is used for all certificate
 * validation.  Once we have a certificate chain, the 'verify'







>







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
	char *name;
	time_t check_time;	/* Time to use */
	unsigned long inh_flags; /* Inheritance flags */
	unsigned long flags;	/* Various verify flags */
	int purpose;		/* purpose to check untrusted certificates */
	int trust;		/* trust setting to check */
	int depth;		/* Verify depth */
	int security_level;	/* 'Security level', see SP800-57. */
	STACK_OF(ASN1_OBJECT) *policies;	/* Permissible policies */
	X509_VERIFY_PARAM_ID *id;	/* opaque ID data */
} /* X509_VERIFY_PARAM */;

/*
 * This is used to hold everything.  It is used for all certificate
 * validation.  Once we have a certificate chain, the 'verify'
Changes to jni/libressl/crypto/x509/x509_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_lib.c,v 1.3 2021/11/01 20:53:08 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_lib.c,v 1.4 2022/07/24 21:41:29 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
310
311
312
313
314
315
316
317
318

319
320
321
322
323
324
325
		/* If default then its an error */
		if (ext_op == X509V3_ADD_DEFAULT) {
			errcode = X509V3_R_EXTENSION_EXISTS;
			goto err;
		}
		/* If delete, just delete it */
		if (ext_op == X509V3_ADD_DELETE) {
			if (!sk_X509_EXTENSION_delete(*x, extidx))
				return -1;

			return 1;
		}
	} else {
		/* If replace existing or delete, error since
		 * extension must exist
		 */
		if ((ext_op == X509V3_ADD_REPLACE_EXISTING) ||







|

>







310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
		/* If default then its an error */
		if (ext_op == X509V3_ADD_DEFAULT) {
			errcode = X509V3_R_EXTENSION_EXISTS;
			goto err;
		}
		/* If delete, just delete it */
		if (ext_op == X509V3_ADD_DELETE) {
			if ((extmp = sk_X509_EXTENSION_delete(*x, extidx)) == NULL)
				return -1;
			X509_EXTENSION_free(extmp);
			return 1;
		}
	} else {
		/* If replace existing or delete, error since
		 * extension must exist
		 */
		if ((ext_op == X509V3_ADD_REPLACE_EXISTING) ||
Changes to jni/libressl/crypto/x509/x509_purp.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_purp.c,v 1.13 2021/11/04 23:52:34 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2001.
 */
/* ====================================================================
 * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_purp.c,v 1.16 2022/05/10 19:42:52 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2001.
 */
/* ====================================================================
 * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
595
596
597
598
599
600
601


602
603
604


605
606
607
608
609
610
611
	if (!x->nc && (i != -1))
		x->ex_flags |= EXFLAG_INVALID;
	setup_crldp(x);

#ifndef OPENSSL_NO_RFC3779
	x->rfc3779_addr = X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, &i, NULL);
	if (x->rfc3779_addr == NULL && i != -1)


		x->ex_flags |= EXFLAG_INVALID;
	x->rfc3779_asid = X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum, &i, NULL);
	if (x->rfc3779_asid == NULL && i != -1)


		x->ex_flags |= EXFLAG_INVALID;
#endif

	for (i = 0; i < X509_get_ext_count(x); i++) {
		ex = X509_get_ext(x, i);
		if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) ==
		    NID_freshest_crl)







>
>



>
>







595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
	if (!x->nc && (i != -1))
		x->ex_flags |= EXFLAG_INVALID;
	setup_crldp(x);

#ifndef OPENSSL_NO_RFC3779
	x->rfc3779_addr = X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, &i, NULL);
	if (x->rfc3779_addr == NULL && i != -1)
		x->ex_flags |= EXFLAG_INVALID;
	if (!X509v3_addr_is_canonical(x->rfc3779_addr))
		x->ex_flags |= EXFLAG_INVALID;
	x->rfc3779_asid = X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum, &i, NULL);
	if (x->rfc3779_asid == NULL && i != -1)
		x->ex_flags |= EXFLAG_INVALID;
	if (!X509v3_asid_is_canonical(x->rfc3779_asid))
		x->ex_flags |= EXFLAG_INVALID;
#endif

	for (i = 0; i < X509_get_ext_count(x); i++) {
		ex = X509_get_ext(x, i);
		if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) ==
		    NID_freshest_crl)
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
int
X509_check_ca(X509 *x)
{
	if (!(x->ex_flags & EXFLAG_SET)) {
		CRYPTO_w_lock(CRYPTO_LOCK_X509);
		x509v3_cache_extensions(x);
		CRYPTO_w_unlock(CRYPTO_LOCK_X509);
		if (x->ex_flags & EXFLAG_INVALID)
			return X509_V_ERR_UNSPECIFIED;
	}

	return check_ca(x);
}

/* Check SSL CA: common checks for SSL client and server */
static int







<
<







667
668
669
670
671
672
673


674
675
676
677
678
679
680
int
X509_check_ca(X509 *x)
{
	if (!(x->ex_flags & EXFLAG_SET)) {
		CRYPTO_w_lock(CRYPTO_LOCK_X509);
		x509v3_cache_extensions(x);
		CRYPTO_w_unlock(CRYPTO_LOCK_X509);


	}

	return check_ca(x);
}

/* Check SSL CA: common checks for SSL client and server */
static int
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
}

uint32_t
X509_get_extension_flags(X509 *x)
{
	/* Call for side-effect of computing hash and caching extensions */
	if (X509_check_purpose(x, -1, -1) != 1)
		return 0;

	return x->ex_flags;
}

uint32_t
X509_get_key_usage(X509 *x)
{







|







950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
}

uint32_t
X509_get_extension_flags(X509 *x)
{
	/* Call for side-effect of computing hash and caching extensions */
	if (X509_check_purpose(x, -1, -1) != 1)
		return EXFLAG_INVALID;

	return x->ex_flags;
}

uint32_t
X509_get_key_usage(X509 *x)
{
Changes to jni/libressl/crypto/x509/x509_req.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_req.c,v 1.28 2022/01/22 00:34:48 inoguchi Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_req.c,v 1.29 2022/08/18 16:26:33 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
220
221
222
223
224
225
226


227
228
229
230
231
232
233
234
		idx = X509_REQ_get_attr_by_NID(req, *pnid, -1);
		if (idx == -1)
			continue;
		attr = X509_REQ_get_attr(req, idx);
		ext = X509_ATTRIBUTE_get0_type(attr, 0);
		break;
	}


	if (ext == NULL || ext->type != V_ASN1_SEQUENCE)
		return NULL;
	p = ext->value.sequence->data;
	return d2i_X509_EXTENSIONS(NULL, &p, ext->value.sequence->length);
}

/*
 * Add a STACK_OF extensions to a certificate request: allow alternative OIDs







>
>
|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
		idx = X509_REQ_get_attr_by_NID(req, *pnid, -1);
		if (idx == -1)
			continue;
		attr = X509_REQ_get_attr(req, idx);
		ext = X509_ATTRIBUTE_get0_type(attr, 0);
		break;
	}
	if (ext == NULL)
		return sk_X509_EXTENSION_new_null();
	if (ext->type != V_ASN1_SEQUENCE)
		return NULL;
	p = ext->value.sequence->data;
	return d2i_X509_EXTENSIONS(NULL, &p, ext->value.sequence->length);
}

/*
 * Add a STACK_OF extensions to a certificate request: allow alternative OIDs
Changes to jni/libressl/crypto/x509/x509_txt.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_txt.c,v 1.19 2014/07/11 08:44:49 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_txt.c,v 1.20 2022/07/05 20:31:46 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
177
178
179
180
181
182
183
















184
185
186
187
188
189
		return("unsupported name constraint type");
	case X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX:
		return("unsupported or invalid name constraint syntax");
	case X509_V_ERR_UNSUPPORTED_NAME_SYNTAX:
		return("unsupported or invalid name syntax");
	case X509_V_ERR_CRL_PATH_VALIDATION_ERROR:
		return("CRL path validation error");

















	default:
		(void) snprintf(buf, sizeof buf, "error number %ld", n);
		return(buf);
	}
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
		return("unsupported name constraint type");
	case X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX:
		return("unsupported or invalid name constraint syntax");
	case X509_V_ERR_UNSUPPORTED_NAME_SYNTAX:
		return("unsupported or invalid name syntax");
	case X509_V_ERR_CRL_PATH_VALIDATION_ERROR:
		return("CRL path validation error");
	case X509_V_ERR_HOSTNAME_MISMATCH:
		return("Hostname mismatch");
	case X509_V_ERR_EMAIL_MISMATCH:
		return("Email address mismatch");
	case X509_V_ERR_IP_ADDRESS_MISMATCH:
		return("IP address mismatch");
	case X509_V_ERR_INVALID_CALL:
		return("Invalid certificate verification context");
	case X509_V_ERR_STORE_LOOKUP:
		return("Issuer certificate lookup error");
	case X509_V_ERR_EE_KEY_TOO_SMALL:
		return("EE certificate key too weak");
	case X509_V_ERR_CA_KEY_TOO_SMALL:
		return("CA certificate key too weak");
	case X509_V_ERR_CA_MD_TOO_WEAK:
		return("CA signature digest algorithm too weak");

	default:
		(void) snprintf(buf, sizeof buf, "error number %ld", n);
		return(buf);
	}
}
Changes to jni/libressl/crypto/x509/x509_utl.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_utl.c,v 1.2 2020/09/13 15:06:17 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 1999-2003 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_utl.c,v 1.3 2022/05/20 07:58:54 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 1999-2003 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
		else if (a->length == (int)blen && !memcmp(a->data, b, blen))
			rv = 1;
		if (rv > 0 && peername &&
		    (*peername = strndup((char *)a->data, a->length)) == NULL)
			rv = -1;
	} else {
		int astrlen;
		unsigned char *astr;
		astrlen = ASN1_STRING_to_UTF8(&astr, a);
		if (astrlen < 0)
			return -1;
		rv = equal(astr, astrlen, (unsigned char *)b, blen, flags);
		if (rv > 0 && peername &&
		    (*peername = strndup((char *)astr, astrlen)) == NULL)
			rv = -1;







|







950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
		else if (a->length == (int)blen && !memcmp(a->data, b, blen))
			rv = 1;
		if (rv > 0 && peername &&
		    (*peername = strndup((char *)a->data, a->length)) == NULL)
			rv = -1;
	} else {
		int astrlen;
		unsigned char *astr = NULL;
		astrlen = ASN1_STRING_to_UTF8(&astr, a);
		if (astrlen < 0)
			return -1;
		rv = equal(astr, astrlen, (unsigned char *)b, blen, flags);
		if (rv > 0 && peername &&
		    (*peername = strndup((char *)astr, astrlen)) == NULL)
			rv = -1;
Changes to jni/libressl/crypto/x509/x509_verify.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_verify.c,v 1.54 2021/11/24 05:38:12 beck Exp $ */
/*
 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_verify.c,v 1.60.2.1 2022/10/20 09:45:18 tb Exp $ */
/*
 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
28
29
30
31
32
33
34


35
36
37
38
39
40
41
42
43
#include <openssl/x509v3.h>

#include "x509_internal.h"
#include "x509_issuer_cache.h"

static int x509_verify_cert_valid(struct x509_verify_ctx *ctx, X509 *cert,
    struct x509_verify_chain *current_chain);


static void x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert,
    struct x509_verify_chain *current_chain, int full_chain);
static int x509_verify_cert_error(struct x509_verify_ctx *ctx, X509 *cert,
    size_t depth, int error, int ok);
static void x509_verify_chain_free(struct x509_verify_chain *chain);

/*
 * Parse an asn1 to a representable time_t as per RFC 5280 rules.
 * Returns -1 if that can't be done for any reason.







>
>

|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <openssl/x509v3.h>

#include "x509_internal.h"
#include "x509_issuer_cache.h"

static int x509_verify_cert_valid(struct x509_verify_ctx *ctx, X509 *cert,
    struct x509_verify_chain *current_chain);
static int x509_verify_cert_hostname(struct x509_verify_ctx *ctx, X509 *cert,
    char *name);
static void x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert,
    struct x509_verify_chain *current_chain, int full_chain, char *name);
static int x509_verify_cert_error(struct x509_verify_ctx *ctx, X509 *cert,
    size_t depth, int error, int ok);
static void x509_verify_chain_free(struct x509_verify_chain *chain);

/*
 * Parse an asn1 to a representable time_t as per RFC 5280 rules.
 * Returns -1 if that can't be done for any reason.
229
230
231
232
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256









257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279

280
281
282
283
284
285
286
287
288

static void
x509_verify_ctx_clear(struct x509_verify_ctx *ctx)
{
	x509_verify_ctx_reset(ctx);
	sk_X509_pop_free(ctx->intermediates, X509_free);
	free(ctx->chains);
	memset(ctx, 0, sizeof(*ctx));
}

static int
x509_verify_cert_cache_extensions(X509 *cert) {

	if (!(cert->ex_flags & EXFLAG_SET)) {
		CRYPTO_w_lock(CRYPTO_LOCK_X509);
		x509v3_cache_extensions(cert);
		CRYPTO_w_unlock(CRYPTO_LOCK_X509);
	}
	if (cert->ex_flags & EXFLAG_INVALID)
		return 0;

	return (cert->ex_flags & EXFLAG_SET);
}

static int
x509_verify_cert_self_signed(X509 *cert)
{
	return (cert->ex_flags & EXFLAG_SS) ? 1 : 0;
}










static int
x509_verify_ctx_cert_is_root(struct x509_verify_ctx *ctx, X509 *cert,
    int full_chain)
{
	X509 *match = NULL;
	int i;

	if (!x509_verify_cert_cache_extensions(cert))
		return 0;

	/* Check by lookup if we have a legacy xsc */
	if (ctx->xsc != NULL) {
		if ((match = x509_vfy_lookup_cert_match(ctx->xsc,
		    cert)) != NULL) {
			X509_free(match);
			return !full_chain ||
			    x509_verify_cert_self_signed(cert);
		}
	} else {
		/* Check the provided roots */
		for (i = 0; i < sk_X509_num(ctx->roots); i++) {
			if (X509_cmp(sk_X509_value(ctx->roots, i), cert) == 0)

				return !full_chain ||
				    x509_verify_cert_self_signed(cert);
		}
	}

	return 0;
}

static int







|



|
>
















>
>
>
>
>
>
>
>
>
















|
|





>
|
<







231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293

294
295
296
297
298
299
300

static void
x509_verify_ctx_clear(struct x509_verify_ctx *ctx)
{
	x509_verify_ctx_reset(ctx);
	sk_X509_pop_free(ctx->intermediates, X509_free);
	free(ctx->chains);

}

static int
x509_verify_cert_cache_extensions(X509 *cert)
{
	if (!(cert->ex_flags & EXFLAG_SET)) {
		CRYPTO_w_lock(CRYPTO_LOCK_X509);
		x509v3_cache_extensions(cert);
		CRYPTO_w_unlock(CRYPTO_LOCK_X509);
	}
	if (cert->ex_flags & EXFLAG_INVALID)
		return 0;

	return (cert->ex_flags & EXFLAG_SET);
}

static int
x509_verify_cert_self_signed(X509 *cert)
{
	return (cert->ex_flags & EXFLAG_SS) ? 1 : 0;
}

/* XXX beck - clean up this mess of is_root */
static int
x509_verify_check_chain_end(X509 *cert, int full_chain)
{
	if (full_chain)
		return x509_verify_cert_self_signed(cert);
	return 1;
}

static int
x509_verify_ctx_cert_is_root(struct x509_verify_ctx *ctx, X509 *cert,
    int full_chain)
{
	X509 *match = NULL;
	int i;

	if (!x509_verify_cert_cache_extensions(cert))
		return 0;

	/* Check by lookup if we have a legacy xsc */
	if (ctx->xsc != NULL) {
		if ((match = x509_vfy_lookup_cert_match(ctx->xsc,
		    cert)) != NULL) {
			X509_free(match);
			return x509_verify_check_chain_end(cert, full_chain);

		}
	} else {
		/* Check the provided roots */
		for (i = 0; i < sk_X509_num(ctx->roots); i++) {
			if (X509_cmp(sk_X509_value(ctx->roots, i), cert) == 0)
				return x509_verify_check_chain_end(cert,
				    full_chain);

		}
	}

	return 0;
}

static int
386
387
388
389
390
391
392








393
394
395



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
	 * for the fiddling.
	 */

	/* These may be set in one of the following calls. */
	ctx->xsc->error = X509_V_OK;
	ctx->xsc->error_depth = 0;









	trust = x509_vfy_check_trust(ctx->xsc);
	if (trust == X509_TRUST_REJECTED)
		goto err;




	if (!x509_verify_ctx_set_xsc_chain(ctx, chain, 0, 1))
		goto err;

	/*
	 * XXX currently this duplicates some work done in chain
	 * build, but we keep it here until we have feature parity
	 */
	if (!x509_vfy_check_chain_extensions(ctx->xsc))
		goto err;

#ifndef OPENSSL_NO_RFC3779
	if (!X509v3_asid_validate_path(ctx->xsc))
		goto err;

	if (!X509v3_addr_validate_path(ctx->xsc))
		goto err;
#endif




	if (!x509_constraints_chain(ctx->xsc->chain,
		&ctx->xsc->error, &ctx->xsc->error_depth)) {
		X509 *cert = sk_X509_value(ctx->xsc->chain, depth);
		if (!x509_verify_cert_error(ctx, cert,
			ctx->xsc->error_depth, ctx->xsc->error, 0))
			goto err;
	}

	if (!x509_vfy_check_revocation(ctx->xsc))
		goto err;

	if (!x509_vfy_check_policy(ctx->xsc))
		goto err;

	if ((!(ctx->xsc->param->flags & X509_V_FLAG_PARTIAL_CHAIN)) &&
	    trust != X509_TRUST_TRUSTED)
		goto err;

	ret = 1;

 err:
	/*
	 * The above checks may have set ctx->xsc->error and
	 * ctx->xsc->error_depth - save these for later on.
	 */







>
>
>
>
>
>
>
>


|
>
>
>
|
<
<















>
>
>















<
<
<
<







398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419


420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452




453
454
455
456
457
458
459
	 * for the fiddling.
	 */

	/* These may be set in one of the following calls. */
	ctx->xsc->error = X509_V_OK;
	ctx->xsc->error_depth = 0;

	if (!x509_verify_ctx_set_xsc_chain(ctx, chain, 0, 1))
		goto err;

	/*
	 * Call the legacy code to walk the chain and check trust
	 * in the legacy way to handle partial chains and get the
	 * callback fired correctly.
	 */
	trust = x509_vfy_check_trust(ctx->xsc);
	if (trust == X509_TRUST_REJECTED)
		goto err; /* callback was called in x509_vfy_check_trust */
	if (trust != X509_TRUST_TRUSTED) {
		/* NOTREACHED */
		goto err;  /* should not happen if we get in here - abort? */
	}



	/*
	 * XXX currently this duplicates some work done in chain
	 * build, but we keep it here until we have feature parity
	 */
	if (!x509_vfy_check_chain_extensions(ctx->xsc))
		goto err;

#ifndef OPENSSL_NO_RFC3779
	if (!X509v3_asid_validate_path(ctx->xsc))
		goto err;

	if (!X509v3_addr_validate_path(ctx->xsc))
		goto err;
#endif

	if (!x509_vfy_check_security_level(ctx->xsc))
		goto err;

	if (!x509_constraints_chain(ctx->xsc->chain,
		&ctx->xsc->error, &ctx->xsc->error_depth)) {
		X509 *cert = sk_X509_value(ctx->xsc->chain, depth);
		if (!x509_verify_cert_error(ctx, cert,
			ctx->xsc->error_depth, ctx->xsc->error, 0))
			goto err;
	}

	if (!x509_vfy_check_revocation(ctx->xsc))
		goto err;

	if (!x509_vfy_check_policy(ctx->xsc))
		goto err;





	ret = 1;

 err:
	/*
	 * The above checks may have set ctx->xsc->error and
	 * ctx->xsc->error_depth - save these for later on.
	 */
448
449
450
451
452
453
454
455
456
457
458

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475









476
477
478
479
480
481
482
483
484
485
486
487
488
489
490

491
492

493
494
495
496
497
498
499

	return ret;
}

/* Add a validated chain to our list of valid chains */
static int
x509_verify_ctx_add_chain(struct x509_verify_ctx *ctx,
    struct x509_verify_chain *chain)
{
	size_t depth;
	X509 *last = x509_verify_chain_last(chain);


	depth = sk_X509_num(chain->certs);
	if (depth > 0)
		depth--;

	if (ctx->chains_count >= ctx->max_chains)
		return x509_verify_cert_error(ctx, last, depth,
		    X509_V_ERR_CERT_CHAIN_TOO_LONG, 0);

	/* Clear a get issuer failure for a root certificate. */
	if (chain->cert_errors[depth] ==
	    X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY)
		chain->cert_errors[depth] = X509_V_OK;

	if (!x509_verify_ctx_validate_legacy_chain(ctx, chain, depth))
		return 0;










	/*
	 * In the non-legacy code, extensions and purpose are dealt
	 * with as the chain is built.
	 *
	 * The non-legacy api returns multiple chains but does not do
	 * any revocation checking (it must be done by the caller on
	 * any chain they wish to use)
	 */

	if ((ctx->chains[ctx->chains_count] = x509_verify_chain_dup(chain)) ==
	    NULL) {
		return x509_verify_cert_error(ctx, last, depth,
		    X509_V_ERR_OUT_OF_MEM, 0);
	}
	ctx->chains_count++;

	ctx->error = X509_V_OK;
	ctx->error_depth = depth;

	return 1;
}

static int
x509_verify_potential_parent(struct x509_verify_ctx *ctx, X509 *parent,
    X509 *child)
{







|



>

















>
>
>
>
>
>
>
>
>















>


>







468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531

	return ret;
}

/* Add a validated chain to our list of valid chains */
static int
x509_verify_ctx_add_chain(struct x509_verify_ctx *ctx,
    struct x509_verify_chain *chain, char *name)
{
	size_t depth;
	X509 *last = x509_verify_chain_last(chain);
	X509 *leaf = x509_verify_chain_leaf(chain);

	depth = sk_X509_num(chain->certs);
	if (depth > 0)
		depth--;

	if (ctx->chains_count >= ctx->max_chains)
		return x509_verify_cert_error(ctx, last, depth,
		    X509_V_ERR_CERT_CHAIN_TOO_LONG, 0);

	/* Clear a get issuer failure for a root certificate. */
	if (chain->cert_errors[depth] ==
	    X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY)
		chain->cert_errors[depth] = X509_V_OK;

	if (!x509_verify_ctx_validate_legacy_chain(ctx, chain, depth))
		return 0;

	/* Verify the leaf certificate and store any resulting error. */
	if (!x509_verify_cert_valid(ctx, leaf, NULL))
		return 0;
	if (!x509_verify_cert_hostname(ctx, leaf, name))
		return 0;
	if (ctx->error_depth == 0 &&
	    ctx->error != X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY)
		chain->cert_errors[0] = ctx->error;

	/*
	 * In the non-legacy code, extensions and purpose are dealt
	 * with as the chain is built.
	 *
	 * The non-legacy api returns multiple chains but does not do
	 * any revocation checking (it must be done by the caller on
	 * any chain they wish to use)
	 */

	if ((ctx->chains[ctx->chains_count] = x509_verify_chain_dup(chain)) ==
	    NULL) {
		return x509_verify_cert_error(ctx, last, depth,
		    X509_V_ERR_OUT_OF_MEM, 0);
	}
	ctx->chains_count++;

	ctx->error = X509_V_OK;
	ctx->error_depth = depth;

	return 1;
}

static int
x509_verify_potential_parent(struct x509_verify_ctx *ctx, X509 *parent,
    X509 *child)
{
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548

	return ret;
}

static int
x509_verify_consider_candidate(struct x509_verify_ctx *ctx, X509 *cert,
    int is_root_cert, X509 *candidate, struct x509_verify_chain *current_chain,
    int full_chain)
{
	int depth = sk_X509_num(current_chain->certs);
	struct x509_verify_chain *new_chain;
	int i;

	/* Fail if the certificate is already in the chain */
	for (i = 0; i < sk_X509_num(current_chain->certs); i++) {







|







566
567
568
569
570
571
572
573
574
575
576
577
578
579
580

	return ret;
}

static int
x509_verify_consider_candidate(struct x509_verify_ctx *ctx, X509 *cert,
    int is_root_cert, X509 *candidate, struct x509_verify_chain *current_chain,
    int full_chain, char *name)
{
	int depth = sk_X509_num(current_chain->certs);
	struct x509_verify_chain *new_chain;
	int i;

	/* Fail if the certificate is already in the chain */
	for (i = 0; i < sk_X509_num(current_chain->certs); i++) {
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
	 * give up.
	 */
	if (is_root_cert) {
		if (!x509_verify_ctx_set_xsc_chain(ctx, new_chain, 0, 1)) {
			x509_verify_chain_free(new_chain);
			return 0;
		}
		if (!x509_verify_ctx_add_chain(ctx, new_chain)) {
			x509_verify_chain_free(new_chain);
			return 0;
		}
		goto done;
	}

	x509_verify_build_chains(ctx, candidate, new_chain, full_chain);

 done:
	x509_verify_chain_free(new_chain);
	return 1;
}

static int







|






|







617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
	 * give up.
	 */
	if (is_root_cert) {
		if (!x509_verify_ctx_set_xsc_chain(ctx, new_chain, 0, 1)) {
			x509_verify_chain_free(new_chain);
			return 0;
		}
		if (!x509_verify_ctx_add_chain(ctx, new_chain, name)) {
			x509_verify_chain_free(new_chain);
			return 0;
		}
		goto done;
	}

	x509_verify_build_chains(ctx, candidate, new_chain, full_chain, name);

 done:
	x509_verify_chain_free(new_chain);
	return 1;
}

static int
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
		return ctx->xsc->verify_cb(ok, ctx->xsc);
	}
	return ok;
}

static void
x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert,
    struct x509_verify_chain *current_chain, int full_chain)
{
	X509 *candidate;
	int i, depth, count, ret, is_root;

	/*
	 * If we are finding chains with an xsc, just stop after we have
	 * one chain, there's no point in finding more, it just exercises







|







648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
		return ctx->xsc->verify_cb(ok, ctx->xsc);
	}
	return ok;
}

static void
x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert,
    struct x509_verify_chain *current_chain, int full_chain, char *name)
{
	X509 *candidate;
	int i, depth, count, ret, is_root;

	/*
	 * If we are finding chains with an xsc, just stop after we have
	 * one chain, there's no point in finding more, it just exercises
670
671
672
673
674
675
676

677
678
679
680
681
682
683
684
685
686
687
688
689

690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
		if ((ret = ctx->xsc->get_issuer(&candidate, ctx->xsc, cert)) < 0) {
			x509_verify_cert_error(ctx, cert, depth,
			    X509_V_ERR_STORE_LOOKUP, 0);
			return;
		}
		if (ret > 0) {
			if (x509_verify_potential_parent(ctx, candidate, cert)) {

				is_root = !full_chain ||
				    x509_verify_cert_self_signed(candidate);
				x509_verify_consider_candidate(ctx, cert,
				    is_root, candidate, current_chain,
				    full_chain);
			}
			X509_free(candidate);
		}
	} else {
		/* Check to see if we have a trusted root issuer. */
		for (i = 0; i < sk_X509_num(ctx->roots); i++) {
			candidate = sk_X509_value(ctx->roots, i);
			if (x509_verify_potential_parent(ctx, candidate, cert)) {

				is_root = !full_chain ||
				    x509_verify_cert_self_signed(candidate);
				x509_verify_consider_candidate(ctx, cert,
				    is_root, candidate, current_chain,
				    full_chain);
			}
		}
	}

	/* Check intermediates after checking roots */
	if (ctx->intermediates != NULL) {
		for (i = 0; i < sk_X509_num(ctx->intermediates); i++) {
			candidate = sk_X509_value(ctx->intermediates, i);
			if (x509_verify_potential_parent(ctx, candidate, cert)) {
				x509_verify_consider_candidate(ctx, cert,
				    0, candidate, current_chain,
				    full_chain);
			}
		}
	}

	if (ctx->chains_count > count) {
		if (ctx->xsc != NULL) {
			ctx->xsc->error = X509_V_OK;







>
|
<


|








>
|
<


|











|







702
703
704
705
706
707
708
709
710

711
712
713
714
715
716
717
718
719
720
721
722
723

724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
		if ((ret = ctx->xsc->get_issuer(&candidate, ctx->xsc, cert)) < 0) {
			x509_verify_cert_error(ctx, cert, depth,
			    X509_V_ERR_STORE_LOOKUP, 0);
			return;
		}
		if (ret > 0) {
			if (x509_verify_potential_parent(ctx, candidate, cert)) {
				is_root = x509_verify_check_chain_end(candidate,
				    full_chain);

				x509_verify_consider_candidate(ctx, cert,
				    is_root, candidate, current_chain,
				    full_chain, name);
			}
			X509_free(candidate);
		}
	} else {
		/* Check to see if we have a trusted root issuer. */
		for (i = 0; i < sk_X509_num(ctx->roots); i++) {
			candidate = sk_X509_value(ctx->roots, i);
			if (x509_verify_potential_parent(ctx, candidate, cert)) {
				is_root = x509_verify_check_chain_end(candidate,
				    full_chain);

				x509_verify_consider_candidate(ctx, cert,
				    is_root, candidate, current_chain,
				    full_chain, name);
			}
		}
	}

	/* Check intermediates after checking roots */
	if (ctx->intermediates != NULL) {
		for (i = 0; i < sk_X509_num(ctx->intermediates); i++) {
			candidate = sk_X509_value(ctx->intermediates, i);
			if (x509_verify_potential_parent(ctx, candidate, cert)) {
				x509_verify_consider_candidate(ctx, cert,
				    0, candidate, current_chain,
				    full_chain, name);
			}
		}
	}

	if (ctx->chains_count > count) {
		if (ctx->xsc != NULL) {
			ctx->xsc->error = X509_V_OK;
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127








1128
1129
1130
1131
1132
1133
1134
1135

1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153

1154
1155
1156
1157
1158
1159
1160
			ctx->error = X509_V_ERR_OUT_OF_MEM;
			goto err;
		}
		ctx->xsc->error_depth = 0;
		ctx->xsc->current_cert = leaf;
	}

	if (!x509_verify_cert_valid(ctx, leaf, NULL))
		goto err;

	if (!x509_verify_cert_hostname(ctx, leaf, name))
		goto err;

	if ((current_chain = x509_verify_chain_new()) == NULL) {
		ctx->error = X509_V_ERR_OUT_OF_MEM;
		goto err;
	}








	if (!x509_verify_chain_append(current_chain, leaf, &ctx->error)) {
		x509_verify_chain_free(current_chain);
		goto err;
	}
	do {
		retry_chain_build = 0;
		if (x509_verify_ctx_cert_is_root(ctx, leaf, full_chain)) {
			if (!x509_verify_ctx_add_chain(ctx, current_chain)) {

				x509_verify_chain_free(current_chain);
				goto err;
			}
		} else {
			x509_verify_build_chains(ctx, leaf, current_chain,
			    full_chain);
			if (full_chain && ctx->chains_count == 0) {
				/*
				 * Save the error state from the xsc
				 * at this point to put back on the
				 * xsc in case we do not find a chain
				 * that is trusted but not a full
				 * chain to a self signed root. This
				 * is because the unvalidated chain is
				 * used by the autochain batshittery
				 * on failure and will be needed for
				 * that.
				 */

				if (!x509_verify_ctx_save_xsc_error(ctx)) {
					x509_verify_chain_free(current_chain);
					goto err;
				}
				full_chain = 0;
				retry_chain_build = 1;
			}







<
<
<
<
<
<




>
>
>
>
>
>
>
>







|
>





|












>







1143
1144
1145
1146
1147
1148
1149






1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
			ctx->error = X509_V_ERR_OUT_OF_MEM;
			goto err;
		}
		ctx->xsc->error_depth = 0;
		ctx->xsc->current_cert = leaf;
	}







	if ((current_chain = x509_verify_chain_new()) == NULL) {
		ctx->error = X509_V_ERR_OUT_OF_MEM;
		goto err;
	}

	/*
	 * Add the leaf to the chain and try to build chains from it.
	 * Note that unlike Go's verifier, we have not yet checked
	 * anything about the leaf, This is intentional, so that we
	 * report failures in chain building before we report problems
	 * with the leaf.
	 */
	if (!x509_verify_chain_append(current_chain, leaf, &ctx->error)) {
		x509_verify_chain_free(current_chain);
		goto err;
	}
	do {
		retry_chain_build = 0;
		if (x509_verify_ctx_cert_is_root(ctx, leaf, full_chain)) {
			if (!x509_verify_ctx_add_chain(ctx, current_chain,
			    name)) {
				x509_verify_chain_free(current_chain);
				goto err;
			}
		} else {
			x509_verify_build_chains(ctx, leaf, current_chain,
			    full_chain, name);
			if (full_chain && ctx->chains_count == 0) {
				/*
				 * Save the error state from the xsc
				 * at this point to put back on the
				 * xsc in case we do not find a chain
				 * that is trusted but not a full
				 * chain to a self signed root. This
				 * is because the unvalidated chain is
				 * used by the autochain batshittery
				 * on failure and will be needed for
				 * that.
				 */
				ctx->xsc->error_depth = ctx->error_depth;
				if (!x509_verify_ctx_save_xsc_error(ctx)) {
					x509_verify_chain_free(current_chain);
					goto err;
				}
				full_chain = 0;
				retry_chain_build = 1;
			}
1255
1256
1257
1258
1259
1260
1261
1262
		if (ctx->xsc->error == X509_V_OK)
			ctx->xsc->error = X509_V_ERR_UNSPECIFIED;
		ctx->error = ctx->xsc->error;
	}

	return 0;
}








<
1291
1292
1293
1294
1295
1296
1297

		if (ctx->xsc->error == X509_V_OK)
			ctx->xsc->error = X509_V_ERR_UNSPECIFIED;
		ctx->error = ctx->xsc->error;
	}

	return 0;
}

Changes to jni/libressl/crypto/x509/x509_vfy.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_vfy.c,v 1.101 2022/01/22 00:36:46 inoguchi Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_vfy.c,v 1.103 2022/08/31 07:15:31 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
140
141
142
143
144
145
146


147
148
149
150
151
152
153
static int check_crl_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *cert_path,
    STACK_OF(X509) *crl_path);
static int X509_cmp_time_internal(const ASN1_TIME *ctm, time_t *cmp_time,
    int clamp_notafter);

static int internal_verify(X509_STORE_CTX *ctx);
static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);



int ASN1_time_tm_clamp_notafter(struct tm *tm);

static int
null_callback(int ok, X509_STORE_CTX *e)
{
	return ok;







>
>







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
static int check_crl_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *cert_path,
    STACK_OF(X509) *crl_path);
static int X509_cmp_time_internal(const ASN1_TIME *ctm, time_t *cmp_time,
    int clamp_notafter);

static int internal_verify(X509_STORE_CTX *ctx);
static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
static int check_key_level(X509_STORE_CTX *ctx, X509 *cert);
static int verify_cb_cert(X509_STORE_CTX *ctx, X509 *x, int depth, int err);

int ASN1_time_tm_clamp_notafter(struct tm *tm);

static int
null_callback(int ok, X509_STORE_CTX *e)
{
	return ok;
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
	ctx->error_depth = 0;
	return ctx->verify_cb(0, ctx);
}

static int
check_hosts(X509 *x, X509_VERIFY_PARAM_ID *id)
{
	size_t i, n;
	char *name;

	n = sk_OPENSSL_STRING_num(id->hosts);
	free(id->peername);
	id->peername = NULL;

	for (i = 0; i < n; ++i) {







|







182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
	ctx->error_depth = 0;
	return ctx->verify_cb(0, ctx);
}

static int
check_hosts(X509 *x, X509_VERIFY_PARAM_ID *id)
{
	int i, n;
	char *name;

	n = sk_OPENSSL_STRING_num(id->hosts);
	free(id->peername);
	id->peername = NULL;

	for (i = 0; i < n; ++i) {
537
538
539
540
541
542
543





544
545
546
547
548
549
550
	if (!X509_verify_cert_legacy_build_chain(ctx, &bad_chain, &ok))
		goto end;

	/* We have the chain complete: now we need to check its purpose */
	ok = check_chain_extensions(ctx);
	if (!ok)
		goto end;






	/* Check name constraints */
	ok = check_name_constraints(ctx);
	if (!ok)
		goto end;

#ifndef OPENSSL_NO_RFC3779







>
>
>
>
>







539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
	if (!X509_verify_cert_legacy_build_chain(ctx, &bad_chain, &ok))
		goto end;

	/* We have the chain complete: now we need to check its purpose */
	ok = check_chain_extensions(ctx);
	if (!ok)
		goto end;

	/* Check that the chain satisfies the security level. */
	ok = x509_vfy_check_security_level(ctx);
	if (!ok)
		goto end;

	/* Check name constraints */
	ok = check_name_constraints(ctx);
	if (!ok)
		goto end;

#ifndef OPENSSL_NO_RFC3779
624
625
626
627
628
629
630








631
632
633
634
635
636
637
		 * This X509_STORE_CTX has not been properly initialized.
		 */
		X509error(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
		ctx->error = X509_V_ERR_INVALID_CALL;
		return -1;
	}









	/*
	 * If flags request legacy, use the legacy verifier. If we
	 * requested "no alt chains" from the age of hammer pants, use
	 * the legacy verifier because the multi chain verifier really
	 * does find all the "alt chains".
	 *
	 * XXX deprecate the NO_ALT_CHAINS flag?







>
>
>
>
>
>
>
>







631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
		 * This X509_STORE_CTX has not been properly initialized.
		 */
		X509error(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
		ctx->error = X509_V_ERR_INVALID_CALL;
		return -1;
	}

	/*
	 * If the certificate's public key is too weak, don't bother
	 * continuing.
	 */
	if (!check_key_level(ctx, ctx->cert) &&
	    !verify_cb_cert(ctx, ctx->cert, 0, X509_V_ERR_EE_KEY_TOO_SMALL))
		return 0;

	/*
	 * If flags request legacy, use the legacy verifier. If we
	 * requested "no alt chains" from the age of hammer pants, use
	 * the legacy verifier because the multi chain verifier really
	 * does find all the "alt chains".
	 *
	 * XXX deprecate the NO_ALT_CHAINS flag?
2592
2593
2594
2595
2596
2597
2598






























































































































void
X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param)
{
	if (ctx->param)
		X509_VERIFY_PARAM_free(ctx->param);
	ctx->param = param;
}





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
void
X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param)
{
	if (ctx->param)
		X509_VERIFY_PARAM_free(ctx->param);
	ctx->param = param;
}

/*
 * Check if |bits| are adequate for |security level|.
 * Returns 1 if ok, 0 otherwise.
 */
static int
enough_bits_for_security_level(int bits, int level)
{
	/*
	 * Sigh. OpenSSL does this silly squashing, so we will
	 * too. Derp for Derp compatibility being important.
	 */
	if (level < 0)
		level = 0;
	if (level > 5)
		level = 5;

	switch (level) {
	case 0:
		return 1;
	case 1:
		return bits >= 80;
	case 2:
		return bits >= 112;
	case 3:
		return bits >= 128;
	case 4:
		return bits >= 192;
	case 5:
		return bits >= 256;
	default:
		return 0;
	}
}

/*
 * Check whether the public key of |cert| meets the security level of |ctx|.
 *
 * Returns 1 on success, 0 otherwise.
 */
static int
check_key_level(X509_STORE_CTX *ctx, X509 *cert)
{
	EVP_PKEY *pkey;
	int bits;

	/* Unsupported or malformed keys are not secure */
	if ((pkey = X509_get0_pubkey(cert)) == NULL)
		return 0;

	if ((bits = EVP_PKEY_security_bits(pkey)) <= 0)
		return 0;

	return enough_bits_for_security_level(bits, ctx->param->security_level);
}

/*
 * Check whether the signature digest algorithm of |cert| meets the security
 * level of |ctx|.  Do not check trust anchors (self-signed or not).
 *
 * Returns 1 on success, 0 otherwise.
 */
static int
check_sig_level(X509_STORE_CTX *ctx, X509 *cert)
{
	const EVP_MD *md;
	int bits, nid, md_nid;

	if ((nid = X509_get_signature_nid(cert)) == NID_undef)
		return 0;

	/*
	 * Look up signature algorithm digest.
	 */

	if (!OBJ_find_sigid_algs(nid, &md_nid, NULL))
		return 0;

	if (md_nid == NID_undef)
		return 0;

	if ((md = EVP_get_digestbynid(md_nid)) == NULL)
		return 0;

	/* Assume 4 bits of collision resistance for each hash octet. */
	bits = EVP_MD_size(md) * 4;

	return enough_bits_for_security_level(bits, ctx->param->security_level);
}

int
x509_vfy_check_security_level(X509_STORE_CTX *ctx)
{
	int num = sk_X509_num(ctx->chain);
	int i;

	if (ctx->param->security_level <= 0)
		return 1;

	for (i = 0; i < num; i++) {
		X509 *cert = sk_X509_value(ctx->chain, i);

		/*
		 * We've already checked the security of the leaf key, so here
		 * we only check the security of issuer keys.
		 */
		if (i > 0) {
			if (!check_key_level(ctx, cert) &&
			    !verify_cb_cert(ctx, cert, i,
			    X509_V_ERR_CA_KEY_TOO_SMALL))
				return 0;
		}

		/*
		 * We also check the signature algorithm security of all certs
		 * except those of the trust anchor at index num - 1.
		 */
		if (i == num - 1)
			break;

		if (!check_sig_level(ctx, cert) &&
		    !verify_cb_cert(ctx, cert, i, X509_V_ERR_CA_MD_TOO_WEAK))
			return 0;
	}
	return 1;
}
Changes to jni/libressl/crypto/x509/x509_vpm.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_vpm.c,v 1.28 2021/11/01 20:53:08 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2004.
 */
/* ====================================================================
 * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_vpm.c,v 1.30 2022/07/04 12:17:32 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2004.
 */
/* ====================================================================
 * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
448
449
450
451
452
453
454












455
456
457
458
459
460
461
}

void
X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth)
{
	param->depth = depth;
}













void
X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t)
{
	param->check_time = t;
	param->flags |= X509_V_FLAG_USE_CHECK_TIME;
}







>
>
>
>
>
>
>
>
>
>
>
>







448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
}

void
X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth)
{
	param->depth = depth;
}

void
X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level)
{
	param->security_level = auth_level;
}

time_t
X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param)
{
	return param->check_time;
}

void
X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t)
{
	param->check_time = t;
	param->flags |= X509_V_FLAG_USE_CHECK_TIME;
}
Changes to jni/libressl/crypto/x509/x_all.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: x_all.c,v 1.25 2021/12/03 16:46:50 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x_all.c,v 1.26 2022/06/26 04:14:43 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
}

int
X509_verify(X509 *a, EVP_PKEY *r)
{
	if (X509_ALGOR_cmp(a->sig_alg, a->cert_info->signature))
		return 0;
	return(ASN1_item_verify(&X509_CINF_it, a->sig_alg,
	    a->signature, a->cert_info, r));
}

int
X509_REQ_verify(X509_REQ *a, EVP_PKEY *r)
{
	return (ASN1_item_verify(&X509_REQ_INFO_it,







|







379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
}

int
X509_verify(X509 *a, EVP_PKEY *r)
{
	if (X509_ALGOR_cmp(a->sig_alg, a->cert_info->signature))
		return 0;
	return (ASN1_item_verify(&X509_CINF_it, a->sig_alg,
	    a->signature, a->cert_info, r));
}

int
X509_REQ_verify(X509_REQ *a, EVP_PKEY *r)
{
	return (ASN1_item_verify(&X509_REQ_INFO_it,
Changes to jni/libressl/depcomp.
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2020 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,





|







1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2021 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
Changes to jni/libressl/include/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
  dir0=`pwd`; \
  sed_first='s,^\([^/]*\)/.*$$,\1,'; \







<
<







183
184
185
186
187
188
189


190
191
192
193
194
195
196
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
  dir0=`pwd`; \
  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
230
231
232
233
234
235
236


237
238
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







>
>










>







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







517
518
519
520
521
522
523

524
525
526
527
528
529
530
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
Changes to jni/libressl/include/compat/endian.h.
22
23
24
25
26
27
28



29
30
31
32
33
34
35
#endif

#elif defined(ANDROID) && !defined(__clang__)
#include_next <machine/endian.h>

#elif defined(HAVE_ENDIAN_H)
#include_next <endian.h>




#elif defined(__sun) || defined(_AIX) || defined(__hpux)
#include <sys/types.h>
#include <arpa/nameser_compat.h>

#elif defined(__sgi)
#include <standards.h>







>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#endif

#elif defined(ANDROID) && !defined(__clang__)
#include_next <machine/endian.h>

#elif defined(HAVE_ENDIAN_H)
#include_next <endian.h>

#elif defined(HAVE_MACHINE_ENDIAN_H)
#include_next <machine/endian.h>

#elif defined(__sun) || defined(_AIX) || defined(__hpux)
#include <sys/types.h>
#include <arpa/nameser_compat.h>

#elif defined(__sgi)
#include <standards.h>
Changes to jni/libressl/include/openssl/Makefile.am.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
opensslinclude_HEADERS += cmac.h
opensslinclude_HEADERS += cms.h
opensslinclude_HEADERS += comp.h
opensslinclude_HEADERS += conf.h
opensslinclude_HEADERS += conf_api.h
opensslinclude_HEADERS += crypto.h
opensslinclude_HEADERS += ct.h
opensslinclude_HEADERS += cterr.h
opensslinclude_HEADERS += curve25519.h
opensslinclude_HEADERS += des.h
opensslinclude_HEADERS += dh.h
opensslinclude_HEADERS += dsa.h
opensslinclude_HEADERS += dso.h
opensslinclude_HEADERS += dtls1.h
opensslinclude_HEADERS += ec.h
opensslinclude_HEADERS += ecdh.h
opensslinclude_HEADERS += ecdsa.h
opensslinclude_HEADERS += engine.h
opensslinclude_HEADERS += err.h
opensslinclude_HEADERS += evp.h
opensslinclude_HEADERS += gost.h
opensslinclude_HEADERS += hkdf.h
opensslinclude_HEADERS += hmac.h
opensslinclude_HEADERS += idea.h

opensslinclude_HEADERS += lhash.h
opensslinclude_HEADERS += md4.h
opensslinclude_HEADERS += md5.h
opensslinclude_HEADERS += modes.h
opensslinclude_HEADERS += obj_mac.h
opensslinclude_HEADERS += objects.h
opensslinclude_HEADERS += ocsp.h







<
















>







17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
opensslinclude_HEADERS += cmac.h
opensslinclude_HEADERS += cms.h
opensslinclude_HEADERS += comp.h
opensslinclude_HEADERS += conf.h
opensslinclude_HEADERS += conf_api.h
opensslinclude_HEADERS += crypto.h
opensslinclude_HEADERS += ct.h

opensslinclude_HEADERS += curve25519.h
opensslinclude_HEADERS += des.h
opensslinclude_HEADERS += dh.h
opensslinclude_HEADERS += dsa.h
opensslinclude_HEADERS += dso.h
opensslinclude_HEADERS += dtls1.h
opensslinclude_HEADERS += ec.h
opensslinclude_HEADERS += ecdh.h
opensslinclude_HEADERS += ecdsa.h
opensslinclude_HEADERS += engine.h
opensslinclude_HEADERS += err.h
opensslinclude_HEADERS += evp.h
opensslinclude_HEADERS += gost.h
opensslinclude_HEADERS += hkdf.h
opensslinclude_HEADERS += hmac.h
opensslinclude_HEADERS += idea.h
opensslinclude_HEADERS += kdf.h
opensslinclude_HEADERS += lhash.h
opensslinclude_HEADERS += md4.h
opensslinclude_HEADERS += md5.h
opensslinclude_HEADERS += modes.h
opensslinclude_HEADERS += obj_mac.h
opensslinclude_HEADERS += objects.h
opensslinclude_HEADERS += ocsp.h
Changes to jni/libressl/include/openssl/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
am__can_run_installinfo = \
  case $$AM_UPDATE_INFO_DIR in \
    n|no|NO) false;; \
    *) (install-info --version) >/dev/null 2>&1;; \
  esac
am__opensslinclude_HEADERS_DIST = aes.h asn1.h asn1t.h bio.h \
	blowfish.h bn.h buffer.h camellia.h cast.h chacha.h cmac.h \
	cms.h comp.h conf.h conf_api.h crypto.h ct.h cterr.h \
	curve25519.h des.h dh.h dsa.h dso.h dtls1.h ec.h ecdh.h \
	ecdsa.h engine.h err.h evp.h gost.h hkdf.h hmac.h idea.h \
	lhash.h md4.h md5.h modes.h obj_mac.h objects.h ocsp.h \
	opensslconf.h opensslfeatures.h opensslv.h ossl_typ.h pem.h \
	pem2.h pkcs12.h pkcs7.h poly1305.h rand.h rc2.h rc4.h ripemd.h \
	rsa.h safestack.h sha.h sm3.h sm4.h srtp.h ssl.h ssl2.h \
	ssl23.h ssl3.h stack.h tls1.h ts.h txt_db.h ui.h ui_compat.h \
	whrlpool.h x509.h x509_verify.h x509_vfy.h x509v3.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;







|
|
|
|
|
|
|
|







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
am__can_run_installinfo = \
  case $$AM_UPDATE_INFO_DIR in \
    n|no|NO) false;; \
    *) (install-info --version) >/dev/null 2>&1;; \
  esac
am__opensslinclude_HEADERS_DIST = aes.h asn1.h asn1t.h bio.h \
	blowfish.h bn.h buffer.h camellia.h cast.h chacha.h cmac.h \
	cms.h comp.h conf.h conf_api.h crypto.h ct.h curve25519.h \
	des.h dh.h dsa.h dso.h dtls1.h ec.h ecdh.h ecdsa.h engine.h \
	err.h evp.h gost.h hkdf.h hmac.h idea.h kdf.h lhash.h md4.h \
	md5.h modes.h obj_mac.h objects.h ocsp.h opensslconf.h \
	opensslfeatures.h opensslv.h ossl_typ.h pem.h pem2.h pkcs12.h \
	pkcs7.h poly1305.h rand.h rc2.h rc4.h ripemd.h rsa.h \
	safestack.h sha.h sm3.h sm4.h srtp.h ssl.h ssl2.h ssl23.h \
	ssl3.h stack.h tls1.h ts.h txt_db.h ui.h ui_compat.h \
	whrlpool.h x509.h x509_verify.h x509_vfy.h x509v3.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205


206
207
208
209
210
211
212
213
214
215

216
217
218
219
220
221
222
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







<
<



















>
>










>







178
179
180
181
182
183
184


185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
	-DLIBRESSL_INTERNAL -D__BEGIN_HIDDEN_DECLS= \
	-D__END_HIDDEN_DECLS=
@ENABLE_LIBTLS_ONLY_FALSE@opensslincludedir = $(includedir)/openssl
@ENABLE_LIBTLS_ONLY_FALSE@opensslinclude_HEADERS = aes.h asn1.h \
@ENABLE_LIBTLS_ONLY_FALSE@	asn1t.h bio.h blowfish.h bn.h \
@ENABLE_LIBTLS_ONLY_FALSE@	buffer.h camellia.h cast.h chacha.h \
@ENABLE_LIBTLS_ONLY_FALSE@	cmac.h cms.h comp.h conf.h \
@ENABLE_LIBTLS_ONLY_FALSE@	conf_api.h crypto.h ct.h cterr.h \
@ENABLE_LIBTLS_ONLY_FALSE@	curve25519.h des.h dh.h dsa.h dso.h \
@ENABLE_LIBTLS_ONLY_FALSE@	dtls1.h ec.h ecdh.h ecdsa.h engine.h \
@ENABLE_LIBTLS_ONLY_FALSE@	err.h evp.h gost.h hkdf.h hmac.h \
@ENABLE_LIBTLS_ONLY_FALSE@	idea.h lhash.h md4.h md5.h modes.h \
@ENABLE_LIBTLS_ONLY_FALSE@	obj_mac.h objects.h ocsp.h \
@ENABLE_LIBTLS_ONLY_FALSE@	opensslconf.h opensslfeatures.h \
@ENABLE_LIBTLS_ONLY_FALSE@	opensslv.h ossl_typ.h pem.h pem2.h \
@ENABLE_LIBTLS_ONLY_FALSE@	pkcs12.h pkcs7.h poly1305.h rand.h \
@ENABLE_LIBTLS_ONLY_FALSE@	rc2.h rc4.h ripemd.h rsa.h \
@ENABLE_LIBTLS_ONLY_FALSE@	safestack.h sha.h sm3.h sm4.h srtp.h \
@ENABLE_LIBTLS_ONLY_FALSE@	ssl.h ssl2.h ssl23.h ssl3.h stack.h \
@ENABLE_LIBTLS_ONLY_FALSE@	tls1.h ts.h txt_db.h ui.h \







|



|
|







317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
	-DLIBRESSL_INTERNAL -D__BEGIN_HIDDEN_DECLS= \
	-D__END_HIDDEN_DECLS=
@ENABLE_LIBTLS_ONLY_FALSE@opensslincludedir = $(includedir)/openssl
@ENABLE_LIBTLS_ONLY_FALSE@opensslinclude_HEADERS = aes.h asn1.h \
@ENABLE_LIBTLS_ONLY_FALSE@	asn1t.h bio.h blowfish.h bn.h \
@ENABLE_LIBTLS_ONLY_FALSE@	buffer.h camellia.h cast.h chacha.h \
@ENABLE_LIBTLS_ONLY_FALSE@	cmac.h cms.h comp.h conf.h \
@ENABLE_LIBTLS_ONLY_FALSE@	conf_api.h crypto.h ct.h \
@ENABLE_LIBTLS_ONLY_FALSE@	curve25519.h des.h dh.h dsa.h dso.h \
@ENABLE_LIBTLS_ONLY_FALSE@	dtls1.h ec.h ecdh.h ecdsa.h engine.h \
@ENABLE_LIBTLS_ONLY_FALSE@	err.h evp.h gost.h hkdf.h hmac.h \
@ENABLE_LIBTLS_ONLY_FALSE@	idea.h kdf.h lhash.h md4.h md5.h \
@ENABLE_LIBTLS_ONLY_FALSE@	modes.h obj_mac.h objects.h ocsp.h \
@ENABLE_LIBTLS_ONLY_FALSE@	opensslconf.h opensslfeatures.h \
@ENABLE_LIBTLS_ONLY_FALSE@	opensslv.h ossl_typ.h pem.h pem2.h \
@ENABLE_LIBTLS_ONLY_FALSE@	pkcs12.h pkcs7.h poly1305.h rand.h \
@ENABLE_LIBTLS_ONLY_FALSE@	rc2.h rc4.h ripemd.h rsa.h \
@ENABLE_LIBTLS_ONLY_FALSE@	safestack.h sha.h sm3.h sm4.h srtp.h \
@ENABLE_LIBTLS_ONLY_FALSE@	ssl.h ssl2.h ssl23.h ssl3.h stack.h \
@ENABLE_LIBTLS_ONLY_FALSE@	tls1.h ts.h txt_db.h ui.h \
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







444
445
446
447
448
449
450

451
452
453
454
455
456
457
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
Changes to jni/libressl/include/openssl/asn1.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1.h,v 1.62 2022/01/14 08:53:53 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1.h,v 1.70 2022/09/11 17:22:52 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);

ASN1_OBJECT *ASN1_OBJECT_new(void);
void ASN1_OBJECT_free(ASN1_OBJECT *a);
int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp);
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
    long length);
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
    long length);

extern const ASN1_ITEM ASN1_OBJECT_it;

DECLARE_STACK_OF(ASN1_OBJECT)








<
<







543
544
545
546
547
548
549


550
551
552
553
554
555
556
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);

ASN1_OBJECT *ASN1_OBJECT_new(void);
void ASN1_OBJECT_free(ASN1_OBJECT *a);
int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp);


ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
    long length);

extern const ASN1_ITEM ASN1_OBJECT_it;

DECLARE_STACK_OF(ASN1_OBJECT)

573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);

ASN1_BIT_STRING *ASN1_BIT_STRING_new(void);
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a);
ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len);
int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out);
extern const ASN1_ITEM ASN1_BIT_STRING_it;
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp);
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
    const unsigned char **pp, long length);
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
    const unsigned char *flags, int flags_len);

#ifndef OPENSSL_NO_BIO
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
    BIT_STRING_BITNAME *tbl, int indent);
#endif
int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
    BIT_STRING_BITNAME *tbl);

ASN1_INTEGER *ASN1_INTEGER_new(void);
void ASN1_INTEGER_free(ASN1_INTEGER *a);
ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len);
int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out);
extern const ASN1_ITEM ASN1_INTEGER_it;
int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp);
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
    long length);
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
    long length);
ASN1_INTEGER *	ASN1_INTEGER_dup(const ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);

ASN1_ENUMERATED *ASN1_ENUMERATED_new(void);
void ASN1_ENUMERATED_free(ASN1_ENUMERATED *a);







<
<
<



















<
<
<







571
572
573
574
575
576
577



578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596



597
598
599
600
601
602
603
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);

ASN1_BIT_STRING *ASN1_BIT_STRING_new(void);
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a);
ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len);
int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out);
extern const ASN1_ITEM ASN1_BIT_STRING_it;



int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
    const unsigned char *flags, int flags_len);

#ifndef OPENSSL_NO_BIO
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
    BIT_STRING_BITNAME *tbl, int indent);
#endif
int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
    BIT_STRING_BITNAME *tbl);

ASN1_INTEGER *ASN1_INTEGER_new(void);
void ASN1_INTEGER_free(ASN1_INTEGER *a);
ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len);
int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out);
extern const ASN1_ITEM ASN1_INTEGER_it;



ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
    long length);
ASN1_INTEGER *	ASN1_INTEGER_dup(const ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);

ASN1_ENUMERATED *ASN1_ENUMERATED_new(void);
void ASN1_ENUMERATED_free(ASN1_ENUMERATED *a);
715
716
717
718
719
720
721





722
723
724
725
726
727
728
extern const ASN1_ITEM ASN1_GENERALIZEDTIME_it;
ASN1_TIME *ASN1_TIME_new(void);
void ASN1_TIME_free(ASN1_TIME *a);
ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **a, const unsigned char **in, long len);
int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **out);
extern const ASN1_ITEM ASN1_TIME_it;






int ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from,
    const ASN1_TIME *to);

extern const ASN1_ITEM ASN1_OCTET_STRING_NDEF_it;

ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
ASN1_TIME *ASN1_TIME_set_tm(ASN1_TIME *s, struct tm *tm);







>
>
>
>
>







707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
extern const ASN1_ITEM ASN1_GENERALIZEDTIME_it;
ASN1_TIME *ASN1_TIME_new(void);
void ASN1_TIME_free(ASN1_TIME *a);
ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **a, const unsigned char **in, long len);
int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **out);
extern const ASN1_ITEM ASN1_TIME_it;

int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm);
int ASN1_TIME_compare(const ASN1_TIME *t1, const ASN1_TIME *t2);
int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t2);
int ASN1_TIME_normalize(ASN1_TIME *t);
int ASN1_TIME_set_string_X509(ASN1_TIME *time, const char *str);
int ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from,
    const ASN1_TIME *to);

extern const ASN1_ITEM ASN1_OCTET_STRING_NDEF_it;

ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
ASN1_TIME *ASN1_TIME_set_tm(ASN1_TIME *s, struct tm *tm);
744
745
746
747
748
749
750




751
752
753
754
755


756
757
758
759
760
761
762
#endif
int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);

int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
    const char *sn, const char *ln);





int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
long ASN1_INTEGER_get(const ASN1_INTEGER *a);
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);



int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);
ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);
BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);

/* General */
/* given a string, return the correct type, max is the maximum length */







>
>
>
>





>
>







741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
#endif
int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);

int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
    const char *sn, const char *ln);

int ASN1_INTEGER_get_uint64(uint64_t *out_val, const ASN1_INTEGER *aint);
int ASN1_INTEGER_set_uint64(ASN1_INTEGER *aint, uint64_t val);
int ASN1_INTEGER_get_int64(int64_t *out_val, const ASN1_INTEGER *aint);
int ASN1_INTEGER_set_int64(ASN1_INTEGER *aint, int64_t val);
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
long ASN1_INTEGER_get(const ASN1_INTEGER *a);
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);

int ASN1_ENUMERATED_get_int64(int64_t *out_val, const ASN1_ENUMERATED *aenum);
int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *aenum, int64_t val);
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);
ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);
BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);

/* General */
/* given a string, return the correct type, max is the maximum length */
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
    int ctype_nid, int econt_nid, STACK_OF(X509_ALGOR) *mdalgs,
    const ASN1_ITEM *it);
ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
int SMIME_text(BIO *in, BIO *out);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_ASN1_strings(void);

/* Error codes for the ASN1 functions. */

/* Function codes. */
#define ASN1_F_A2D_ASN1_OBJECT				 100
#define ASN1_F_A2I_ASN1_ENUMERATED			 101







<
<
<
<







935
936
937
938
939
940
941




942
943
944
945
946
947
948
int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
    int ctype_nid, int econt_nid, STACK_OF(X509_ALGOR) *mdalgs,
    const ASN1_ITEM *it);
ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
int SMIME_text(BIO *in, BIO *out);





void ERR_load_ASN1_strings(void);

/* Error codes for the ASN1 functions. */

/* Function codes. */
#define ASN1_F_A2D_ASN1_OBJECT				 100
#define ASN1_F_A2I_ASN1_ENUMERATED			 101
1105
1106
1107
1108
1109
1110
1111

1112
1113
1114
1115
1116
1117
1118
#define ASN1_R_ILLEGAL_BITSTRING_FORMAT			 175
#define ASN1_R_ILLEGAL_BOOLEAN				 176
#define ASN1_R_ILLEGAL_CHARACTERS			 124
#define ASN1_R_ILLEGAL_FORMAT				 177
#define ASN1_R_ILLEGAL_HEX				 178
#define ASN1_R_ILLEGAL_IMPLICIT_TAG			 179
#define ASN1_R_ILLEGAL_INTEGER				 180

#define ASN1_R_ILLEGAL_NESTED_TAGGING			 181
#define ASN1_R_ILLEGAL_NULL				 125
#define ASN1_R_ILLEGAL_NULL_VALUE			 182
#define ASN1_R_ILLEGAL_OBJECT				 183
#define ASN1_R_ILLEGAL_OPTIONAL_ANY			 126
#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE		 170
#define ASN1_R_ILLEGAL_TAGGED_ANY			 127







>







1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
#define ASN1_R_ILLEGAL_BITSTRING_FORMAT			 175
#define ASN1_R_ILLEGAL_BOOLEAN				 176
#define ASN1_R_ILLEGAL_CHARACTERS			 124
#define ASN1_R_ILLEGAL_FORMAT				 177
#define ASN1_R_ILLEGAL_HEX				 178
#define ASN1_R_ILLEGAL_IMPLICIT_TAG			 179
#define ASN1_R_ILLEGAL_INTEGER				 180
#define ASN1_R_ILLEGAL_NEGATIVE_VALUE			 226
#define ASN1_R_ILLEGAL_NESTED_TAGGING			 181
#define ASN1_R_ILLEGAL_NULL				 125
#define ASN1_R_ILLEGAL_NULL_VALUE			 182
#define ASN1_R_ILLEGAL_OBJECT				 183
#define ASN1_R_ILLEGAL_OPTIONAL_ANY			 126
#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE		 170
#define ASN1_R_ILLEGAL_TAGGED_ANY			 127
1164
1165
1166
1167
1168
1169
1170

1171

1172

1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188

1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
#define ASN1_R_SIG_INVALID_MIME_TYPE			 213
#define ASN1_R_STREAMING_NOT_SUPPORTED			 202
#define ASN1_R_STRING_TOO_LONG				 151
#define ASN1_R_STRING_TOO_SHORT				 152
#define ASN1_R_TAG_VALUE_TOO_HIGH			 153
#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
#define ASN1_R_TIME_NOT_ASCII_FORMAT			 193

#define ASN1_R_TOO_LONG					 155

#define ASN1_R_TYPE_NOT_CONSTRUCTED			 156

#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY			 157
#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY		 158
#define ASN1_R_UNEXPECTED_EOC				 159
#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH		 215
#define ASN1_R_UNKNOWN_FORMAT				 160
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM		 161
#define ASN1_R_UNKNOWN_OBJECT_TYPE			 162
#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE			 163
#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM		 199
#define ASN1_R_UNKNOWN_TAG				 194
#define ASN1_R_UNKOWN_FORMAT				 195
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE		 164
#define ASN1_R_UNSUPPORTED_CIPHER			 165
#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM		 166
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE		 167
#define ASN1_R_UNSUPPORTED_TYPE				 196

#define ASN1_R_WRONG_PUBLIC_KEY_TYPE			 200
#define ASN1_R_WRONG_TAG				 168
#define ASN1_R_WRONG_TYPE				 169


int ASN1_time_parse(const char *_bytes, size_t _len, struct tm *_tm, int _mode);
int ASN1_time_tm_cmp(struct tm *_tm1, struct tm *_tm2);
#ifdef  __cplusplus
}
#endif
#endif







>

>

>
















>



<







1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195

1196
1197
1198
1199
1200
1201
1202
#define ASN1_R_SIG_INVALID_MIME_TYPE			 213
#define ASN1_R_STREAMING_NOT_SUPPORTED			 202
#define ASN1_R_STRING_TOO_LONG				 151
#define ASN1_R_STRING_TOO_SHORT				 152
#define ASN1_R_TAG_VALUE_TOO_HIGH			 153
#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
#define ASN1_R_TIME_NOT_ASCII_FORMAT			 193
#define ASN1_R_TOO_LARGE				 223
#define ASN1_R_TOO_LONG					 155
#define ASN1_R_TOO_SMALL				 224
#define ASN1_R_TYPE_NOT_CONSTRUCTED			 156
#define ASN1_R_TYPE_NOT_PRIMITIVE			 231
#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY			 157
#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY		 158
#define ASN1_R_UNEXPECTED_EOC				 159
#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH		 215
#define ASN1_R_UNKNOWN_FORMAT				 160
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM		 161
#define ASN1_R_UNKNOWN_OBJECT_TYPE			 162
#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE			 163
#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM		 199
#define ASN1_R_UNKNOWN_TAG				 194
#define ASN1_R_UNKOWN_FORMAT				 195
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE		 164
#define ASN1_R_UNSUPPORTED_CIPHER			 165
#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM		 166
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE		 167
#define ASN1_R_UNSUPPORTED_TYPE				 196
#define ASN1_R_WRONG_INTEGER_TYPE			 225
#define ASN1_R_WRONG_PUBLIC_KEY_TYPE			 200
#define ASN1_R_WRONG_TAG				 168
#define ASN1_R_WRONG_TYPE				 169


int ASN1_time_parse(const char *_bytes, size_t _len, struct tm *_tm, int _mode);
int ASN1_time_tm_cmp(struct tm *_tm1, struct tm *_tm2);
#ifdef  __cplusplus
}
#endif
#endif
Changes to jni/libressl/include/openssl/asn1t.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1t.h,v 1.19 2022/01/14 08:43:06 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1t.h,v 1.22 2022/09/03 16:01:23 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
	ASN1_SEQUENCE_cb(tname, cb)

#define ASN1_SEQUENCE_cb(tname, cb) \
	static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
	ASN1_SEQUENCE(tname)

#define ASN1_BROKEN_SEQUENCE(tname) \
	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
	ASN1_SEQUENCE(tname)

#define ASN1_SEQUENCE_ref(tname, cb, lck) \
	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
	ASN1_SEQUENCE(tname)

#define ASN1_SEQUENCE_enc(tname, enc, cb) \
	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
	ASN1_SEQUENCE(tname)







<
<
<
<







179
180
181
182
183
184
185




186
187
188
189
190
191
192
#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
	ASN1_SEQUENCE_cb(tname, cb)

#define ASN1_SEQUENCE_cb(tname, cb) \
	static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
	ASN1_SEQUENCE(tname)





#define ASN1_SEQUENCE_ref(tname, cb, lck) \
	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
	ASN1_SEQUENCE(tname)

#define ASN1_SEQUENCE_enc(tname, enc, cb) \
	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
	ASN1_SEQUENCE(tname)
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
		tname##_seq_tt,\
		sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
		NULL,\
		sizeof(tname),\
		#tname \
	ASN1_ITEM_end(tname)

#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)

#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)

#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)

#define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)

#define ASN1_SEQUENCE_END_ref(stname, tname) \







<
<







211
212
213
214
215
216
217


218
219
220
221
222
223
224
		tname##_seq_tt,\
		sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
		NULL,\
		sizeof(tname),\
		#tname \
	ASN1_ITEM_end(tname)



#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)

#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)

#define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)

#define ASN1_SEQUENCE_END_ref(stname, tname) \
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366

/* used to declare other types */

#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
	(flags), (tag), offsetof(stname, field),\
	#field, ASN1_ITEM_ref(type) }

/* used when the structure is combined with the parent */

#define ASN1_EX_COMBINE(flags, tag, type) { \
	(flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }

/* implicit and explicit helper macros */

#define ASN1_IMP_EX(stname, field, type, tag, ex) \
		ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)

#define ASN1_EXP_EX(stname, field, type, tag, ex) \
		ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)







<
<
<
<
<







342
343
344
345
346
347
348





349
350
351
352
353
354
355

/* used to declare other types */

#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
	(flags), (tag), offsetof(stname, field),\
	#field, ASN1_ITEM_ref(type) }






/* implicit and explicit helper macros */

#define ASN1_IMP_EX(stname, field, type, tag, ex) \
		ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)

#define ASN1_EXP_EX(stname, field, type, tag, ex) \
		ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589

#define ASN1_TFLG_ADB_MASK	(0x3<<8)

#define ASN1_TFLG_ADB_OID	(0x1<<8)

#define ASN1_TFLG_ADB_INT	(0x1<<9)

/*
 * This flag means a parent structure is passed
 * instead of the field: this is useful is a
 * SEQUENCE is being combined with a CHOICE for
 * example. Since this means the structure and
 * item name will differ we need to use the
 * ASN1_CHOICE_END_name() macro for example.
 */

#define ASN1_TFLG_COMBINE	(0x1<<10)

/*
 * This flag when present in a SEQUENCE OF, SET OF
 * or EXPLICIT causes indefinite length constructed
 * encoding to be used if required.
 */

#define ASN1_TFLG_NDEF		(0x1<<11)







<
<
<
<
<
<
<
<
<
<
<







554
555
556
557
558
559
560











561
562
563
564
565
566
567

#define ASN1_TFLG_ADB_MASK	(0x3<<8)

#define ASN1_TFLG_ADB_OID	(0x1<<8)

#define ASN1_TFLG_ADB_INT	(0x1<<9)












/*
 * This flag when present in a SEQUENCE OF, SET OF
 * or EXPLICIT causes indefinite length constructed
 * encoding to be used if required.
 */

#define ASN1_TFLG_NDEF		(0x1<<11)
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772

/* Flags in ASN1_AUX */

/* Use a reference count */
#define ASN1_AFLG_REFCOUNT	1
/* Save the encoding of structure (useful for signatures) */
#define ASN1_AFLG_ENCODING	2
/* The Sequence length is invalid */
#define ASN1_AFLG_BROKEN	4

/* operation values for asn1_cb */

#define ASN1_OP_NEW_PRE		0
#define ASN1_OP_NEW_POST	1
#define ASN1_OP_FREE_PRE	2
#define ASN1_OP_FREE_POST	3







<
<







735
736
737
738
739
740
741


742
743
744
745
746
747
748

/* Flags in ASN1_AUX */

/* Use a reference count */
#define ASN1_AFLG_REFCOUNT	1
/* Save the encoding of structure (useful for signatures) */
#define ASN1_AFLG_ENCODING	2



/* operation values for asn1_cb */

#define ASN1_OP_NEW_PRE		0
#define ASN1_OP_NEW_POST	1
#define ASN1_OP_FREE_PRE	2
#define ASN1_OP_FREE_POST	3
902
903
904
905
906
907
908
909
910
911
912




913
914
915
916
917
918
919

/* external definitions for primitive types */

extern const ASN1_ITEM ASN1_BOOLEAN_it;
extern const ASN1_ITEM ASN1_TBOOLEAN_it;
extern const ASN1_ITEM ASN1_FBOOLEAN_it;
extern const ASN1_ITEM ASN1_SEQUENCE_it;
extern const ASN1_ITEM CBIGNUM_it;
extern const ASN1_ITEM BIGNUM_it;
extern const ASN1_ITEM LONG_it;
extern const ASN1_ITEM ZLONG_it;





DECLARE_STACK_OF(ASN1_VALUE)

/* Functions used internally by the ASN1 code */

int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);







<



>
>
>
>







878
879
880
881
882
883
884

885
886
887
888
889
890
891
892
893
894
895
896
897
898

/* external definitions for primitive types */

extern const ASN1_ITEM ASN1_BOOLEAN_it;
extern const ASN1_ITEM ASN1_TBOOLEAN_it;
extern const ASN1_ITEM ASN1_FBOOLEAN_it;
extern const ASN1_ITEM ASN1_SEQUENCE_it;

extern const ASN1_ITEM BIGNUM_it;
extern const ASN1_ITEM LONG_it;
extern const ASN1_ITEM ZLONG_it;

#ifndef LIBRESSL_INTERNAL
extern const ASN1_ITEM CBIGNUM_it;
#endif

DECLARE_STACK_OF(ASN1_VALUE)

/* Functions used internally by the ASN1 code */

int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
Changes to jni/libressl/include/openssl/bio.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: bio.h,v 1.54 2022/01/14 08:40:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bio.h,v 1.56 2022/09/11 17:26:03 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
272
273
274
275
276
277
278
279
280


281
282
283
284
285
286
287

char *BIO_get_callback_arg(const BIO *b);
void BIO_set_callback_arg(BIO *b, char *arg);

const char *BIO_method_name(const BIO *b);
int BIO_method_type(const BIO *b);

typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
typedef int BIO_info_cb(BIO *, int, int);



typedef struct bio_method_st BIO_METHOD;

DECLARE_STACK_OF(BIO)

/* Prefix and suffix callback in ASN1 BIO */
typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg);







<

>
>







272
273
274
275
276
277
278

279
280
281
282
283
284
285
286
287
288

char *BIO_get_callback_arg(const BIO *b);
void BIO_set_callback_arg(BIO *b, char *arg);

const char *BIO_method_name(const BIO *b);
int BIO_method_type(const BIO *b);


typedef int BIO_info_cb(BIO *, int, int);
/* Compatibility with OpenSSL's backward compatibility. */
typedef BIO_info_cb bio_info_cb;

typedef struct bio_method_st BIO_METHOD;

DECLARE_STACK_OF(BIO)

/* Prefix and suffix callback in ASN1 BIO */
typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg);
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
	    __nonnull__(3)));
int
BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
	__attribute__((__deprecated__, __format__(__printf__, 3, 0),
	    __nonnull__(3)));
#endif


/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_BIO_strings(void);

/* Error codes for the BIO functions. */

/* Function codes. */
#define BIO_F_ACPT_STATE				 100
#define BIO_F_BIO_ACCEPT				 101







<
<
<
<
<







695
696
697
698
699
700
701





702
703
704
705
706
707
708
	    __nonnull__(3)));
int
BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
	__attribute__((__deprecated__, __format__(__printf__, 3, 0),
	    __nonnull__(3)));
#endif






void ERR_load_BIO_strings(void);

/* Error codes for the BIO functions. */

/* Function codes. */
#define BIO_F_ACPT_STATE				 100
#define BIO_F_BIO_ACCEPT				 101
Changes to jni/libressl/include/openssl/bn.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: bn.h,v 1.52 2022/01/14 08:01:47 tb Exp $ */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: bn.h,v 1.55 2022/07/12 14:42:48 kn Exp $ */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
467
468
469
470
471
472
473


474
475
476
477
478
479
480
    const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
#endif
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
    const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);

void	BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);



/* Deprecated versions */
#ifndef OPENSSL_NO_DEPRECATED
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
    const BIGNUM *add, const BIGNUM *rem,
    void (*callback)(int, int, void *), void *cb_arg);
int	BN_is_prime(const BIGNUM *p, int nchecks,
    void (*callback)(int, int, void *),







>
>







467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
    const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
#endif
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
    const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);

void	BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);

int	BN_security_bits(int L, int N);

/* Deprecated versions */
#ifndef OPENSSL_NO_DEPRECATED
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
    const BIGNUM *add, const BIGNUM *rem,
    void (*callback)(int, int, void *), void *cb_arg);
int	BN_is_prime(const BIGNUM *p, int nchecks,
    void (*callback)(int, int, void *),
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_BN_strings(void);

/* Error codes for the BN functions. */

/* Function codes. */
#define BN_F_BNRAND					 127
#define BN_F_BN_BLINDING_CONVERT_EX			 100







<
<
<
<







649
650
651
652
653
654
655




656
657
658
659
660
661
662
BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);





void ERR_load_BN_strings(void);

/* Error codes for the BN functions. */

/* Function codes. */
#define BN_F_BNRAND					 127
#define BN_F_BN_BLINDING_CONVERT_EX			 100
Changes to jni/libressl/include/openssl/buffer.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: buffer.h,v 1.15 2015/06/24 10:05:14 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: buffer.h,v 1.16 2022/07/12 14:42:48 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* safe string functions */
size_t BUF_strlcpy(char *dst, const char *src, size_t siz)
	__attribute__ ((__bounded__(__string__,1,3)));
size_t BUF_strlcat(char *dst, const char *src, size_t siz)
	__attribute__ ((__bounded__(__string__,1,3)));
#endif

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_BUF_strings(void);

/* Error codes for the BUF functions. */

/* Function codes. */
#define BUF_F_BUF_MEMDUP				 103
#define BUF_F_BUF_MEM_GROW				 100







<
<
<
<







94
95
96
97
98
99
100




101
102
103
104
105
106
107
/* safe string functions */
size_t BUF_strlcpy(char *dst, const char *src, size_t siz)
	__attribute__ ((__bounded__(__string__,1,3)));
size_t BUF_strlcat(char *dst, const char *src, size_t siz)
	__attribute__ ((__bounded__(__string__,1,3)));
#endif





void ERR_load_BUF_strings(void);

/* Error codes for the BUF functions. */

/* Function codes. */
#define BUF_F_BUF_MEMDUP				 103
#define BUF_F_BUF_MEM_GROW				 100
Changes to jni/libressl/include/openssl/conf.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: conf.h,v 1.15 2020/02/17 12:51:48 inoguchi Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: conf.h,v 1.16 2022/07/12 14:42:48 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
char *CONF_get1_default_config_file(void);

int CONF_parse_list(const char *list, int sep, int nospc,
    int (*list_cb)(const char *elem, int len, void *usr), void *arg);

void OPENSSL_load_builtin_modules(void);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_CONF_strings(void);

/* Error codes for the CONF functions. */

/* Function codes. */
#define CONF_F_CONF_DUMP_FP				 104
#define CONF_F_CONF_LOAD				 100







<
<
<
<







189
190
191
192
193
194
195




196
197
198
199
200
201
202
char *CONF_get1_default_config_file(void);

int CONF_parse_list(const char *list, int sep, int nospc,
    int (*list_cb)(const char *elem, int len, void *usr), void *arg);

void OPENSSL_load_builtin_modules(void);





void ERR_load_CONF_strings(void);

/* Error codes for the CONF functions. */

/* Function codes. */
#define CONF_F_CONF_DUMP_FP				 104
#define CONF_F_CONF_LOAD				 100
Changes to jni/libressl/include/openssl/crypto.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: crypto.h,v 1.54 2022/01/14 08:23:25 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: crypto.h,v 1.57 2022/09/11 17:26:51 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
 * takes an amount of time dependent on |len|, but independent of the contents
 * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
 * defined order as the return value when a != b is undefined, other than to be
 * non-zero. */
int CRYPTO_memcmp(const void *a, const void *b, size_t len);
#endif

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_CRYPTO_strings(void);

/* Error codes for the CRYPTO functions. */

/* Function codes. */
#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX		 100
#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID		 103







<
<
<
<







505
506
507
508
509
510
511




512
513
514
515
516
517
518
 * takes an amount of time dependent on |len|, but independent of the contents
 * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
 * defined order as the return value when a != b is undefined, other than to be
 * non-zero. */
int CRYPTO_memcmp(const void *a, const void *b, size_t len);
#endif





void ERR_load_CRYPTO_strings(void);

/* Error codes for the CRYPTO functions. */

/* Function codes. */
#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX		 100
#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID		 103
562
563
564
565
566
567
568

569
570
571
572
573
#define OPENSSL_INIT_ENGINE_PADLOCK		_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_ENGINE_AFALG		_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_reserved_internal		_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_ATFORK			_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_ENGINE_ALL_BUILTIN		_OPENSSL_INIT_FLAG_NOOP

int OPENSSL_init_crypto(uint64_t opts, const void *settings);


#ifdef  __cplusplus
}
#endif
#endif







>





558
559
560
561
562
563
564
565
566
567
568
569
570
#define OPENSSL_INIT_ENGINE_PADLOCK		_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_ENGINE_AFALG		_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_reserved_internal		_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_ATFORK			_OPENSSL_INIT_FLAG_NOOP
#define OPENSSL_INIT_ENGINE_ALL_BUILTIN		_OPENSSL_INIT_FLAG_NOOP

int OPENSSL_init_crypto(uint64_t opts, const void *settings);
void OPENSSL_cleanup(void);

#ifdef  __cplusplus
}
#endif
#endif
Changes to jni/libressl/include/openssl/ct.h.
1
2
3
4
5
6
7
8
/*	$OpenBSD: ct.h,v 1.6 2021/12/18 16:50:40 tb Exp $ */
/*
 * Public API for Certificate Transparency (CT).
 * Written by Rob Percival (robpercival@google.com) for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 2016 The OpenSSL Project.  All rights reserved.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: ct.h,v 1.7 2022/05/08 20:59:32 tb Exp $ */
/*
 * Public API for Certificate Transparency (CT).
 * Written by Rob Percival (robpercival@google.com) for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 2016 The OpenSSL Project.  All rights reserved.
 *
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_CT
#include <openssl/ossl_typ.h>
#include <openssl/safestack.h>
#include <openssl/x509.h>
#include <openssl/cterr.h>
#ifdef __cplusplus
extern "C" {
#endif

/* Minimum RSA key size, from RFC6962 */
#define SCT_MIN_RSA_BITS 2048








<







57
58
59
60
61
62
63

64
65
66
67
68
69
70

#include <openssl/opensslconf.h>

#ifndef OPENSSL_NO_CT
#include <openssl/ossl_typ.h>
#include <openssl/safestack.h>
#include <openssl/x509.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Minimum RSA key size, from RFC6962 */
#define SCT_MIN_RSA_BITS 2048

503
504
505
506
507
508
509






















































510
511
512
513
514

/*
 * Loads the default CT log list into a |store|.
 * Returns 1 if loading is successful, or 0 otherwise.
 */
int CTLOG_STORE_load_default_file(CTLOG_STORE *store);























































#ifdef __cplusplus
}
#endif
#endif
#endif







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567

/*
 * Loads the default CT log list into a |store|.
 * Returns 1 if loading is successful, or 0 otherwise.
 */
int CTLOG_STORE_load_default_file(CTLOG_STORE *store);

int ERR_load_CT_strings(void);

/*
 * CT function codes.
 */
#  define CT_F_CTLOG_NEW                                   117
#  define CT_F_CTLOG_NEW_FROM_BASE64                       118
#  define CT_F_CTLOG_NEW_FROM_CONF                         119
#  define CT_F_CTLOG_STORE_LOAD_CTX_NEW                    122
#  define CT_F_CTLOG_STORE_LOAD_FILE                       123
#  define CT_F_CTLOG_STORE_LOAD_LOG                        130
#  define CT_F_CTLOG_STORE_NEW                             131
#  define CT_F_CT_BASE64_DECODE                            124
#  define CT_F_CT_POLICY_EVAL_CTX_NEW                      133
#  define CT_F_CT_V1_LOG_ID_FROM_PKEY                      125
#  define CT_F_I2O_SCT                                     107
#  define CT_F_I2O_SCT_LIST                                108
#  define CT_F_I2O_SCT_SIGNATURE                           109
#  define CT_F_O2I_SCT                                     110
#  define CT_F_O2I_SCT_LIST                                111
#  define CT_F_O2I_SCT_SIGNATURE                           112
#  define CT_F_SCT_CTX_NEW                                 126
#  define CT_F_SCT_CTX_VERIFY                              128
#  define CT_F_SCT_NEW                                     100
#  define CT_F_SCT_NEW_FROM_BASE64                         127
#  define CT_F_SCT_SET0_LOG_ID                             101
#  define CT_F_SCT_SET1_EXTENSIONS                         114
#  define CT_F_SCT_SET1_LOG_ID                             115
#  define CT_F_SCT_SET1_SIGNATURE                          116
#  define CT_F_SCT_SET_LOG_ENTRY_TYPE                      102
#  define CT_F_SCT_SET_SIGNATURE_NID                       103
#  define CT_F_SCT_SET_VERSION                             104

/*
 * CT reason codes.
 */
#  define CT_R_BASE64_DECODE_ERROR                         108
#  define CT_R_INVALID_LOG_ID_LENGTH                       100
#  define CT_R_LOG_CONF_INVALID                            109
#  define CT_R_LOG_CONF_INVALID_KEY                        110
#  define CT_R_LOG_CONF_MISSING_DESCRIPTION                111
#  define CT_R_LOG_CONF_MISSING_KEY                        112
#  define CT_R_LOG_KEY_INVALID                             113
#  define CT_R_SCT_FUTURE_TIMESTAMP                        116
#  define CT_R_SCT_INVALID                                 104
#  define CT_R_SCT_INVALID_SIGNATURE                       107
#  define CT_R_SCT_LIST_INVALID                            105
#  define CT_R_SCT_LOG_ID_MISMATCH                         114
#  define CT_R_SCT_NOT_SET                                 106
#  define CT_R_SCT_UNSUPPORTED_VERSION                     115
#  define CT_R_UNRECOGNIZED_SIGNATURE_NID                  101
#  define CT_R_UNSUPPORTED_ENTRY_TYPE                      102
#  define CT_R_UNSUPPORTED_VERSION                         103

#ifdef __cplusplus
}
#endif
#endif
#endif
Deleted jni/libressl/include/openssl/cterr.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*	$OpenBSD: cterr.h,v 1.5 2021/12/18 16:50:40 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    openssl-core@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#ifndef HEADER_CTERR_H
# define HEADER_CTERR_H

# include <openssl/opensslconf.h>

# ifndef OPENSSL_NO_CT

#ifdef  __cplusplus
extern "C"
#endif

int ERR_load_CT_strings(void);

/*
 * CT function codes.
 */
#  define CT_F_CTLOG_NEW                                   117
#  define CT_F_CTLOG_NEW_FROM_BASE64                       118
#  define CT_F_CTLOG_NEW_FROM_CONF                         119
#  define CT_F_CTLOG_STORE_LOAD_CTX_NEW                    122
#  define CT_F_CTLOG_STORE_LOAD_FILE                       123
#  define CT_F_CTLOG_STORE_LOAD_LOG                        130
#  define CT_F_CTLOG_STORE_NEW                             131
#  define CT_F_CT_BASE64_DECODE                            124
#  define CT_F_CT_POLICY_EVAL_CTX_NEW                      133
#  define CT_F_CT_V1_LOG_ID_FROM_PKEY                      125
#  define CT_F_I2O_SCT                                     107
#  define CT_F_I2O_SCT_LIST                                108
#  define CT_F_I2O_SCT_SIGNATURE                           109
#  define CT_F_O2I_SCT                                     110
#  define CT_F_O2I_SCT_LIST                                111
#  define CT_F_O2I_SCT_SIGNATURE                           112
#  define CT_F_SCT_CTX_NEW                                 126
#  define CT_F_SCT_CTX_VERIFY                              128
#  define CT_F_SCT_NEW                                     100
#  define CT_F_SCT_NEW_FROM_BASE64                         127
#  define CT_F_SCT_SET0_LOG_ID                             101
#  define CT_F_SCT_SET1_EXTENSIONS                         114
#  define CT_F_SCT_SET1_LOG_ID                             115
#  define CT_F_SCT_SET1_SIGNATURE                          116
#  define CT_F_SCT_SET_LOG_ENTRY_TYPE                      102
#  define CT_F_SCT_SET_SIGNATURE_NID                       103
#  define CT_F_SCT_SET_VERSION                             104

/*
 * CT reason codes.
 */
#  define CT_R_BASE64_DECODE_ERROR                         108
#  define CT_R_INVALID_LOG_ID_LENGTH                       100
#  define CT_R_LOG_CONF_INVALID                            109
#  define CT_R_LOG_CONF_INVALID_KEY                        110
#  define CT_R_LOG_CONF_MISSING_DESCRIPTION                111
#  define CT_R_LOG_CONF_MISSING_KEY                        112
#  define CT_R_LOG_KEY_INVALID                             113
#  define CT_R_SCT_FUTURE_TIMESTAMP                        116
#  define CT_R_SCT_INVALID                                 104
#  define CT_R_SCT_INVALID_SIGNATURE                       107
#  define CT_R_SCT_LIST_INVALID                            105
#  define CT_R_SCT_LOG_ID_MISMATCH                         114
#  define CT_R_SCT_NOT_SET                                 106
#  define CT_R_SCT_UNSUPPORTED_VERSION                     115
#  define CT_R_UNRECOGNIZED_SIGNATURE_NID                  101
#  define CT_R_UNSUPPORTED_ENTRY_TYPE                      102
#  define CT_R_UNSUPPORTED_VERSION                         103

# endif
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































Changes to jni/libressl/include/openssl/dh.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: dh.h,v 1.32 2022/01/14 08:25:44 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dh.h,v 1.35 2022/07/12 14:42:49 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
139
140
141
142
143
144
145

146
147
148
149
150
151
152
int	DH_up_ref(DH *dh);
int	DH_size(const DH *dh);
int	DH_bits(const DH *dh);
int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
	     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int DH_set_ex_data(DH *d, int idx, void *arg);
void *DH_get_ex_data(DH *d, int idx);


ENGINE *DH_get0_engine(DH *d);
void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
    const BIGNUM **g);
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);







>







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
int	DH_up_ref(DH *dh);
int	DH_size(const DH *dh);
int	DH_bits(const DH *dh);
int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
	     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int DH_set_ex_data(DH *d, int idx, void *arg);
void *DH_get_ex_data(DH *d, int idx);
int DH_security_bits(const DH *dh);

ENGINE *DH_get0_engine(DH *d);
void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
    const BIGNUM **g);
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
	EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
			EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)

#define	EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN	(EVP_PKEY_ALG_CTRL + 1)
#define	EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR	(EVP_PKEY_ALG_CTRL + 2)


/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_DH_strings(void);

/* Error codes for the DH functions. */

/* Function codes. */
#define DH_F_COMPUTE_KEY				 102
#define DH_F_DHPARAMS_PRINT_FP				 101







<
<
<
<







192
193
194
195
196
197
198




199
200
201
202
203
204
205
	EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
			EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)

#define	EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN	(EVP_PKEY_ALG_CTRL + 1)
#define	EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR	(EVP_PKEY_ALG_CTRL + 2)






void ERR_load_DH_strings(void);

/* Error codes for the DH functions. */

/* Function codes. */
#define DH_F_COMPUTE_KEY				 102
#define DH_F_DHPARAMS_PRINT_FP				 101
Changes to jni/libressl/include/openssl/dsa.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: dsa.h,v 1.35 2022/01/14 08:27:23 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dsa.h,v 1.39 2022/07/12 14:42:49 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
147
148
149
150
151
152
153

154
155
156
157
158
159
160
		unsigned char *sig, unsigned int *siglen, DSA *dsa);
int	DSA_verify(int type,const unsigned char *dgst,int dgst_len,
		const unsigned char *sigbuf, int siglen, DSA *dsa);
int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
	     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int DSA_set_ex_data(DSA *d, int idx, void *arg);
void *DSA_get_ex_data(DSA *d, int idx);


DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
extern const ASN1_ITEM DSAPublicKey_it;

DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);







>







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
		unsigned char *sig, unsigned int *siglen, DSA *dsa);
int	DSA_verify(int type,const unsigned char *dgst,int dgst_len,
		const unsigned char *sigbuf, int siglen, DSA *dsa);
int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
	     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int DSA_set_ex_data(DSA *d, int idx, void *arg);
void *DSA_get_ex_data(DSA *d, int idx);
int DSA_security_bits(const DSA *d);

DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
extern const ASN1_ITEM DSAPublicKey_it;

DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
215
216
217
218
219
220
221


222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
int DSA_test_flags(const DSA *d, int flags);
void DSA_set_flags(DSA *d, int flags);
ENGINE *DSA_get0_engine(DSA *d);

DSA_METHOD *DSA_meth_new(const char *name, int flags);
void DSA_meth_free(DSA_METHOD *meth);
DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);


int DSA_meth_set_sign(DSA_METHOD *meth,
    DSA_SIG *(*sign)(const unsigned char *, int, DSA *));
int DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *));

#define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \
	EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
				EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL)

#define	EVP_PKEY_CTRL_DSA_PARAMGEN_BITS		(EVP_PKEY_ALG_CTRL + 1)
#define	EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS	(EVP_PKEY_ALG_CTRL + 2)
#define	EVP_PKEY_CTRL_DSA_PARAMGEN_MD		(EVP_PKEY_ALG_CTRL + 3)

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_DSA_strings(void);

/* Error codes for the DSA functions. */

/* Function codes. */
#define DSA_F_D2I_DSA_SIG				 110
#define DSA_F_DO_DSA_PRINT				 104







>
>












<
<
<
<







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236




237
238
239
240
241
242
243
int DSA_test_flags(const DSA *d, int flags);
void DSA_set_flags(DSA *d, int flags);
ENGINE *DSA_get0_engine(DSA *d);

DSA_METHOD *DSA_meth_new(const char *name, int flags);
void DSA_meth_free(DSA_METHOD *meth);
DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);
const char *DSA_meth_get0_name(const DSA_METHOD *meth);
int DSA_meth_set1_name(DSA_METHOD *meth, const char *name);
int DSA_meth_set_sign(DSA_METHOD *meth,
    DSA_SIG *(*sign)(const unsigned char *, int, DSA *));
int DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *));

#define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \
	EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
				EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL)

#define	EVP_PKEY_CTRL_DSA_PARAMGEN_BITS		(EVP_PKEY_ALG_CTRL + 1)
#define	EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS	(EVP_PKEY_ALG_CTRL + 2)
#define	EVP_PKEY_CTRL_DSA_PARAMGEN_MD		(EVP_PKEY_ALG_CTRL + 3)





void ERR_load_DSA_strings(void);

/* Error codes for the DSA functions. */

/* Function codes. */
#define DSA_F_D2I_DSA_SIG				 110
#define DSA_F_DO_DSA_PRINT				 104
Changes to jni/libressl/include/openssl/dso.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: dso.h,v 1.12 2016/03/15 20:50:22 krw Exp $ */
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: dso.h,v 1.13 2022/07/12 14:42:49 kn Exp $ */
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
 * consequences. Primary usage for this function is to probe *core*
 * system functionality, e.g. check if getnameinfo(3) is available
 * at run-time without bothering about OS-specific details such as
 * libc.so.versioning or where does it actually reside: in libc
 * itself or libsocket. */
void *DSO_global_lookup(const char *name);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_DSO_strings(void);

/* Error codes for the DSO functions. */

/* Function codes. */
#define DSO_F_BEOS_BIND_FUNC				 144
#define DSO_F_BEOS_BIND_VAR				 145







<
<
<
<







298
299
300
301
302
303
304




305
306
307
308
309
310
311
 * consequences. Primary usage for this function is to probe *core*
 * system functionality, e.g. check if getnameinfo(3) is available
 * at run-time without bothering about OS-specific details such as
 * libc.so.versioning or where does it actually reside: in libc
 * itself or libsocket. */
void *DSO_global_lookup(const char *name);





void ERR_load_DSO_strings(void);

/* Error codes for the DSO functions. */

/* Function codes. */
#define DSO_F_BEOS_BIND_FUNC				 144
#define DSO_F_BEOS_BIND_VAR				 145
Changes to jni/libressl/include/openssl/ec.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ec.h,v 1.27 2021/09/12 16:23:19 tb Exp $ */
/*
 * Originally written by Bodo Moeller for the OpenSSL project.
 */
/**
 * \file crypto/ec/ec.h Include file for the OpenSSL EC functions
 * \author Originally written by Bodo Moeller for the OpenSSL project
 */
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ec.h,v 1.28 2022/07/12 14:42:49 kn Exp $ */
/*
 * Originally written by Bodo Moeller for the OpenSSL project.
 */
/**
 * \file crypto/ec/ec.h Include file for the OpenSSL EC functions
 * \author Originally written by Bodo Moeller for the OpenSSL project
 */
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
#define EVP_PKEY_CTRL_GET1_ID				(EVP_PKEY_ALG_CTRL + 12)
#define EVP_PKEY_CTRL_GET1_ID_LEN			(EVP_PKEY_ALG_CTRL + 13)

/* KDF types */
#define EVP_PKEY_ECDH_KDF_NONE				1
#define EVP_PKEY_ECDH_KDF_X9_63				2

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_EC_strings(void);

/* Error codes for the EC functions. */

/* Function codes. */
#define EC_F_BN_TO_FELEM				 224
#define EC_F_COMPUTE_WNAF				 143







<
<
<
<







1112
1113
1114
1115
1116
1117
1118




1119
1120
1121
1122
1123
1124
1125
#define EVP_PKEY_CTRL_GET1_ID				(EVP_PKEY_ALG_CTRL + 12)
#define EVP_PKEY_CTRL_GET1_ID_LEN			(EVP_PKEY_ALG_CTRL + 13)

/* KDF types */
#define EVP_PKEY_ECDH_KDF_NONE				1
#define EVP_PKEY_ECDH_KDF_X9_63				2





void ERR_load_EC_strings(void);

/* Error codes for the EC functions. */

/* Function codes. */
#define EC_F_BN_TO_FELEM				 224
#define EC_F_COMPUTE_WNAF				 143
Changes to jni/libressl/include/openssl/ecdh.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ecdh.h,v 1.5 2015/09/13 12:03:07 jsing Exp $ */
/* ====================================================================
 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
 *
 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
 * to the OpenSSL project.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ecdh.h,v 1.6 2022/07/12 14:42:49 kn Exp $ */
/* ====================================================================
 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
 *
 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
 * to the OpenSSL project.
 *
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

int 	  ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int 	  ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
void 	  *ECDH_get_ex_data(EC_KEY *d, int idx);


/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_ECDH_strings(void);

/* Error codes for the ECDH functions. */

/* Function codes. */
#define ECDH_F_ECDH_CHECK				 102
#define ECDH_F_ECDH_COMPUTE_KEY				 100







<
<
<
<







98
99
100
101
102
103
104




105
106
107
108
109
110
111

int 	  ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int 	  ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
void 	  *ECDH_get_ex_data(EC_KEY *d, int idx);






void ERR_load_ECDH_strings(void);

/* Error codes for the ECDH functions. */

/* Function codes. */
#define ECDH_F_ECDH_CHECK				 102
#define ECDH_F_ECDH_COMPUTE_KEY				 100
Changes to jni/libressl/include/openssl/ecdsa.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ecdsa.h,v 1.11 2022/01/14 08:31:03 tb Exp $ */
/**
 * \file   crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
 * \author Written by Nils Larsch for the OpenSSL project
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ecdsa.h,v 1.12 2022/07/12 14:42:49 kn Exp $ */
/**
 * \file   crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
 * \author Written by Nils Larsch for the OpenSSL project
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
	EC_KEY *eckey));
void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth,
    int (**pverify)(int type, const unsigned char *dgst, int dgst_len,
	const unsigned char *sigbuf, int sig_len, EC_KEY *eckey),
    int (**pverify_sig)(const unsigned char *dgst, int dgst_len,
	const ECDSA_SIG *sig, EC_KEY *eckey));


/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_ECDSA_strings(void);

/* Error codes for the ECDSA functions. */

/* Function codes. */
#define ECDSA_F_ECDSA_CHECK				 104
#define ECDSA_F_ECDSA_DATA_NEW_METHOD			 100







<
<
<
<
<







289
290
291
292
293
294
295





296
297
298
299
300
301
302
	EC_KEY *eckey));
void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth,
    int (**pverify)(int type, const unsigned char *dgst, int dgst_len,
	const unsigned char *sigbuf, int sig_len, EC_KEY *eckey),
    int (**pverify_sig)(const unsigned char *dgst, int dgst_len,
	const ECDSA_SIG *sig, EC_KEY *eckey));






void ERR_load_ECDSA_strings(void);

/* Error codes for the ECDSA functions. */

/* Function codes. */
#define ECDSA_F_ECDSA_CHECK				 104
#define ECDSA_F_ECDSA_DATA_NEW_METHOD			 100
Changes to jni/libressl/include/openssl/engine.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: engine.h,v 1.33 2019/01/19 01:07:00 tb Exp $ */
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: engine.h,v 1.34 2022/07/12 14:42:49 kn Exp $ */
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
 * loaded ENGINE has (or gets from through the loader) its own copy of the
 * libcrypto static data, we will need to set the callbacks. The easiest way to
 * detect this is to have a function that returns a pointer to some static data
 * and let the loading application and loaded ENGINE compare their respective
 * values. */
					void *ENGINE_get_static_state(void);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_ENGINE_strings(void);

/* Error codes for the ENGINE functions. */

/* Function codes. */
#define ENGINE_F_DYNAMIC_CTRL				 180
#define ENGINE_F_DYNAMIC_GET_DATA_CTX			 181







<
<
<
<







712
713
714
715
716
717
718




719
720
721
722
723
724
725
 * loaded ENGINE has (or gets from through the loader) its own copy of the
 * libcrypto static data, we will need to set the callbacks. The easiest way to
 * detect this is to have a function that returns a pointer to some static data
 * and let the loading application and loaded ENGINE compare their respective
 * values. */
					void *ENGINE_get_static_state(void);





void ERR_load_ENGINE_strings(void);

/* Error codes for the ENGINE functions. */

/* Function codes. */
#define ENGINE_F_DYNAMIC_CTRL				 180
#define ENGINE_F_DYNAMIC_GET_DATA_CTX			 181
Changes to jni/libressl/include/openssl/err.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: err.h,v 1.26 2021/11/24 01:12:43 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: err.h,v 1.28 2022/08/29 06:49:24 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
193
194
195
196
197
198
199

200
201
202
203
204
205
206
#define ERR_LIB_FIPS		45
#define ERR_LIB_CMS		46
#define ERR_LIB_TS		47
#define ERR_LIB_HMAC		48
#define ERR_LIB_JPAKE		49
#define ERR_LIB_GOST		50
#define ERR_LIB_CT		51


#define ERR_LIB_USER		128

#ifndef LIBRESSL_INTERNAL
#define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
#define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
#define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)







>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#define ERR_LIB_FIPS		45
#define ERR_LIB_CMS		46
#define ERR_LIB_TS		47
#define ERR_LIB_HMAC		48
#define ERR_LIB_JPAKE		49
#define ERR_LIB_GOST		50
#define ERR_LIB_CT		51
#define ERR_LIB_KDF		52

#define ERR_LIB_USER		128

#ifndef LIBRESSL_INTERNAL
#define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
#define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
#define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
232
233
234
235
236
237
238

239
240
241
242
243
244
245
#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
#define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
#define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
#define GOSTerr(f,r) ERR_PUT_error(ERR_LIB_GOST,(f),(r),__FILE__,__LINE__)
#define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
#define CTerr(f, r) ERR_PUT_error(ERR_LIB_CT,(f),(r),__FILE__,__LINE__)

#endif

#ifdef LIBRESSL_INTERNAL
#define SYSerror(r)  ERR_PUT_error(ERR_LIB_SYS,(0xfff),(r),__FILE__,__LINE__)
#define BNerror(r)   ERR_PUT_error(ERR_LIB_BN,(0xfff),(r),__FILE__,__LINE__)
#define RSAerror(r)  ERR_PUT_error(ERR_LIB_RSA,(0xfff),(r),__FILE__,__LINE__)
#define DHerror(r)   ERR_PUT_error(ERR_LIB_DH,(0xfff),(r),__FILE__,__LINE__)







>







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
#define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
#define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
#define GOSTerr(f,r) ERR_PUT_error(ERR_LIB_GOST,(f),(r),__FILE__,__LINE__)
#define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
#define CTerr(f, r) ERR_PUT_error(ERR_LIB_CT,(f),(r),__FILE__,__LINE__)
#define KDFerr(f, r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),__FILE__,__LINE__)
#endif

#ifdef LIBRESSL_INTERNAL
#define SYSerror(r)  ERR_PUT_error(ERR_LIB_SYS,(0xfff),(r),__FILE__,__LINE__)
#define BNerror(r)   ERR_PUT_error(ERR_LIB_BN,(0xfff),(r),__FILE__,__LINE__)
#define RSAerror(r)  ERR_PUT_error(ERR_LIB_RSA,(0xfff),(r),__FILE__,__LINE__)
#define DHerror(r)   ERR_PUT_error(ERR_LIB_DH,(0xfff),(r),__FILE__,__LINE__)
269
270
271
272
273
274
275

276
277
278
279
280
281
282
#define FIPSerror(r) ERR_PUT_error(ERR_LIB_FIPS,(0xfff),(r),__FILE__,__LINE__)
#define CMSerror(r) ERR_PUT_error(ERR_LIB_CMS,(0xfff),(r),__FILE__,__LINE__)
#define TSerror(r) ERR_PUT_error(ERR_LIB_TS,(0xfff),(r),__FILE__,__LINE__)
#define HMACerror(r) ERR_PUT_error(ERR_LIB_HMAC,(0xfff),(r),__FILE__,__LINE__)
#define JPAKEerror(r) ERR_PUT_error(ERR_LIB_JPAKE,(0xfff),(r),__FILE__,__LINE__)
#define GOSTerror(r) ERR_PUT_error(ERR_LIB_GOST,(0xfff),(r),__FILE__,__LINE__)
#define CTerror(r) ERR_PUT_error(ERR_LIB_CT,(0xfff),(r),__FILE__,__LINE__)

#endif

#define ERR_PACK(l,f,r)		(((((unsigned long)l)&0xffL)<<24L)| \
				((((unsigned long)f)&0xfffL)<<12L)| \
				((((unsigned long)r)&0xfffL)))
#define ERR_GET_LIB(l)		(int)((((unsigned long)l)>>24L)&0xffL)
#define ERR_GET_FUNC(l)		(int)((((unsigned long)l)>>12L)&0xfffL)







>







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#define FIPSerror(r) ERR_PUT_error(ERR_LIB_FIPS,(0xfff),(r),__FILE__,__LINE__)
#define CMSerror(r) ERR_PUT_error(ERR_LIB_CMS,(0xfff),(r),__FILE__,__LINE__)
#define TSerror(r) ERR_PUT_error(ERR_LIB_TS,(0xfff),(r),__FILE__,__LINE__)
#define HMACerror(r) ERR_PUT_error(ERR_LIB_HMAC,(0xfff),(r),__FILE__,__LINE__)
#define JPAKEerror(r) ERR_PUT_error(ERR_LIB_JPAKE,(0xfff),(r),__FILE__,__LINE__)
#define GOSTerror(r) ERR_PUT_error(ERR_LIB_GOST,(0xfff),(r),__FILE__,__LINE__)
#define CTerror(r) ERR_PUT_error(ERR_LIB_CT,(0xfff),(r),__FILE__,__LINE__)
#define KDFerror(r) ERR_PUT_error(ERR_LIB_KDF,(0xfff),(r),__FILE__,__LINE__)
#endif

#define ERR_PACK(l,f,r)		(((((unsigned long)l)&0xffL)<<24L)| \
				((((unsigned long)f)&0xfffL)<<12L)| \
				((((unsigned long)r)&0xfffL)))
#define ERR_GET_LIB(l)		(int)((((unsigned long)l)>>24L)&0xffL)
#define ERR_GET_FUNC(l)		(int)((((unsigned long)l)>>12L)&0xfffL)
339
340
341
342
343
344
345

346
347
348
349
350
351
352
353
354
355
356
/* fatal error */
#define ERR_R_FATAL				64
#define	ERR_R_MALLOC_FAILURE			(1|ERR_R_FATAL)
#define	ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED	(2|ERR_R_FATAL)
#define	ERR_R_PASSED_NULL_PARAMETER		(3|ERR_R_FATAL)
#define	ERR_R_INTERNAL_ERROR			(4|ERR_R_FATAL)
#define	ERR_R_DISABLED				(5|ERR_R_FATAL)


/* 99 is the maximum possible ERR_R_... code, higher values
 * are reserved for the individual libraries */


typedef struct ERR_string_data_st {
	unsigned long error;
	const char *string;
} ERR_STRING_DATA;

void ERR_put_error(int lib, int func, int reason, const char *file, int line);







>



<







342
343
344
345
346
347
348
349
350
351
352

353
354
355
356
357
358
359
/* fatal error */
#define ERR_R_FATAL				64
#define	ERR_R_MALLOC_FAILURE			(1|ERR_R_FATAL)
#define	ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED	(2|ERR_R_FATAL)
#define	ERR_R_PASSED_NULL_PARAMETER		(3|ERR_R_FATAL)
#define	ERR_R_INTERNAL_ERROR			(4|ERR_R_FATAL)
#define	ERR_R_DISABLED				(5|ERR_R_FATAL)
#define	ERR_R_INIT_FAIL				(6|ERR_R_FATAL)

/* 99 is the maximum possible ERR_R_... code, higher values
 * are reserved for the individual libraries */


typedef struct ERR_string_data_st {
	unsigned long error;
	const char *string;
} ERR_STRING_DATA;

void ERR_put_error(int lib, int func, int reason, const char *file, int line);
Changes to jni/libressl/include/openssl/evp.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: evp.h,v 1.99 2022/01/14 08:38:05 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: evp.h,v 1.107 2022/09/11 17:29:24 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
108
109
110
111
112
113
114

115
116
117
118
119
120
121
#define EVP_PKEY_DSA4	NID_dsaWithSHA1_2
#define EVP_PKEY_DH	NID_dhKeyAgreement
#define EVP_PKEY_EC	NID_X9_62_id_ecPublicKey
#define EVP_PKEY_GOSTR01 NID_id_GostR3410_2001
#define EVP_PKEY_GOSTIMIT NID_id_Gost28147_89_MAC
#define EVP_PKEY_HMAC	NID_hmac
#define EVP_PKEY_CMAC	NID_cmac

#define EVP_PKEY_GOSTR12_256 NID_id_tc26_gost3410_2012_256
#define EVP_PKEY_GOSTR12_512 NID_id_tc26_gost3410_2012_512

#ifdef	__cplusplus
extern "C" {
#endif








>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#define EVP_PKEY_DSA4	NID_dsaWithSHA1_2
#define EVP_PKEY_DH	NID_dhKeyAgreement
#define EVP_PKEY_EC	NID_X9_62_id_ecPublicKey
#define EVP_PKEY_GOSTR01 NID_id_GostR3410_2001
#define EVP_PKEY_GOSTIMIT NID_id_Gost28147_89_MAC
#define EVP_PKEY_HMAC	NID_hmac
#define EVP_PKEY_CMAC	NID_cmac
#define EVP_PKEY_HKDF	NID_hkdf
#define EVP_PKEY_GOSTR12_256 NID_id_tc26_gost3410_2012_256
#define EVP_PKEY_GOSTR12_512 NID_id_tc26_gost3410_2012_512

#ifdef	__cplusplus
extern "C" {
#endif

246
247
248
249
250
251
252

253
254
255
256
257
258
259
260
261
262
263
#define		EVP_CTRL_SET_RC5_ROUNDS		0x5
#define		EVP_CTRL_RAND_KEY		0x6
#define		EVP_CTRL_PBE_PRF_NID		0x7
#define		EVP_CTRL_COPY			0x8
#define		EVP_CTRL_AEAD_SET_IVLEN		0x9
#define		EVP_CTRL_AEAD_GET_TAG		0x10
#define		EVP_CTRL_AEAD_SET_TAG		0x11

#define		EVP_CTRL_GCM_SET_IVLEN		EVP_CTRL_AEAD_SET_IVLEN
#define		EVP_CTRL_GCM_GET_TAG		EVP_CTRL_AEAD_GET_TAG
#define		EVP_CTRL_GCM_SET_TAG		EVP_CTRL_AEAD_SET_TAG
#define		EVP_CTRL_GCM_SET_IV_FIXED	0x12
#define		EVP_CTRL_GCM_IV_GEN		0x13
#define		EVP_CTRL_CCM_SET_IVLEN		EVP_CTRL_AEAD_SET_IVLEN
#define		EVP_CTRL_CCM_GET_TAG		EVP_CTRL_AEAD_GET_TAG
#define		EVP_CTRL_CCM_SET_TAG		EVP_CTRL_AEAD_SET_TAG
#define		EVP_CTRL_CCM_SET_L		0x14
#define		EVP_CTRL_CCM_SET_MSGLEN		0x15
/* AEAD cipher deduces payload length and returns number of bytes







>



|







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#define		EVP_CTRL_SET_RC5_ROUNDS		0x5
#define		EVP_CTRL_RAND_KEY		0x6
#define		EVP_CTRL_PBE_PRF_NID		0x7
#define		EVP_CTRL_COPY			0x8
#define		EVP_CTRL_AEAD_SET_IVLEN		0x9
#define		EVP_CTRL_AEAD_GET_TAG		0x10
#define		EVP_CTRL_AEAD_SET_TAG		0x11
#define		EVP_CTRL_AEAD_SET_IV_FIXED	0x12
#define		EVP_CTRL_GCM_SET_IVLEN		EVP_CTRL_AEAD_SET_IVLEN
#define		EVP_CTRL_GCM_GET_TAG		EVP_CTRL_AEAD_GET_TAG
#define		EVP_CTRL_GCM_SET_TAG		EVP_CTRL_AEAD_SET_TAG
#define		EVP_CTRL_GCM_SET_IV_FIXED	EVP_CTRL_AEAD_SET_IV_FIXED
#define		EVP_CTRL_GCM_IV_GEN		0x13
#define		EVP_CTRL_CCM_SET_IVLEN		EVP_CTRL_AEAD_SET_IVLEN
#define		EVP_CTRL_CCM_GET_TAG		EVP_CTRL_AEAD_GET_TAG
#define		EVP_CTRL_CCM_SET_TAG		EVP_CTRL_AEAD_SET_TAG
#define		EVP_CTRL_CCM_SET_L		0x14
#define		EVP_CTRL_CCM_SET_MSGLEN		0x15
/* AEAD cipher deduces payload length and returns number of bytes
276
277
278
279
280
281
282















283
284
285
286
287
288
289
/* Length of fixed part of IV derived from PRF */
#define EVP_GCM_TLS_FIXED_IV_LEN			4
/* Length of explicit part of IV part of TLS records */
#define EVP_GCM_TLS_EXPLICIT_IV_LEN			8
/* Length of tag for TLS */
#define EVP_GCM_TLS_TAG_LEN				16
















typedef struct evp_cipher_info_st {
	const EVP_CIPHER *cipher;
	unsigned char iv[EVP_MAX_IV_LENGTH];
} EVP_CIPHER_INFO;

/* Password based encryption function */
typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/* Length of fixed part of IV derived from PRF */
#define EVP_GCM_TLS_FIXED_IV_LEN			4
/* Length of explicit part of IV part of TLS records */
#define EVP_GCM_TLS_EXPLICIT_IV_LEN			8
/* Length of tag for TLS */
#define EVP_GCM_TLS_TAG_LEN				16

/* CCM TLS constants */
/* Length of fixed part of IV derived from PRF */
#define EVP_CCM_TLS_FIXED_IV_LEN			4
/* Length of explicit part of IV part of TLS records */
#define EVP_CCM_TLS_EXPLICIT_IV_LEN			8
/* Total length of CCM IV length for TLS */
#define EVP_CCM_TLS_IV_LEN				12
/* Length of tag for TLS */
#define EVP_CCM_TLS_TAG_LEN				16
/* Length of CCM8 tag for TLS */
#define EVP_CCM8_TLS_TAG_LEN				8

/* Length of tag for TLS */
#define EVP_CHACHAPOLY_TLS_TAG_LEN			16

typedef struct evp_cipher_info_st {
	const EVP_CIPHER *cipher;
	unsigned char iv[EVP_MAX_IV_LENGTH];
} EVP_CIPHER_INFO;

/* Password based encryption function */
typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
675
676
677
678
679
680
681



682
683
684
685
686
687
688
# define EVP_aes_256_cfb EVP_aes_256_cfb128
const EVP_CIPHER *EVP_aes_256_ofb(void);
const EVP_CIPHER *EVP_aes_256_ctr(void);
const EVP_CIPHER *EVP_aes_256_ccm(void);
const EVP_CIPHER *EVP_aes_256_gcm(void);
const EVP_CIPHER *EVP_aes_256_wrap(void);
const EVP_CIPHER *EVP_aes_256_xts(void);



#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
#endif
#endif
#ifndef OPENSSL_NO_CAMELLIA
const EVP_CIPHER *EVP_camellia_128_ecb(void);







>
>
>







692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
# define EVP_aes_256_cfb EVP_aes_256_cfb128
const EVP_CIPHER *EVP_aes_256_ofb(void);
const EVP_CIPHER *EVP_aes_256_ctr(void);
const EVP_CIPHER *EVP_aes_256_ccm(void);
const EVP_CIPHER *EVP_aes_256_gcm(void);
const EVP_CIPHER *EVP_aes_256_wrap(void);
const EVP_CIPHER *EVP_aes_256_xts(void);
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
const EVP_CIPHER *EVP_chacha20_poly1305(void);
#endif
#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
#endif
#endif
#ifndef OPENSSL_NO_CAMELLIA
const EVP_CIPHER *EVP_camellia_128_ecb(void);
764
765
766
767
768
769
770

771
772
773
774
775
776
777
    int enc_key_len, EVP_PKEY *private_key);
int EVP_PKEY_encrypt_old(unsigned char *enc_key, const unsigned char *key,
    int key_len, EVP_PKEY *pub_key);
int EVP_PKEY_type(int type);
int EVP_PKEY_id(const EVP_PKEY *pkey);
int EVP_PKEY_base_id(const EVP_PKEY *pkey);
int EVP_PKEY_bits(const EVP_PKEY *pkey);

int EVP_PKEY_size(const EVP_PKEY *pkey);
int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
void *EVP_PKEY_get0(const EVP_PKEY *pkey);
const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len);








>







784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
    int enc_key_len, EVP_PKEY *private_key);
int EVP_PKEY_encrypt_old(unsigned char *enc_key, const unsigned char *key,
    int key_len, EVP_PKEY *pub_key);
int EVP_PKEY_type(int type);
int EVP_PKEY_id(const EVP_PKEY *pkey);
int EVP_PKEY_base_id(const EVP_PKEY *pkey);
int EVP_PKEY_bits(const EVP_PKEY *pkey);
int EVP_PKEY_security_bits(const EVP_PKEY *pkey);
int EVP_PKEY_size(const EVP_PKEY *pkey);
int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
void *EVP_PKEY_get0(const EVP_PKEY *pkey);
const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len);

926
927
928
929
930
931
932


933
934
935
936
937
938
939
    int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
    ASN1_PCTX *pctx));

void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
    void (*pkey_free)(EVP_PKEY *pkey));
void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2));



void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_check)(const EVP_PKEY *pk));
void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_public_check)(const EVP_PKEY *pk));
void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_check)(const EVP_PKEY *pk));







>
>







947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
    int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
    ASN1_PCTX *pctx));

void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
    void (*pkey_free)(EVP_PKEY *pkey));
void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2));
void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_security_bits)(const EVP_PKEY *pkey));

void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_check)(const EVP_PKEY *pk));
void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_public_check)(const EVP_PKEY *pk));
void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,
    int (*pkey_check)(const EVP_PKEY *pk));
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
int EVP_AEAD_CTX_open(const EVP_AEAD_CTX *ctx, unsigned char *out,
    size_t *out_len, size_t max_out_len, const unsigned char *nonce,
    size_t nonce_len, const unsigned char *in, size_t in_len,
    const unsigned char *ad, size_t ad_len);

void EVP_add_alg_module(void);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_EVP_strings(void);

/* Error codes for the EVP functions. */

/* Function codes. */
#define EVP_F_AEAD_AES_GCM_INIT				 187
#define EVP_F_AEAD_AES_GCM_OPEN				 188







<
<
<
<







1277
1278
1279
1280
1281
1282
1283




1284
1285
1286
1287
1288
1289
1290
int EVP_AEAD_CTX_open(const EVP_AEAD_CTX *ctx, unsigned char *out,
    size_t *out_len, size_t max_out_len, const unsigned char *nonce,
    size_t nonce_len, const unsigned char *in, size_t in_len,
    const unsigned char *ad, size_t ad_len);

void EVP_add_alg_module(void);





void ERR_load_EVP_strings(void);

/* Error codes for the EVP functions. */

/* Function codes. */
#define EVP_F_AEAD_AES_GCM_INIT				 187
#define EVP_F_AEAD_AES_GCM_OPEN				 188
Changes to jni/libressl/include/openssl/gost.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: gost.h,v 1.3 2016/09/04 17:02:31 jsing Exp $ */
/*
 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
 * Copyright (c) 2005-2006 Cryptocom LTD
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
|







1
2
3
4
5
6
7
8
/* $OpenBSD: gost.h,v 1.4 2022/07/12 14:42:49 kn Exp $ */
/*
 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
 * Copyright (c) 2005-2006 Cryptocom LTD
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#define EVP_PKEY_CTRL_GOST_SIG_FORMAT	(EVP_PKEY_ALG_CTRL+2)
#define EVP_PKEY_CTRL_GOST_SET_DIGEST	(EVP_PKEY_ALG_CTRL+3)
#define EVP_PKEY_CTRL_GOST_GET_DIGEST	(EVP_PKEY_ALG_CTRL+4)

#define GOST_SIG_FORMAT_SR_BE	0
#define GOST_SIG_FORMAT_RS_LE	1

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_GOST_strings(void);

/* Error codes for the GOST functions. */

/* Function codes. */
#define GOST_F_DECODE_GOST01_ALGOR_PARAMS		 104
#define GOST_F_ENCODE_GOST01_ALGOR_PARAMS		 105







<
<
<
<







195
196
197
198
199
200
201




202
203
204
205
206
207
208
#define EVP_PKEY_CTRL_GOST_SIG_FORMAT	(EVP_PKEY_ALG_CTRL+2)
#define EVP_PKEY_CTRL_GOST_SET_DIGEST	(EVP_PKEY_ALG_CTRL+3)
#define EVP_PKEY_CTRL_GOST_GET_DIGEST	(EVP_PKEY_ALG_CTRL+4)

#define GOST_SIG_FORMAT_SR_BE	0
#define GOST_SIG_FORMAT_RS_LE	1





void ERR_load_GOST_strings(void);

/* Error codes for the GOST functions. */

/* Function codes. */
#define GOST_F_DECODE_GOST01_ALGOR_PARAMS		 104
#define GOST_F_ENCODE_GOST01_ALGOR_PARAMS		 105
Added jni/libressl/include/openssl/kdf.h.






























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*	$OpenBSD: kdf.h,v 1.8 2022/07/12 14:42:49 kn Exp $ */
/*
 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 2016-2018 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licensing@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 */

#ifndef HEADER_KDF_H
# define HEADER_KDF_H

#ifdef __cplusplus
extern "C" {
#endif

# define EVP_PKEY_CTRL_HKDF_MD                  (EVP_PKEY_ALG_CTRL + 3)
# define EVP_PKEY_CTRL_HKDF_SALT                (EVP_PKEY_ALG_CTRL + 4)
# define EVP_PKEY_CTRL_HKDF_KEY                 (EVP_PKEY_ALG_CTRL + 5)
# define EVP_PKEY_CTRL_HKDF_INFO                (EVP_PKEY_ALG_CTRL + 6)
# define EVP_PKEY_CTRL_HKDF_MODE                (EVP_PKEY_ALG_CTRL + 7)

# define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND 0
# define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY       1
# define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY        2

# define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \
            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
                              EVP_PKEY_CTRL_HKDF_MD, 0, (void *)(md))

# define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \
            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
                              EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)(salt))

# define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \
            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
                              EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)(key))

# define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \
            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
                              EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)(info))

# define EVP_PKEY_CTX_hkdf_mode(pctx, mode) \
            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
                              EVP_PKEY_CTRL_HKDF_MODE, mode, NULL)

int ERR_load_KDF_strings(void);

/*
 * KDF function codes.
 */
# define KDF_F_PKEY_HKDF_CTRL_STR                         103
# define KDF_F_PKEY_HKDF_DERIVE                           102
# define KDF_F_PKEY_HKDF_INIT                             108

/*
 * KDF reason codes.
 */
# define KDF_R_MISSING_KEY                                104
# define KDF_R_MISSING_MESSAGE_DIGEST                     105
# define KDF_R_UNKNOWN_PARAMETER_TYPE                     103

# ifdef  __cplusplus
}
# endif
#endif
Changes to jni/libressl/include/openssl/obj_mac.h.
881
882
883
884
885
886
887




888
889
890
891
892
893
894
#define NID_id_ct_signedChecklist		1014
#define OBJ_id_ct_signedChecklist		OBJ_id_smime_ct,48L

#define SN_id_ct_ASPA		"id-ct-ASPA"
#define NID_id_ct_ASPA		1017
#define OBJ_id_ct_ASPA		OBJ_id_smime_ct,49L





#define SN_id_smime_aa_receiptRequest		"id-smime-aa-receiptRequest"
#define NID_id_smime_aa_receiptRequest		212
#define OBJ_id_smime_aa_receiptRequest		OBJ_id_smime_aa,1L

#define SN_id_smime_aa_securityLabel		"id-smime-aa-securityLabel"
#define NID_id_smime_aa_securityLabel		213
#define OBJ_id_smime_aa_securityLabel		OBJ_id_smime_aa,2L







>
>
>
>







881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
#define NID_id_ct_signedChecklist		1014
#define OBJ_id_ct_signedChecklist		OBJ_id_smime_ct,48L

#define SN_id_ct_ASPA		"id-ct-ASPA"
#define NID_id_ct_ASPA		1017
#define OBJ_id_ct_ASPA		OBJ_id_smime_ct,49L

#define SN_id_ct_signedTAL		"id-ct-signedTAL"
#define NID_id_ct_signedTAL		1024
#define OBJ_id_ct_signedTAL		OBJ_id_smime_ct,50L

#define SN_id_smime_aa_receiptRequest		"id-smime-aa-receiptRequest"
#define NID_id_smime_aa_receiptRequest		212
#define OBJ_id_smime_aa_receiptRequest		OBJ_id_smime_aa,1L

#define SN_id_smime_aa_securityLabel		"id-smime-aa-securityLabel"
#define NID_id_smime_aa_securityLabel		213
#define OBJ_id_smime_aa_securityLabel		OBJ_id_smime_aa,2L
996
997
998
999
1000
1001
1002




1003
1004
1005
1006
1007
1008
1009
#define SN_id_smime_aa_signatureType		"id-smime-aa-signatureType"
#define NID_id_smime_aa_signatureType		239
#define OBJ_id_smime_aa_signatureType		OBJ_id_smime_aa,28L

#define SN_id_smime_aa_dvcs_dvc		"id-smime-aa-dvcs-dvc"
#define NID_id_smime_aa_dvcs_dvc		240
#define OBJ_id_smime_aa_dvcs_dvc		OBJ_id_smime_aa,29L





#define SN_id_smime_alg_ESDHwith3DES		"id-smime-alg-ESDHwith3DES"
#define NID_id_smime_alg_ESDHwith3DES		241
#define OBJ_id_smime_alg_ESDHwith3DES		OBJ_id_smime_alg,1L

#define SN_id_smime_alg_ESDHwithRC2		"id-smime-alg-ESDHwithRC2"
#define NID_id_smime_alg_ESDHwithRC2		242







>
>
>
>







1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
#define SN_id_smime_aa_signatureType		"id-smime-aa-signatureType"
#define NID_id_smime_aa_signatureType		239
#define OBJ_id_smime_aa_signatureType		OBJ_id_smime_aa,28L

#define SN_id_smime_aa_dvcs_dvc		"id-smime-aa-dvcs-dvc"
#define NID_id_smime_aa_dvcs_dvc		240
#define OBJ_id_smime_aa_dvcs_dvc		OBJ_id_smime_aa,29L

#define SN_id_smime_aa_signingCertificateV2		"id-smime-aa-signingCertificateV2"
#define NID_id_smime_aa_signingCertificateV2		1023
#define OBJ_id_smime_aa_signingCertificateV2		OBJ_id_smime_aa,47L

#define SN_id_smime_alg_ESDHwith3DES		"id-smime-alg-ESDHwith3DES"
#define NID_id_smime_alg_ESDHwith3DES		241
#define OBJ_id_smime_alg_ESDHwith3DES		OBJ_id_smime_alg,1L

#define SN_id_smime_alg_ESDHwithRC2		"id-smime-alg-ESDHwithRC2"
#define NID_id_smime_alg_ESDHwithRC2		242
4245
4246
4247
4248
4249
4250
4251




4252
4253
4254
4255
4256
4257
4258
#define NID_ct_precert_signer		1020
#define OBJ_ct_precert_signer		1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L

#define SN_ct_cert_scts		"ct_cert_scts"
#define LN_ct_cert_scts		"CT Certificate SCTs"
#define NID_ct_cert_scts		1021
#define OBJ_ct_cert_scts		1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L





#define SN_teletrust		"teletrust"
#define NID_teletrust		920
#define OBJ_teletrust		OBJ_identified_organization,36L

#define SN_brainpool		"brainpool"
#define NID_brainpool		921







>
>
>
>







4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
#define NID_ct_precert_signer		1020
#define OBJ_ct_precert_signer		1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L

#define SN_ct_cert_scts		"ct_cert_scts"
#define LN_ct_cert_scts		"CT Certificate SCTs"
#define NID_ct_cert_scts		1021
#define OBJ_ct_cert_scts		1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L

#define SN_hkdf		"HKDF"
#define LN_hkdf		"hkdf"
#define NID_hkdf		1022

#define SN_teletrust		"teletrust"
#define NID_teletrust		920
#define OBJ_teletrust		OBJ_identified_organization,36L

#define SN_brainpool		"brainpool"
#define NID_brainpool		921
Changes to jni/libressl/include/openssl/objects.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: objects.h,v 1.17 2022/01/14 08:56:00 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: objects.h,v 1.18 2022/07/12 14:42:49 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
void OBJ_sigid_free(void);

#if defined(LIBRESSL_CRYPTO_INTERNAL)
extern int obj_cleanup_defer;
void check_defer(int nid);
#endif

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_OBJ_strings(void);

/* Error codes for the OBJ functions. */

/* Function codes. */
#define OBJ_F_OBJ_ADD_OBJECT				 105
#define OBJ_F_OBJ_CREATE				 100







<
<
<
<







1034
1035
1036
1037
1038
1039
1040




1041
1042
1043
1044
1045
1046
1047
void OBJ_sigid_free(void);

#if defined(LIBRESSL_CRYPTO_INTERNAL)
extern int obj_cleanup_defer;
void check_defer(int nid);
#endif





void ERR_load_OBJ_strings(void);

/* Error codes for the OBJ functions. */

/* Function codes. */
#define OBJ_F_OBJ_ADD_OBJECT				 105
#define OBJ_F_OBJ_CREATE				 100
Changes to jni/libressl/include/openssl/ocsp.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ocsp.h,v 1.19 2022/01/14 08:32:26 tb Exp $ */
/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
 * project. */

/* History:
   This file was transfered to Richard Levitte from CertCo by Kathy
   Weinhold in mid-spring 2000 to be included in OpenSSL or released
   as a patch kit. */
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ocsp.h,v 1.20 2022/07/12 14:42:49 kn Exp $ */
/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
 * project. */

/* History:
   This file was transfered to Richard Levitte from CertCo by Kathy
   Weinhold in mid-spring 2000 to be included in OpenSSL or released
   as a patch kit. */
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434

int	OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
int	OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);

int	OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
	    X509_STORE *st, unsigned long flags);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_OCSP_strings(void);

/* Error codes for the OCSP functions. */

/* Function codes. */
#define OCSP_F_ASN1_STRING_ENCODE			 100
#define OCSP_F_D2I_OCSP_NONCE				 102







<
<
<
<







417
418
419
420
421
422
423




424
425
426
427
428
429
430

int	OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
int	OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);

int	OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
	    X509_STORE *st, unsigned long flags);





void ERR_load_OCSP_strings(void);

/* Error codes for the OCSP functions. */

/* Function codes. */
#define OCSP_F_ASN1_STRING_ENCODE			 100
#define OCSP_F_D2I_OCSP_NONCE				 102
Changes to jni/libressl/include/openssl/opensslconf.h.
1
2
3
4
5
6
7
8
9
10
11
#include <openssl/opensslfeatures.h>
/* crypto/opensslconf.h.in */

#if defined(_MSC_VER) && !defined(__attribute__)
#define __attribute__(a)
#endif

#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
#define OPENSSLDIR "/etc/ssl"
#endif




|







1
2
3
4
5
6
7
8
9
10
11
#include <openssl/opensslfeatures.h>
/* crypto/opensslconf.h.in */

#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
#define __attribute__(a)
#endif

#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
#define OPENSSLDIR "/etc/ssl"
#endif

Changes to jni/libressl/include/openssl/opensslfeatures.h.
1
2
3
4
5

6
7
8
9
10
11
12
/*
 * Feature flags for LibreSSL... so you can actually tell when things
 * are enabled, rather than not being able to tell when things are
 * enabled (or possibly not yet not implemented, or removed!).
 */

#define LIBRESSL_HAS_TLS1_3
#define LIBRESSL_HAS_DTLS1_2

#define OPENSSL_THREADS

#define OPENSSL_NO_BUF_FREELISTS
#define OPENSSL_NO_GMP





>







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Feature flags for LibreSSL... so you can actually tell when things
 * are enabled, rather than not being able to tell when things are
 * enabled (or possibly not yet not implemented, or removed!).
 */
#define LIBRESSL_HAS_QUIC
#define LIBRESSL_HAS_TLS1_3
#define LIBRESSL_HAS_DTLS1_2

#define OPENSSL_THREADS

#define OPENSSL_NO_BUF_FREELISTS
#define OPENSSL_NO_GMP
Changes to jni/libressl/include/openssl/opensslv.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* $OpenBSD: opensslv.h,v 1.69 2022/03/15 21:15:08 bcook Exp $ */
#ifndef HEADER_OPENSSLV_H
#define HEADER_OPENSSLV_H

/* These will change with each release of LibreSSL-portable */
#define LIBRESSL_VERSION_NUMBER 0x3050300fL
/*                                    ^ Patch starts here   */
#define LIBRESSL_VERSION_TEXT   "LibreSSL 3.5.3"

/* These will never change */
#define OPENSSL_VERSION_NUMBER	0x20000000L
#define OPENSSL_VERSION_TEXT	LIBRESSL_VERSION_TEXT
#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT

#define SHLIB_VERSION_HISTORY ""
|




|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* $OpenBSD: opensslv.h,v 1.70 2022/07/04 12:31:55 tb Exp $ */
#ifndef HEADER_OPENSSLV_H
#define HEADER_OPENSSLV_H

/* These will change with each release of LibreSSL-portable */
#define LIBRESSL_VERSION_NUMBER 0x3060100fL
/*                                    ^ Patch starts here   */
#define LIBRESSL_VERSION_TEXT   "LibreSSL 3.6.1"

/* These will never change */
#define OPENSSL_VERSION_NUMBER	0x20000000L
#define OPENSSL_VERSION_TEXT	LIBRESSL_VERSION_TEXT
#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT

#define SHLIB_VERSION_HISTORY ""
Changes to jni/libressl/include/openssl/pem.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: pem.h,v 1.23 2022/01/14 07:52:24 tb Exp $ */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pem.h,v 1.24 2022/07/12 14:42:50 kn Exp $ */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
#ifndef OPENSSL_NO_RC4
EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb,
    void *u);
#endif


/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_PEM_strings(void);

/* Error codes for the PEM functions. */

/* Function codes. */
#define PEM_F_B2I_DSS					 127
#define PEM_F_B2I_PVK_BIO				 128







<
<
<
<







512
513
514
515
516
517
518




519
520
521
522
523
524
525
#ifndef OPENSSL_NO_RC4
EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb,
    void *u);
#endif






void ERR_load_PEM_strings(void);

/* Error codes for the PEM functions. */

/* Function codes. */
#define PEM_F_B2I_DSS					 127
#define PEM_F_B2I_PVK_BIO				 128
Changes to jni/libressl/include/openssl/pkcs12.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs12.h,v 1.24 2018/05/30 15:32:11 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs12.h,v 1.27 2022/09/11 17:30:13 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#endif

/* MS key usage constants */

#define KEY_EX	0x10
#define KEY_SIG 0x80

typedef struct {
	X509_SIG *dinfo;
	ASN1_OCTET_STRING *salt;
	ASN1_INTEGER *iter;	/* defaults to 1 */
} PKCS12_MAC_DATA;

typedef struct {
	ASN1_INTEGER *version;
	PKCS12_MAC_DATA *mac;
	PKCS7 *authsafes;
} PKCS12;

typedef struct {
	ASN1_OBJECT *type;
	union {
	struct pkcs12_bag_st *bag; /* secret, crl and certbag */
	struct pkcs8_priv_key_info_st	*keybag; /* keybag */
	X509_SIG *shkeybag; /* shrouded key bag */
		STACK_OF(PKCS12_SAFEBAG) *safes;
		ASN1_TYPE *other;
	} value;
	STACK_OF(X509_ATTRIBUTE) *attrib;
} PKCS12_SAFEBAG;

DECLARE_STACK_OF(PKCS12_SAFEBAG)
DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)

typedef struct pkcs12_bag_st {
	ASN1_OBJECT *type;
	union {
		ASN1_OCTET_STRING *x509cert;
		ASN1_OCTET_STRING *x509crl;
		ASN1_OCTET_STRING *octet;
		ASN1_IA5STRING *sdsicert;
		ASN1_TYPE *other; /* Secret or other bag */
	} value;
} PKCS12_BAGS;

#define PKCS12_ERROR	0
#define PKCS12_OK	1

#ifndef LIBRESSL_INTERNAL

/* Compatibility macros */







|
<
<
<
<

|
<
<
<
<

|
<
<
<
<
<
<
<
<
<
<




|
<
<
<
<
<
<
<
<
<







92
93
94
95
96
97
98
99




100
101




102
103










104
105
106
107
108









109
110
111
112
113
114
115
#endif

/* MS key usage constants */

#define KEY_EX	0x10
#define KEY_SIG 0x80

typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA;





typedef struct PKCS12_st PKCS12;





typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG;











DECLARE_STACK_OF(PKCS12_SAFEBAG)
DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)

typedef struct pkcs12_bag_st PKCS12_BAGS;










#define PKCS12_ERROR	0
#define PKCS12_OK	1

#ifndef LIBRESSL_INTERNAL

/* Compatibility macros */
151
152
153
154
155
156
157


158
159
160
161


162


163
164
165


166

167




168


169

170



171







172

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes
#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes
#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata

#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey
#define M_PKCS8_decrypt PKCS8_decrypt



#define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type)
#define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type)
#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type



#endif /* !LIBRESSL_INTERNAL */



#define PKCS12_get_attr(bag, attr_nid) \
			 PKCS12_get_attr_gen(bag->attrib, attr_nid)




#define PKCS8_get_attr(p8, attr_nid) \




		PKCS12_get_attr_gen(p8->attributes, attr_nid)




#define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0)













PKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509);
PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl);
X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag);
X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag);

PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it,
    int nid1, int nid2);
PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8);
PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass,
    int passlen);
PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag,
    const char *pass, int passlen);
X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
    const char *pass, int passlen, unsigned char *salt, int saltlen, int iter,
    PKCS8_PRIV_KEY_INFO *p8);
PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass,
    int passlen, unsigned char *salt, int saltlen, int iter,
    PKCS8_PRIV_KEY_INFO *p8);
PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);
STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);
PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,
    unsigned char *salt, int saltlen, int iter, STACK_OF(PKCS12_SAFEBAG) *bags);
STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
    int passlen);








>
>
|
|
|

>
>
|
>
>

|
|
>
>

>
|
>
>
>
>
|
>
>

>
|
>
>
>

>
>
>
>
>
>
>

>
|
|
|
|



<







<
<
<







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
183
184
185
186



187
188
189
190
191
192
193
#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes
#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes
#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata

#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey
#define M_PKCS8_decrypt PKCS8_decrypt

#endif /* !LIBRESSL_INTERNAL */

#define M_PKCS12_bag_type	PKCS12_bag_type
#define M_PKCS12_cert_bag_type	PKCS12_cert_bag_type
#define M_PKCS12_crl_bag_type	PKCS12_cert_bag_type

#define PKCS12_bag_type		PKCS12_SAFEBAG_get_nid
#define PKCS12_cert_bag_type	PKCS12_SAFEBAG_get_bag_nid

#define PKCS12_certbag2x509	PKCS12_SAFEBAG_get1_cert
#define PKCS12_certbag2x509crl	PKCS12_SAFEBAG_get1_crl

#define PKCS12_x5092certbag	PKCS12_SAFEBAG_create_cert
#define PKCS12_x509crl2certbag	PKCS12_SAFEBAG_create_crl
#define PKCS12_MAKE_KEYBAG	PKCS12_SAFEBAG_create0_p8inf
#define PKCS12_MAKE_SHKEYBAG	PKCS12_SAFEBAG_create_pkcs8_encrypt

const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag,
    int attr_nid);
const STACK_OF(X509_ATTRIBUTE) *
    PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag);
int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag);
int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag);

X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag);
X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag);

ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid);
int PKCS12_mac_present(const PKCS12 *p12);
void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, const X509_ALGOR **pmacalg,
    const ASN1_OCTET_STRING **psalt, const ASN1_INTEGER **piter,
    const PKCS12 *p12);

PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
    const char *pass, int passlen, unsigned char *salt, int saltlen, int iter,
    PKCS8_PRIV_KEY_INFO *p8);

const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag);
const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag);
const STACK_OF(PKCS12_SAFEBAG) *
    PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag);
const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag);

PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it,
    int nid1, int nid2);

PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass,
    int passlen);
PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag,
    const char *pass, int passlen);
X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
    const char *pass, int passlen, unsigned char *salt, int saltlen, int iter,
    PKCS8_PRIV_KEY_INFO *p8);



PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);
STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);
PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,
    unsigned char *salt, int saltlen, int iter, STACK_OF(PKCS12_SAFEBAG) *bags);
STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
    int passlen);

279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296

int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);
int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);
PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_PKCS12_strings(void);

/* Error codes for the PKCS12 functions. */

/* Function codes. */
#define PKCS12_F_PARSE_BAG				 129
#define PKCS12_F_PARSE_BAGS				 103







<
<
<
<







275
276
277
278
279
280
281




282
283
284
285
286
287
288

int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);
int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);
PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);





void ERR_load_PKCS12_strings(void);

/* Error codes for the PKCS12 functions. */

/* Function codes. */
#define PKCS12_F_PARSE_BAG				 129
#define PKCS12_F_PARSE_BAGS				 103
Changes to jni/libressl/include/openssl/pkcs7.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs7.h,v 1.18 2016/12/27 16:12:47 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: pkcs7.h,v 1.19 2022/07/12 14:42:50 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430

int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);

BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);


/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_PKCS7_strings(void);

/* Error codes for the PKCS7 functions. */

/* Function codes. */
#define PKCS7_F_B64_READ_PKCS7				 120
#define PKCS7_F_B64_WRITE_PKCS7				 121







<
<
<
<







413
414
415
416
417
418
419




420
421
422
423
424
425
426

int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);

BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);






void ERR_load_PKCS7_strings(void);

/* Error codes for the PKCS7 functions. */

/* Function codes. */
#define PKCS7_F_B64_READ_PKCS7				 120
#define PKCS7_F_B64_WRITE_PKCS7				 121
Changes to jni/libressl/include/openssl/rand.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: rand.h,v 1.22 2014/10/22 14:02:52 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: rand.h,v 1.23 2022/07/12 14:42:50 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
int  RAND_load_file(const char *file, long max_bytes);
int  RAND_write_file(const char *file);
const char *RAND_file_name(char *file, size_t num);
int RAND_status(void);
int RAND_poll(void);
#endif

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_RAND_strings(void);

/* Error codes for the RAND functions. (no longer used) */

/* Function codes. */
#define RAND_F_RAND_GET_RAND_METHOD			 101
#define RAND_F_RAND_INIT_FIPS				 102







<
<
<
<







97
98
99
100
101
102
103




104
105
106
107
108
109
110
int  RAND_load_file(const char *file, long max_bytes);
int  RAND_write_file(const char *file);
const char *RAND_file_name(char *file, size_t num);
int RAND_status(void);
int RAND_poll(void);
#endif





void ERR_load_RAND_strings(void);

/* Error codes for the RAND functions. (no longer used) */

/* Function codes. */
#define RAND_F_RAND_GET_RAND_METHOD			 101
#define RAND_F_RAND_INIT_FIPS				 102
Changes to jni/libressl/include/openssl/rsa.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: rsa.h,v 1.55 2022/01/14 08:34:39 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: rsa.h,v 1.58 2022/07/12 14:42:50 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
367
368
369
370
371
372
373


374
375
376
377
378
379
380
    const unsigned char *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash,
    int sLen);

int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int RSA_set_ex_data(RSA *r, int idx, void *arg);
void *RSA_get_ex_data(const RSA *r, int idx);



void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
    const BIGNUM **d);
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
    const BIGNUM **iqmp);
int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);







>
>







367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
    const unsigned char *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash,
    int sLen);

int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int RSA_set_ex_data(RSA *r, int idx, void *arg);
void *RSA_get_ex_data(const RSA *r, int idx);

int RSA_security_bits(const RSA *rsa);

void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
    const BIGNUM **d);
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
    const BIGNUM **iqmp);
int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
    const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
    unsigned int siglen, const RSA *rsa);
int RSA_meth_set_verify(RSA_METHOD *rsa, int (*verify)(int dtype,
    const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
    unsigned int siglen, const RSA *rsa));


/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_RSA_strings(void);

/* Error codes for the RSA functions. */

/* Function codes. */
#define RSA_F_CHECK_PADDING_MD				 140
#define RSA_F_DO_RSA_PRINT				 146







<
<
<
<







471
472
473
474
475
476
477




478
479
480
481
482
483
484
    const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
    unsigned int siglen, const RSA *rsa);
int RSA_meth_set_verify(RSA_METHOD *rsa, int (*verify)(int dtype,
    const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
    unsigned int siglen, const RSA *rsa));






void ERR_load_RSA_strings(void);

/* Error codes for the RSA functions. */

/* Function codes. */
#define RSA_F_CHECK_PADDING_MD				 140
#define RSA_F_DO_RSA_PRINT				 146
Changes to jni/libressl/include/openssl/safestack.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: safestack.h,v 1.21 2022/01/14 08:59:30 tb Exp $ */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: safestack.h,v 1.22 2022/07/16 19:11:51 kn Exp $ */
/* ====================================================================
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
769
770
771
772
773
774
775
























776
777
778
779
780
781
782
#define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st)
#define sk_ESS_CERT_ID_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID, (st), (free_func))
#define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st))
#define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st))
#define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st))
#define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st))

























#define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp))
#define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD)
#define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st))
#define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st))
#define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i))
#define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val))
#define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st))







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
#define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st)
#define sk_ESS_CERT_ID_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID, (st), (free_func))
#define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st))
#define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st))
#define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st))
#define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st))

#ifdef LIBRESSL_INTERNAL
#define sk_ESS_CERT_ID_V2_new(cmp) SKM_sk_new(ESS_CERT_ID_V2, (cmp))
#define sk_ESS_CERT_ID_V2_new_null() SKM_sk_new_null(ESS_CERT_ID_V2)
#define sk_ESS_CERT_ID_V2_free(st) SKM_sk_free(ESS_CERT_ID_V2, (st))
#define sk_ESS_CERT_ID_V2_num(st) SKM_sk_num(ESS_CERT_ID_V2, (st))
#define sk_ESS_CERT_ID_V2_value(st, i) SKM_sk_value(ESS_CERT_ID_V2, (st), (i))
#define sk_ESS_CERT_ID_V2_set(st, i, val) SKM_sk_set(ESS_CERT_ID_V2, (st), (i), (val))
#define sk_ESS_CERT_ID_V2_zero(st) SKM_sk_zero(ESS_CERT_ID_V2, (st))
#define sk_ESS_CERT_ID_V2_push(st, val) SKM_sk_push(ESS_CERT_ID_V2, (st), (val))
#define sk_ESS_CERT_ID_V2_unshift(st, val) SKM_sk_unshift(ESS_CERT_ID_V2, (st), (val))
#define sk_ESS_CERT_ID_V2_find(st, val) SKM_sk_find(ESS_CERT_ID_V2, (st), (val))
#define sk_ESS_CERT_ID_V2_find_ex(st, val) SKM_sk_find_ex(ESS_CERT_ID_V2, (st), (val))
#define sk_ESS_CERT_ID_V2_delete(st, i) SKM_sk_delete(ESS_CERT_ID_V2, (st), (i))
#define sk_ESS_CERT_ID_V2_delete_ptr(st, ptr) SKM_sk_delete_ptr(ESS_CERT_ID_V2, (st), (ptr))
#define sk_ESS_CERT_ID_V2_insert(st, val, i) SKM_sk_insert(ESS_CERT_ID_V2, (st), (val), (i))
#define sk_ESS_CERT_ID_V2_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ESS_CERT_ID_V2, (st), (cmp))
#define sk_ESS_CERT_ID_V2_dup(st) SKM_sk_dup(ESS_CERT_ID_V2, st)
#define sk_ESS_CERT_ID_V2_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID_V2, (st), (free_func))
#define sk_ESS_CERT_ID_V2_shift(st) SKM_sk_shift(ESS_CERT_ID_V2, (st))
#define sk_ESS_CERT_ID_V2_pop(st) SKM_sk_pop(ESS_CERT_ID_V2, (st))
#define sk_ESS_CERT_ID_V2_sort(st) SKM_sk_sort(ESS_CERT_ID_V2, (st))
#define sk_ESS_CERT_ID_V2_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID_V2, (st))
#endif /* LIBRESSL_INTERNAL */

#define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp))
#define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD)
#define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st))
#define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st))
#define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i))
#define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val))
#define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st))
Changes to jni/libressl/include/openssl/ssl.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl.h,v 1.215 2021/11/01 08:14:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl.h,v 1.229 2022/09/11 17:39:46 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
356
357
358
359
360
361
362




363
364
365
366
367
368
369
 * 'struct ssl_st *' function parameters used to prototype callbacks
 * in SSL_CTX. */
typedef struct ssl_st *ssl_crock_st;

typedef struct ssl_method_st SSL_METHOD;
typedef struct ssl_cipher_st SSL_CIPHER;
typedef struct ssl_session_st SSL_SESSION;





DECLARE_STACK_OF(SSL_CIPHER)

/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
typedef struct srtp_protection_profile_st {
	const char *name;
	unsigned long id;







>
>
>
>







356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
 * 'struct ssl_st *' function parameters used to prototype callbacks
 * in SSL_CTX. */
typedef struct ssl_st *ssl_crock_st;

typedef struct ssl_method_st SSL_METHOD;
typedef struct ssl_cipher_st SSL_CIPHER;
typedef struct ssl_session_st SSL_SESSION;

#if defined(LIBRESSL_HAS_QUIC) || defined(LIBRESSL_INTERNAL)
typedef struct ssl_quic_method_st SSL_QUIC_METHOD;
#endif

DECLARE_STACK_OF(SSL_CIPHER)

/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
typedef struct srtp_protection_profile_st {
	const char *name;
	unsigned long id;
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834



835
836
837
838
839
840
841
#define SSL_AD_UNKNOWN_PSK_IDENTITY		115
#define SSL_AD_CERTIFICATE_REQUIRED		116
#define SSL_AD_NO_APPLICATION_PROTOCOL		120

/* Offset to get an SSL_R_... value from an SSL_AD_... value. */
#define SSL_AD_REASON_OFFSET			1000

#define SSL_ERROR_NONE			0
#define SSL_ERROR_SSL			1
#define SSL_ERROR_WANT_READ		2
#define SSL_ERROR_WANT_WRITE		3
#define SSL_ERROR_WANT_X509_LOOKUP	4
#define SSL_ERROR_SYSCALL		5 /* look at error stack/return value/errno */
#define SSL_ERROR_ZERO_RETURN		6
#define SSL_ERROR_WANT_CONNECT		7
#define SSL_ERROR_WANT_ACCEPT		8




#define SSL_CTRL_NEED_TMP_RSA			1
#define SSL_CTRL_SET_TMP_RSA			2
#define SSL_CTRL_SET_TMP_DH			3
#define SSL_CTRL_SET_TMP_ECDH			4
#define SSL_CTRL_SET_TMP_RSA_CB			5
#define SSL_CTRL_SET_TMP_DH_CB			6







|
|
|
|
|
|
|
|
|
>
>
>







823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
#define SSL_AD_UNKNOWN_PSK_IDENTITY		115
#define SSL_AD_CERTIFICATE_REQUIRED		116
#define SSL_AD_NO_APPLICATION_PROTOCOL		120

/* Offset to get an SSL_R_... value from an SSL_AD_... value. */
#define SSL_AD_REASON_OFFSET			1000

#define SSL_ERROR_NONE				0
#define SSL_ERROR_SSL				1
#define SSL_ERROR_WANT_READ			2
#define SSL_ERROR_WANT_WRITE			3
#define SSL_ERROR_WANT_X509_LOOKUP		4
#define SSL_ERROR_SYSCALL			5
#define SSL_ERROR_ZERO_RETURN			6
#define SSL_ERROR_WANT_CONNECT			7
#define SSL_ERROR_WANT_ACCEPT			8
#define SSL_ERROR_WANT_ASYNC			9
#define SSL_ERROR_WANT_ASYNC_JOB		10
#define SSL_ERROR_WANT_CLIENT_HELLO_CB		11

#define SSL_CTRL_NEED_TMP_RSA			1
#define SSL_CTRL_SET_TMP_RSA			2
#define SSL_CTRL_SET_TMP_DH			3
#define SSL_CTRL_SET_TMP_ECDH			4
#define SSL_CTRL_SET_TMP_RSA_CB			5
#define SSL_CTRL_SET_TMP_DH_CB			6
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS	83

#define	SSL_CTRL_CHAIN					88
#define	SSL_CTRL_CHAIN_CERT				89

#define SSL_CTRL_SET_GROUPS				91
#define SSL_CTRL_SET_GROUPS_LIST			92

#define SSL_CTRL_SET_ECDH_AUTO			94

#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
#define SSL_CTRL_GET_PEER_SIGNATURE_NID			108
#define SSL_CTRL_GET_PEER_TMP_KEY			109
#define SSL_CTRL_GET_SERVER_TMP_KEY SSL_CTRL_GET_PEER_TMP_KEY
#else
#define SSL_CTRL_GET_SERVER_TMP_KEY		109







|
|







933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS	83

#define	SSL_CTRL_CHAIN					88
#define	SSL_CTRL_CHAIN_CERT				89

#define SSL_CTRL_SET_GROUPS				91
#define SSL_CTRL_SET_GROUPS_LIST			92
#define SSL_CTRL_GET_SHARED_GROUP			93
#define SSL_CTRL_SET_ECDH_AUTO				94

#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
#define SSL_CTRL_GET_PEER_SIGNATURE_NID			108
#define SSL_CTRL_GET_PEER_TMP_KEY			109
#define SSL_CTRL_GET_SERVER_TMP_KEY SSL_CTRL_GET_PEER_TMP_KEY
#else
#define SSL_CTRL_GET_SERVER_TMP_KEY		109
1043
1044
1045
1046
1047
1048
1049




1050
1051
1052
1053
1054
1055
1056
#define SSL_CTX_get_extra_chain_certs(ctx, px509) \
	SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 0, px509)
#define SSL_CTX_get_extra_chain_certs_only(ctx, px509) \
	SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 1, px509)
#define SSL_CTX_clear_extra_chain_certs(ctx) \
	SSL_CTX_ctrl(ctx, SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS, 0, NULL)





#define SSL_get_server_tmp_key(s, pk) \
	SSL_ctrl(s,SSL_CTRL_GET_SERVER_TMP_KEY,0,pk)

#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
#define SSL_get_signature_nid(s, pn) \
	SSL_ctrl(s, SSL_CTRL_GET_SIGNATURE_NID, 0, pn)








>
>
>
>







1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
#define SSL_CTX_get_extra_chain_certs(ctx, px509) \
	SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 0, px509)
#define SSL_CTX_get_extra_chain_certs_only(ctx, px509) \
	SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 1, px509)
#define SSL_CTX_clear_extra_chain_certs(ctx) \
	SSL_CTX_ctrl(ctx, SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS, 0, NULL)

#define SSL_get_shared_group(s, n) \
	SSL_ctrl((s), SSL_CTRL_GET_SHARED_GROUP, (n), NULL)
#define SSL_get_shared_curve SSL_get_shared_group

#define SSL_get_server_tmp_key(s, pk) \
	SSL_ctrl(s,SSL_CTRL_GET_SERVER_TMP_KEY,0,pk)

#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
#define SSL_get_signature_nid(s, pn) \
	SSL_ctrl(s, SSL_CTRL_GET_SIGNATURE_NID, 0, pn)

1503
1504
1505
1506
1507
1508
1509










1510


1511

1512


















1513
























































































































































































































































1514
1515
1516
1517
1518
1519
1520
/* Pre-shared secret session resumption functions */
int SSL_set_session_secret_cb(SSL *s,
    tls_session_secret_cb_fn tls_session_secret_cb, void *arg);

void SSL_set_debug(SSL *s, int debug);
int SSL_cache_hit(SSL *s);











/* BEGIN ERROR CODES */


/* The following lines are auto generated by the script mkerr.pl. Any changes

 * made after this point may be overwritten when the script is next run.


















 */
























































































































































































































































void ERR_load_SSL_strings(void);

/* Error codes for the SSL functions. */

/* Function codes. */
#define SSL_F_CLIENT_CERTIFICATE			 100
#define SSL_F_CLIENT_FINISHED				 167







>
>
>
>
>
>
>
>
>
>
|
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
/* Pre-shared secret session resumption functions */
int SSL_set_session_secret_cb(SSL *s,
    tls_session_secret_cb_fn tls_session_secret_cb, void *arg);

void SSL_set_debug(SSL *s, int debug);
int SSL_cache_hit(SSL *s);

/* What the "other" parameter contains in security callback */
/* Mask for type */
#define SSL_SECOP_OTHER_TYPE		0xffff0000
#define SSL_SECOP_OTHER_NONE		0
#define SSL_SECOP_OTHER_CIPHER		(1 << 16)
#define SSL_SECOP_OTHER_CURVE		(2 << 16)
#define SSL_SECOP_OTHER_DH		(3 << 16)
#define SSL_SECOP_OTHER_PKEY		(4 << 16)
#define SSL_SECOP_OTHER_SIGALG		(5 << 16)
#define SSL_SECOP_OTHER_CERT		(6 << 16)

/* Indicated operation refers to peer key or certificate */
#define SSL_SECOP_PEER			0x1000

/* Values for "op" parameter in security callback */

/* Called to filter ciphers */
/* Ciphers client supports */
#define SSL_SECOP_CIPHER_SUPPORTED	(1 | SSL_SECOP_OTHER_CIPHER)
/* Cipher shared by client/server */
#define SSL_SECOP_CIPHER_SHARED		(2 | SSL_SECOP_OTHER_CIPHER)
/* Sanity check of cipher server selects */
#define SSL_SECOP_CIPHER_CHECK		(3 | SSL_SECOP_OTHER_CIPHER)
/* Curves supported by client */
#define SSL_SECOP_CURVE_SUPPORTED	(4 | SSL_SECOP_OTHER_CURVE)
/* Curves shared by client/server */
#define SSL_SECOP_CURVE_SHARED		(5 | SSL_SECOP_OTHER_CURVE)
/* Sanity check of curve server selects */
#define SSL_SECOP_CURVE_CHECK		(6 | SSL_SECOP_OTHER_CURVE)
/* Temporary DH key */
/*
 * XXX: changed in OpenSSL e2b420fdd70 to (7 | SSL_SECOP_OTHER_PKEY)
 * Needs switching internal use of DH to EVP_PKEY. The code is not reachable
 * from outside the library as long as we do not expose the callback in the API.
 */
#define SSL_SECOP_TMP_DH		(7 | SSL_SECOP_OTHER_DH)
/* SSL/TLS version */
#define SSL_SECOP_VERSION		(9 | SSL_SECOP_OTHER_NONE)
/* Session tickets */
#define SSL_SECOP_TICKET		(10 | SSL_SECOP_OTHER_NONE)
/* Supported signature algorithms sent to peer */
#define SSL_SECOP_SIGALG_SUPPORTED	(11 | SSL_SECOP_OTHER_SIGALG)
/* Shared signature algorithm */
#define SSL_SECOP_SIGALG_SHARED		(12 | SSL_SECOP_OTHER_SIGALG)
/* Sanity check signature algorithm allowed */
#define SSL_SECOP_SIGALG_CHECK		(13 | SSL_SECOP_OTHER_SIGALG)
/* Used to get mask of supported public key signature algorithms */
#define SSL_SECOP_SIGALG_MASK		(14 | SSL_SECOP_OTHER_SIGALG)
/* Use to see if compression is allowed */
#define SSL_SECOP_COMPRESSION		(15 | SSL_SECOP_OTHER_NONE)
/* EE key in certificate */
#define SSL_SECOP_EE_KEY		(16 | SSL_SECOP_OTHER_CERT)
/* CA key in certificate */
#define SSL_SECOP_CA_KEY		(17 | SSL_SECOP_OTHER_CERT)
/* CA digest algorithm in certificate */
#define SSL_SECOP_CA_MD			(18 | SSL_SECOP_OTHER_CERT)
/* Peer EE key in certificate */
#define SSL_SECOP_PEER_EE_KEY		(SSL_SECOP_EE_KEY | SSL_SECOP_PEER)
/* Peer CA key in certificate */
#define SSL_SECOP_PEER_CA_KEY		(SSL_SECOP_CA_KEY | SSL_SECOP_PEER)
/* Peer CA digest algorithm in certificate */
#define SSL_SECOP_PEER_CA_MD		(SSL_SECOP_CA_MD | SSL_SECOP_PEER)

void SSL_set_security_level(SSL *ssl, int level);
int SSL_get_security_level(const SSL *ssl);

void SSL_CTX_set_security_level(SSL_CTX *ctx, int level);
int SSL_CTX_get_security_level(const SSL_CTX *ctx);

#if defined(LIBRESSL_HAS_QUIC) || defined(LIBRESSL_INTERNAL)
/*
 * QUIC integration.
 *
 * QUIC acts as an underlying transport for the TLS 1.3 handshake. The following
 * functions allow a QUIC implementation to serve as the underlying transport as
 * described in RFC 9001.
 *
 * When configured for QUIC, |SSL_do_handshake| will drive the handshake as
 * before, but it will not use the configured |BIO|. It will call functions on
 * |SSL_QUIC_METHOD| to configure secrets and send data. If data is needed from
 * the peer, it will return |SSL_ERROR_WANT_READ|. As the caller receives data
 * it can decrypt, it calls |SSL_provide_quic_data|. Subsequent
 * |SSL_do_handshake| calls will then consume that data and progress the
 * handshake. After the handshake is complete, the caller should continue to
 * call |SSL_provide_quic_data| for any post-handshake data, followed by
 * |SSL_process_quic_post_handshake| to process it. It is an error to call
 * |SSL_peek|, |SSL_read| and |SSL_write| in QUIC.
 *
 * To avoid DoS attacks, the QUIC implementation must limit the amount of data
 * being queued up. The implementation can call
 * |SSL_quic_max_handshake_flight_len| to get the maximum buffer length at each
 * encryption level.
 *
 * QUIC implementations must additionally configure transport parameters with
 * |SSL_set_quic_transport_params|. |SSL_get_peer_quic_transport_params| may be
 * used to query the value received from the peer. This extension is handled
 * as an opaque byte string, which the caller is responsible for serializing
 * and parsing. See RFC 9000 section 7.4 for further details.
 */

/*
 * ssl_encryption_level_t specifies the QUIC encryption level used to transmit
 * handshake messages.
 */
typedef enum ssl_encryption_level_t {
	ssl_encryption_initial = 0,
	ssl_encryption_early_data,
	ssl_encryption_handshake,
	ssl_encryption_application,
} OSSL_ENCRYPTION_LEVEL;

/*
 * ssl_quic_method_st (aka |SSL_QUIC_METHOD|) describes custom QUIC hooks.
 *
 * Note that we provide both the new (BoringSSL) secrets interface
 * (set_read_secret/set_write_secret) along with the old interface
 * (set_encryption_secrets), which quictls is still using.
 *
 * Since some consumers fail to use named initialisers, the order of these
 * functions is important. Hopefully all of these consumers use the old version.
 */
struct ssl_quic_method_st {
	/*
	 * set_encryption_secrets configures the read and write secrets for the
	 * given encryption level. This function will always be called before an
	 * encryption level other than |ssl_encryption_initial| is used.
	 *
	 * When reading packets at a given level, the QUIC implementation must
	 * send ACKs at the same level, so this function provides read and write
	 * secrets together. The exception is |ssl_encryption_early_data|, where
	 * secrets are only available in the client to server direction. The
	 * other secret will be NULL. The server acknowledges such data at
	 * |ssl_encryption_application|, which will be configured in the same
	 * |SSL_do_handshake| call.
	 *
	 * This function should use |SSL_get_current_cipher| to determine the TLS
	 * cipher suite.
	 */
	int (*set_encryption_secrets)(SSL *ssl, enum ssl_encryption_level_t level,
	    const uint8_t *read_secret, const uint8_t *write_secret,
	    size_t secret_len);

	/*
	 * add_handshake_data adds handshake data to the current flight at the
	 * given encryption level. It returns one on success and zero on error.
	 * Callers should defer writing data to the network until |flush_flight|
	 * to better pack QUIC packets into transport datagrams.
	 *
	 * If |level| is not |ssl_encryption_initial|, this function will not be
	 * called before |level| is initialized with |set_write_secret|.
	 */
	int (*add_handshake_data)(SSL *ssl, enum ssl_encryption_level_t level,
	    const uint8_t *data, size_t len);

	/*
	 * flush_flight is called when the current flight is complete and should
	 * be written to the transport. Note a flight may contain data at
	 * several encryption levels. It returns one on success and zero on
	 * error.
	 */
	int (*flush_flight)(SSL *ssl);

	/*
	 * send_alert sends a fatal alert at the specified encryption level. It
	 * returns one on success and zero on error.
	 *
	 * If |level| is not |ssl_encryption_initial|, this function will not be
	 * called before |level| is initialized with |set_write_secret|.
	 */
	int (*send_alert)(SSL *ssl, enum ssl_encryption_level_t level,
	    uint8_t alert);

	/*
	 * set_read_secret configures the read secret and cipher suite for the
	 * given encryption level. It returns one on success and zero to
	 * terminate the handshake with an error. It will be called at most once
	 * per encryption level.
	 *
	 * Read keys will not be released before QUIC may use them. Once a level
	 * has been initialized, QUIC may begin processing data from it.
	 * Handshake data should be passed to |SSL_provide_quic_data| and
	 * application data (if |level| is |ssl_encryption_early_data| or
	 * |ssl_encryption_application|) may be processed according to the rules
	 * of the QUIC protocol.
	 */
	int (*set_read_secret)(SSL *ssl, enum ssl_encryption_level_t level,
	    const SSL_CIPHER *cipher, const uint8_t *secret, size_t secret_len);

	/*
	 * set_write_secret behaves like |set_read_secret| but configures the
	 * write secret and cipher suite for the given encryption level. It will
	 * be called at most once per encryption level.
	 *
	 * Write keys will not be released before QUIC may use them. If |level|
	 * is |ssl_encryption_early_data| or |ssl_encryption_application|, QUIC
	 * may begin sending application data at |level|.
	 */
	int (*set_write_secret)(SSL *ssl, enum ssl_encryption_level_t level,
	    const SSL_CIPHER *cipher, const uint8_t *secret, size_t secret_len);
};

/*
 * SSL_CTX_set_quic_method configures the QUIC hooks. This should only be
 * configured with a minimum version of TLS 1.3. |quic_method| must remain valid
 * for the lifetime of |ctx|. It returns one on success and zero on error.
 */
int SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method);

/*
 * SSL_set_quic_method configures the QUIC hooks. This should only be
 * configured with a minimum version of TLS 1.3. |quic_method| must remain valid
 * for the lifetime of |ssl|. It returns one on success and zero on error.
 */
int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method);

/* SSL_is_quic returns true if an SSL has been configured for use with QUIC. */
int SSL_is_quic(const SSL *ssl);

/*
 * SSL_quic_max_handshake_flight_len returns returns the maximum number of bytes
 * that may be received at the given encryption level. This function should be
 * used to limit buffering in the QUIC implementation. See RFC 9000 section 7.5.
 */
size_t SSL_quic_max_handshake_flight_len(const SSL *ssl,
    enum ssl_encryption_level_t level);

/*
 * SSL_quic_read_level returns the current read encryption level.
 */
enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl);

/*
 * SSL_quic_write_level returns the current write encryption level.
 */
enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl);

/*
 * SSL_provide_quic_data provides data from QUIC at a particular encryption
 * level |level|. It returns one on success and zero on error. Note this
 * function will return zero if the handshake is not expecting data from |level|
 * at this time. The QUIC implementation should then close the connection with
 * an error.
 */
int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level,
    const uint8_t *data, size_t len);

/*
 * SSL_process_quic_post_handshake processes any data that QUIC has provided
 * after the handshake has completed. This includes NewSessionTicket messages
 * sent by the server. It returns one on success and zero on error.
 */
int SSL_process_quic_post_handshake(SSL *ssl);

/*
 * SSL_set_quic_transport_params configures |ssl| to send |params| (of length
 * |params_len|) in the quic_transport_parameters extension in either the
 * ClientHello or EncryptedExtensions handshake message. It is an error to set
 * transport parameters if |ssl| is not configured for QUIC. The buffer pointed
 * to by |params| only need be valid for the duration of the call to this
 * function. This function returns 1 on success and 0 on failure.
 */
int SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params,
    size_t params_len);

/*
 * SSL_get_peer_quic_transport_params provides the caller with the value of the
 * quic_transport_parameters extension sent by the peer. A pointer to the buffer
 * containing the TransportParameters will be put in |*out_params|, and its
 * length in |*params_len|. This buffer will be valid for the lifetime of the
 * |SSL|. If no params were received from the peer, |*out_params_len| will be 0.
 */
void SSL_get_peer_quic_transport_params(const SSL *ssl,
    const uint8_t **out_params, size_t *out_params_len);

/*
 * SSL_set_quic_use_legacy_codepoint configures whether to use the legacy QUIC
 * extension codepoint 0xffa5 as opposed to the official value 57. This is
 * unsupported in LibreSSL.
 */
void SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy);

#endif

void ERR_load_SSL_strings(void);

/* Error codes for the SSL functions. */

/* Function codes. */
#define SSL_F_CLIENT_CERTIFICATE			 100
#define SSL_F_CLIENT_FINISHED				 167
1783
1784
1785
1786
1787
1788
1789


1790
1791
1792
1793
1794
1795
1796
#define SSL_R_BAD_STATE					 126
#define SSL_R_BAD_WRITE_RETRY				 127
#define SSL_R_BIO_NOT_SET				 128
#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG			 129
#define SSL_R_BN_LIB					 130
#define SSL_R_CA_DN_LENGTH_MISMATCH			 131
#define SSL_R_CA_DN_TOO_LONG				 132


#define SSL_R_CCS_RECEIVED_EARLY			 133
#define SSL_R_CERTIFICATE_VERIFY_FAILED			 134
#define SSL_R_CERT_LENGTH_MISMATCH			 135
#define SSL_R_CHALLENGE_IS_DIFFERENT			 136
#define SSL_R_CIPHER_CODE_WRONG_LENGTH			 137
#define SSL_R_CIPHER_COMPRESSION_UNAVAILABLE		 371
#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE		 138







>
>







2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
#define SSL_R_BAD_STATE					 126
#define SSL_R_BAD_WRITE_RETRY				 127
#define SSL_R_BIO_NOT_SET				 128
#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG			 129
#define SSL_R_BN_LIB					 130
#define SSL_R_CA_DN_LENGTH_MISMATCH			 131
#define SSL_R_CA_DN_TOO_LONG				 132
#define SSL_R_CA_KEY_TOO_SMALL				 397
#define SSL_R_CA_MD_TOO_WEAK				 398
#define SSL_R_CCS_RECEIVED_EARLY			 133
#define SSL_R_CERTIFICATE_VERIFY_FAILED			 134
#define SSL_R_CERT_LENGTH_MISMATCH			 135
#define SSL_R_CHALLENGE_IS_DIFFERENT			 136
#define SSL_R_CIPHER_CODE_WRONG_LENGTH			 137
#define SSL_R_CIPHER_COMPRESSION_UNAVAILABLE		 371
#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE		 138
1804
1805
1806
1807
1808
1809
1810

1811
1812
1813
1814
1815
1816
1817
1818
1819

1820
1821
1822
1823
1824
1825
1826
#define SSL_R_CONNECTION_ID_IS_DIFFERENT		 143
#define SSL_R_CONNECTION_TYPE_NOT_SET			 144
#define SSL_R_COOKIE_MISMATCH				 308
#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED		 145
#define SSL_R_DATA_LENGTH_TOO_LONG			 146
#define SSL_R_DECRYPTION_FAILED				 147
#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC	 281

#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG		 148
#define SSL_R_DIGEST_CHECK_FAILED			 149
#define SSL_R_DTLS_MESSAGE_TOO_BIG			 334
#define SSL_R_DUPLICATE_COMPRESSION_ID			 309
#define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT		 317
#define SSL_R_ECC_CERT_NOT_FOR_SIGNING			 318
#define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE	 322
#define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE	 323
#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER		 310

#define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST	 354
#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG			 150
#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY		 282
#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST		 151
#define SSL_R_EXCESSIVE_MESSAGE_SIZE			 152
#define SSL_R_EXTRA_DATA_IN_MESSAGE			 153
#define SSL_R_GOT_A_FIN_BEFORE_A_CCS			 154







>









>







2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
#define SSL_R_CONNECTION_ID_IS_DIFFERENT		 143
#define SSL_R_CONNECTION_TYPE_NOT_SET			 144
#define SSL_R_COOKIE_MISMATCH				 308
#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED		 145
#define SSL_R_DATA_LENGTH_TOO_LONG			 146
#define SSL_R_DECRYPTION_FAILED				 147
#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC	 281
#define SSL_R_DH_KEY_TOO_SMALL				 394
#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG		 148
#define SSL_R_DIGEST_CHECK_FAILED			 149
#define SSL_R_DTLS_MESSAGE_TOO_BIG			 334
#define SSL_R_DUPLICATE_COMPRESSION_ID			 309
#define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT		 317
#define SSL_R_ECC_CERT_NOT_FOR_SIGNING			 318
#define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE	 322
#define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE	 323
#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER		 310
#define SSL_R_EE_KEY_TOO_SMALL				 399
#define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST	 354
#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG			 150
#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY		 282
#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST		 151
#define SSL_R_EXCESSIVE_MESSAGE_SIZE			 152
#define SSL_R_EXTRA_DATA_IN_MESSAGE			 153
#define SSL_R_GOT_A_FIN_BEFORE_A_CCS			 154
2027
2028
2029
2030
2031
2032
2033

2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046


2047
2048
2049
2050
2051
2052
2053
#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM		 257
#define SSL_R_UNSUPPORTED_DIGEST_TYPE			 326
#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE		 315
#define SSL_R_UNSUPPORTED_PROTOCOL			 258
#define SSL_R_UNSUPPORTED_SSL_VERSION			 259
#define SSL_R_UNSUPPORTED_STATUS_TYPE			 329
#define SSL_R_USE_SRTP_NOT_NEGOTIATED			 369

#define SSL_R_WRITE_BIO_NOT_SET				 260
#define SSL_R_WRONG_CIPHER_RETURNED			 261
#define SSL_R_WRONG_CURVE				 378
#define SSL_R_WRONG_MESSAGE_TYPE			 262
#define SSL_R_WRONG_NUMBER_OF_KEY_BITS			 263
#define SSL_R_WRONG_SIGNATURE_LENGTH			 264
#define SSL_R_WRONG_SIGNATURE_SIZE			 265
#define SSL_R_WRONG_SIGNATURE_TYPE			 370
#define SSL_R_WRONG_SSL_VERSION				 266
#define SSL_R_WRONG_VERSION_NUMBER			 267
#define SSL_R_X509_LIB					 268
#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS		 269
#define SSL_R_PEER_BEHAVING_BADLY			 666


#define SSL_R_UNKNOWN					 999

/*
 * OpenSSL compatible OPENSSL_INIT options
 */

/*







>













>
>







2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM		 257
#define SSL_R_UNSUPPORTED_DIGEST_TYPE			 326
#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE		 315
#define SSL_R_UNSUPPORTED_PROTOCOL			 258
#define SSL_R_UNSUPPORTED_SSL_VERSION			 259
#define SSL_R_UNSUPPORTED_STATUS_TYPE			 329
#define SSL_R_USE_SRTP_NOT_NEGOTIATED			 369
#define SSL_R_VERSION_TOO_LOW				 396
#define SSL_R_WRITE_BIO_NOT_SET				 260
#define SSL_R_WRONG_CIPHER_RETURNED			 261
#define SSL_R_WRONG_CURVE				 378
#define SSL_R_WRONG_MESSAGE_TYPE			 262
#define SSL_R_WRONG_NUMBER_OF_KEY_BITS			 263
#define SSL_R_WRONG_SIGNATURE_LENGTH			 264
#define SSL_R_WRONG_SIGNATURE_SIZE			 265
#define SSL_R_WRONG_SIGNATURE_TYPE			 370
#define SSL_R_WRONG_SSL_VERSION				 266
#define SSL_R_WRONG_VERSION_NUMBER			 267
#define SSL_R_X509_LIB					 268
#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS		 269
#define SSL_R_PEER_BEHAVING_BADLY			 666
#define SSL_R_QUIC_INTERNAL_ERROR			 667
#define SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED		 668
#define SSL_R_UNKNOWN					 999

/*
 * OpenSSL compatible OPENSSL_INIT options
 */

/*
Changes to jni/libressl/include/openssl/tls1.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls1.h,v 1.51 2022/02/05 18:18:18 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls1.h,v 1.56 2022/07/17 14:39:09 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
154
155
156
157
158
159
160


161
162
163
164
165
166
167
#include <openssl/opensslconf.h>

#include <openssl/buffer.h>

#ifdef  __cplusplus
extern "C" {
#endif



#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES	0

#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
#define TLS1_3_VERSION			0x0304
#endif








>
>







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include <openssl/opensslconf.h>

#include <openssl/buffer.h>

#ifdef  __cplusplus
extern "C" {
#endif

#define OPENSSL_TLS_SECURITY_LEVEL 1

#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES	0

#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
#define TLS1_3_VERSION			0x0304
#endif

265
266
267
268
269
270
271





272
273
274
275
276
277
278
#define TLSEXT_TYPE_psk_key_exchange_modes	45
#define TLSEXT_TYPE_certificate_authorities	47
#define TLSEXT_TYPE_oid_filters			48
#define TLSEXT_TYPE_post_handshake_auth		49
#define TLSEXT_TYPE_signature_algorithms_cert	50
#define TLSEXT_TYPE_key_share			51
#endif






/*
 * TLS 1.3 extension names from OpenSSL, where they decided to use a different
 * name from that given in RFC 8446.
 */
#if defined(LIBRESSL_HAS_TLS1_3)
#define TLSEXT_TYPE_psk				TLSEXT_TYPE_pre_shared_key







>
>
>
>
>







267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#define TLSEXT_TYPE_psk_key_exchange_modes	45
#define TLSEXT_TYPE_certificate_authorities	47
#define TLSEXT_TYPE_oid_filters			48
#define TLSEXT_TYPE_post_handshake_auth		49
#define TLSEXT_TYPE_signature_algorithms_cert	50
#define TLSEXT_TYPE_key_share			51
#endif

/* ExtensionType value from RFC 9001 section 8.2 */
#if defined(LIBRESSL_HAS_QUIC) || defined(LIBRESSL_INTERNAL)
#define TLSEXT_TYPE_quic_transport_parameters	57
#endif

/*
 * TLS 1.3 extension names from OpenSSL, where they decided to use a different
 * name from that given in RFC 8446.
 */
#if defined(LIBRESSL_HAS_TLS1_3)
#define TLSEXT_TYPE_psk				TLSEXT_TYPE_pre_shared_key
Changes to jni/libressl/include/openssl/ts.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ts.h,v 1.10 2018/05/13 15:35:46 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL
 * project 2002, 2003, 2004.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ts.h,v 1.19 2022/09/11 17:31:19 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL
 * project 2002, 2003, 2004.
 */
/* ====================================================================
 * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

267
268
269
270
271
272
273
#ifdef  __cplusplus
extern "C" {
#endif

#include <openssl/x509.h>
#include <openssl/x509v3.h>

/*
MessageImprint ::= SEQUENCE  {
     hashAlgorithm                AlgorithmIdentifier,
     hashedMessage                OCTET STRING  }
*/

typedef struct TS_msg_imprint_st {
	X509_ALGOR *hash_algo;
	ASN1_OCTET_STRING *hashed_msg;
} TS_MSG_IMPRINT;

/*
TimeStampReq ::= SEQUENCE  {
   version                  INTEGER  { v1(1) },
   messageImprint           MessageImprint,
     --a hash algorithm OID and the hash value of the data to be
     --time-stamped
   reqPolicy                TSAPolicyId                OPTIONAL,
   nonce                    INTEGER                    OPTIONAL,
   certReq                  BOOLEAN                    DEFAULT FALSE,
   extensions               [0] IMPLICIT Extensions    OPTIONAL  }
*/

typedef struct TS_req_st {
	ASN1_INTEGER *version;
	TS_MSG_IMPRINT *msg_imprint;
	ASN1_OBJECT *policy_id;		/* OPTIONAL */
	ASN1_INTEGER *nonce;		/* OPTIONAL */
	ASN1_BOOLEAN cert_req;		/* DEFAULT FALSE */
	STACK_OF(X509_EXTENSION) *extensions;	/* [0] OPTIONAL */
} TS_REQ;

/*
Accuracy ::= SEQUENCE {
                seconds        INTEGER           OPTIONAL,
                millis     [0] INTEGER  (1..999) OPTIONAL,
                micros     [1] INTEGER  (1..999) OPTIONAL  }
*/

typedef struct TS_accuracy_st {
	ASN1_INTEGER *seconds;
	ASN1_INTEGER *millis;
	ASN1_INTEGER *micros;
} TS_ACCURACY;

/*
TSTInfo ::= SEQUENCE  {
    version                      INTEGER  { v1(1) },
    policy                       TSAPolicyId,
    messageImprint               MessageImprint,
      -- MUST have the same value as the similar field in
      -- TimeStampReq
    serialNumber                 INTEGER,
     -- Time-Stamping users MUST be ready to accommodate integers
     -- up to 160 bits.
    genTime                      GeneralizedTime,
    accuracy                     Accuracy                 OPTIONAL,
    ordering                     BOOLEAN             DEFAULT FALSE,
    nonce                        INTEGER                  OPTIONAL,
      -- MUST be present if the similar field was present
      -- in TimeStampReq.  In that case it MUST have the same value.
    tsa                          [0] GeneralName          OPTIONAL,
    extensions                   [1] IMPLICIT Extensions  OPTIONAL   }
*/

typedef struct TS_tst_info_st {
	ASN1_INTEGER *version;
	ASN1_OBJECT *policy_id;
	TS_MSG_IMPRINT *msg_imprint;
	ASN1_INTEGER *serial;
	ASN1_GENERALIZEDTIME *time;
	TS_ACCURACY *accuracy;
	ASN1_BOOLEAN ordering;
	ASN1_INTEGER *nonce;
	GENERAL_NAME *tsa;
	STACK_OF(X509_EXTENSION) *extensions;
} TS_TST_INFO;

/*
PKIStatusInfo ::= SEQUENCE {
    status        PKIStatus,
    statusString  PKIFreeText     OPTIONAL,
    failInfo      PKIFailureInfo  OPTIONAL  }

From RFC 1510 - section 3.1.1:
PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
	-- text encoded as UTF-8 String (note:  each UTF8String SHOULD
	-- include an RFC 1766 language tag to indicate the language
	-- of the contained text)
*/

/* Possible values for status. See ts_resp_print.c && ts_resp_verify.c. */

#define	TS_STATUS_GRANTED			0
#define	TS_STATUS_GRANTED_WITH_MODS		1
#define	TS_STATUS_REJECTION			2
#define	TS_STATUS_WAITING			3
#define	TS_STATUS_REVOCATION_WARNING		4
#define	TS_STATUS_REVOCATION_NOTIFICATION	5

/* Possible values for failure_info. See ts_resp_print.c && ts_resp_verify.c */

#define	TS_INFO_BAD_ALG			0
#define	TS_INFO_BAD_REQUEST		2
#define	TS_INFO_BAD_DATA_FORMAT		5
#define	TS_INFO_TIME_NOT_AVAILABLE	14
#define	TS_INFO_UNACCEPTED_POLICY	15
#define	TS_INFO_UNACCEPTED_EXTENSION	16
#define	TS_INFO_ADD_INFO_NOT_AVAILABLE	17
#define	TS_INFO_SYSTEM_FAILURE		25

typedef struct TS_status_info_st {
	ASN1_INTEGER *status;
	STACK_OF(ASN1_UTF8STRING) *text;
	ASN1_BIT_STRING *failure_info;
} TS_STATUS_INFO;

DECLARE_STACK_OF(ASN1_UTF8STRING)

/*
TimeStampResp ::= SEQUENCE  {
     status                  PKIStatusInfo,
     timeStampToken          TimeStampToken     OPTIONAL }
*/

typedef struct TS_resp_st {
	TS_STATUS_INFO *status_info;
	PKCS7 *token;
	TS_TST_INFO *tst_info;
} TS_RESP;

/* The structure below would belong to the ESS component. */

/*
IssuerSerial ::= SEQUENCE {
	issuer                   GeneralNames,
	serialNumber             CertificateSerialNumber
	}
*/

typedef struct ESS_issuer_serial {
	STACK_OF(GENERAL_NAME)	*issuer;
	ASN1_INTEGER		*serial;
} ESS_ISSUER_SERIAL;

/*
ESSCertID ::=  SEQUENCE {
        certHash                 Hash,
        issuerSerial             IssuerSerial OPTIONAL
}
*/

typedef struct ESS_cert_id {
	ASN1_OCTET_STRING *hash;	/* Always SHA-1 digest. */
	ESS_ISSUER_SERIAL *issuer_serial;
} ESS_CERT_ID;

DECLARE_STACK_OF(ESS_CERT_ID)

/*
SigningCertificate ::=  SEQUENCE {
       certs        SEQUENCE OF ESSCertID,
       policies     SEQUENCE OF PolicyInformation OPTIONAL
}
*/

typedef struct ESS_signing_cert {
	STACK_OF(ESS_CERT_ID) *cert_ids;
	STACK_OF(POLICYINFO) *policy_info;
} ESS_SIGNING_CERT;



TS_REQ	*TS_REQ_new(void);
void	TS_REQ_free(TS_REQ *a);
int	i2d_TS_REQ(const TS_REQ *a, unsigned char **pp);
TS_REQ	*d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);

TS_REQ	*TS_REQ_dup(TS_REQ *a);







<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
|
<







|
<









|
<
<
<
<



<
<
<
<
<
|
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
|
<
<
<

<
<
<
<
<
<
<
|
<
<
<
<
|

<
<
<
<
<
<
<
|
<
<
<

>







89
90
91
92
93
94
95






96
















97















98

























99











100













101

102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
117
118
119




120
121
122





123
124




125









126



127







128




129
130







131



132
133
134
135
136
137
138
139
140
#ifdef  __cplusplus
extern "C" {
#endif

#include <openssl/x509.h>
#include <openssl/x509v3.h>







typedef struct TS_msg_imprint_st TS_MSG_IMPRINT;
















typedef struct TS_req_st TS_REQ;















typedef struct TS_accuracy_st TS_ACCURACY;

























typedef struct TS_tst_info_st TS_TST_INFO;

























/* Possible values for status. */

#define	TS_STATUS_GRANTED			0
#define	TS_STATUS_GRANTED_WITH_MODS		1
#define	TS_STATUS_REJECTION			2
#define	TS_STATUS_WAITING			3
#define	TS_STATUS_REVOCATION_WARNING		4
#define	TS_STATUS_REVOCATION_NOTIFICATION	5

/* Possible values for failure_info. */

#define	TS_INFO_BAD_ALG			0
#define	TS_INFO_BAD_REQUEST		2
#define	TS_INFO_BAD_DATA_FORMAT		5
#define	TS_INFO_TIME_NOT_AVAILABLE	14
#define	TS_INFO_UNACCEPTED_POLICY	15
#define	TS_INFO_UNACCEPTED_EXTENSION	16
#define	TS_INFO_ADD_INFO_NOT_AVAILABLE	17
#define	TS_INFO_SYSTEM_FAILURE		25

typedef struct TS_status_info_st TS_STATUS_INFO;





DECLARE_STACK_OF(ASN1_UTF8STRING)






typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL;
typedef struct ESS_cert_id ESS_CERT_ID;




DECLARE_STACK_OF(ESS_CERT_ID)









typedef struct ESS_signing_cert ESS_SIGNING_CERT;











typedef struct ESS_cert_id_v2 ESS_CERT_ID_V2;




DECLARE_STACK_OF(ESS_CERT_ID_V2)








typedef struct ESS_signing_cert_v2 ESS_SIGNING_CERT_V2;




typedef struct TS_resp_st TS_RESP;

TS_REQ	*TS_REQ_new(void);
void	TS_REQ_free(TS_REQ *a);
int	i2d_TS_REQ(const TS_REQ *a, unsigned char **pp);
TS_REQ	*d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);

TS_REQ	*TS_REQ_dup(TS_REQ *a);
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
void		 ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
int		 i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a,
		    unsigned char **pp);
ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
		    const unsigned char **pp, long length);
ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);

void ERR_load_TS_strings(void);

int TS_REQ_set_version(TS_REQ *a, long version);
long TS_REQ_get_version(const TS_REQ *a);

int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint);
TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a);

int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg);







<
<







214
215
216
217
218
219
220


221
222
223
224
225
226
227
void		 ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
int		 i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a,
		    unsigned char **pp);
ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
		    const unsigned char **pp, long length);
ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);



int TS_REQ_set_version(TS_REQ *a, long version);
long TS_REQ_get_version(const TS_REQ *a);

int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint);
TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a);

int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg);
385
386
387
388
389
390
391
392
393
394
395






396
397
398
399
400
401
402
int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc);
void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx);

/* Function declarations for TS_REQ defined in ts/ts_req_print.c */

int TS_REQ_print_bio(BIO *bio, TS_REQ *a);

/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */

int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);
TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);







/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);
PKCS7 *TS_RESP_get_token(TS_RESP *a);
TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a);

int TS_TST_INFO_set_version(TS_TST_INFO *a, long version);







|



>
>
>
>
>
>







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc);
void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx);

/* Function declarations for TS_REQ defined in ts/ts_req_print.c */

int TS_REQ_print_bio(BIO *bio, TS_REQ *a);

/* Function declarations for TS_RESP defined in ts/ts_rsp_utils.c */

int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);
TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);

const ASN1_UTF8STRING *TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *si);
const STACK_OF(ASN1_UTF8STRING) *
    TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *si);
const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *si);
int TS_STATUS_INFO_set_status(TS_STATUS_INFO *si, int i);

/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);
PKCS7 *TS_RESP_get_token(TS_RESP *a);
TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a);

int TS_TST_INFO_set_version(TS_TST_INFO *a, long version);
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
    int lastpos);
int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos);
X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc);
X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc);
int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc);
void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx);

/* Declarations related to response generation, defined in ts/ts_resp_sign.c. */

/* Optional flags for response generation. */

/* Don't include the TSA name in response. */
#define	TS_TSA_NAME		0x01

/* Set ordering to true in response. */







|







314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
    int lastpos);
int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos);
X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc);
X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc);
int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc);
void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx);

/* Declarations related to response generation, defined in ts/ts_rsp_sign.c. */

/* Optional flags for response generation. */

/* Don't include the TSA name in response. */
#define	TS_TSA_NAME		0x01

/* Set ordering to true in response. */
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
/* This must process the given extension.
 * It can modify the TS_TST_INFO object of the context.
 * Return values: !0 (processed), 0 (error, it must set the
 * status info/failure info of the response).
 */
typedef	int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *);

typedef struct TS_resp_ctx {
	X509		*signer_cert;
	EVP_PKEY	*signer_key;
	STACK_OF(X509)	*certs;	/* Certs to include in signed data. */
	STACK_OF(ASN1_OBJECT)	*policies;	/* Acceptable policies. */
	ASN1_OBJECT	*default_policy; /* It may appear in policies, too. */
	STACK_OF(EVP_MD)	*mds;	/* Acceptable message digests. */
	ASN1_INTEGER	*seconds;	/* accuracy, 0 means not specified. */
	ASN1_INTEGER	*millis;	/* accuracy, 0 means not specified. */
	ASN1_INTEGER	*micros;	/* accuracy, 0 means not specified. */
	unsigned	clock_precision_digits; /* fraction of seconds in
						   time stamp token. */
	unsigned	flags;		/* Optional info, see values above. */

	/* Callback functions. */
	TS_serial_cb serial_cb;
	void *serial_cb_data;	/* User data for serial_cb. */

	TS_time_cb time_cb;
	void *time_cb_data;	/* User data for time_cb. */

	TS_extension_cb extension_cb;
	void *extension_cb_data;	/* User data for extension_cb. */

	/* These members are used only while creating the response. */
	TS_REQ		*request;
	TS_RESP		*response;
	TS_TST_INFO	*tst_info;
} TS_RESP_CTX;

DECLARE_STACK_OF(EVP_MD)

/* Creates a response context that can be used for generating responses. */
TS_RESP_CTX *TS_RESP_CTX_new(void);
void TS_RESP_CTX_free(TS_RESP_CTX *ctx);








|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







349
350
351
352
353
354
355
356




























357
358
359
360
361
362
363
/* This must process the given extension.
 * It can modify the TS_TST_INFO object of the context.
 * Return values: !0 (processed), 0 (error, it must set the
 * status info/failure info of the response).
 */
typedef	int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *);

typedef struct TS_resp_ctx TS_RESP_CTX;





























DECLARE_STACK_OF(EVP_MD)

/* Creates a response context that can be used for generating responses. */
TS_RESP_CTX *TS_RESP_CTX_new(void);
void TS_RESP_CTX_free(TS_RESP_CTX *ctx);

551
552
553
554
555
556
557



558
559
560
561
562
563
564

/* No flags are set by default. */
void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);

/* Default callback always returns a constant. */
void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data);




/* Default callback rejects all extensions. The extension callback is called
 * when the TS_TST_INFO object is already set up and not signed yet. */
/* FIXME: extension handling is not tested yet. */
void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx,
    TS_extension_cb cb, void *data);

/* The following methods can be used in the callbacks. */







>
>
>







394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410

/* No flags are set by default. */
void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);

/* Default callback always returns a constant. */
void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data);

/* Default callback uses gettimeofday() and gmtime(). */
void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data);

/* Default callback rejects all extensions. The extension callback is called
 * when the TS_TST_INFO object is already set up and not signed yet. */
/* FIXME: extension handling is not tested yet. */
void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx,
    TS_extension_cb cb, void *data);

/* The following methods can be used in the callbacks. */
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
 * In case of errors it sets the status info properly.
 * Returns NULL only in case of memory allocation/fatal error.
 */
TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio);

/*
 * Declarations related to response verification,
 * they are defined in ts/ts_resp_verify.c.
 */

int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,
    X509_STORE *store, X509 **signer_out);

/* Context structure for the generic verify method. */








|







427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
 * In case of errors it sets the status info properly.
 * Returns NULL only in case of memory allocation/fatal error.
 */
TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio);

/*
 * Declarations related to response verification,
 * they are defined in ts/ts_rsp_verify.c.
 */

int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,
    X509_STORE *store, X509 **signer_out);

/* Context structure for the generic verify method. */

625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672











673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
				 | TS_VFY_VERSION	\
				 | TS_VFY_POLICY	\
				 | TS_VFY_DATA		\
				 | TS_VFY_NONCE		\
				 | TS_VFY_SIGNER	\
				 | TS_VFY_TSA_NAME)

typedef struct TS_verify_ctx {
	/* Set this to the union of TS_VFY_... flags you want to carry out. */
	unsigned	flags;

	/* Must be set only with TS_VFY_SIGNATURE. certs is optional. */
	X509_STORE	*store;
	STACK_OF(X509)	*certs;

	/* Must be set only with TS_VFY_POLICY. */
	ASN1_OBJECT	*policy;

	/* Must be set only with TS_VFY_IMPRINT. If md_alg is NULL,
	   the algorithm from the response is used. */
	X509_ALGOR	*md_alg;
	unsigned char	*imprint;
	unsigned	imprint_len;

	/* Must be set only with TS_VFY_DATA. */
	BIO		*data;

	/* Must be set only with TS_VFY_TSA_NAME. */
	ASN1_INTEGER	*nonce;

	/* Must be set only with TS_VFY_TSA_NAME. */
	GENERAL_NAME	*tsa_name;
} TS_VERIFY_CTX;

int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);
int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);

/*
 * Declarations related to response verification context,
 * they are defined in ts/ts_verify_ctx.c.
 */

/* Set all fields to zero. */
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void);
void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);












/*
 * If ctx is NULL, it allocates and returns a new object, otherwise
 * it returns ctx. It initialises all the members as follows:
 * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE)
 * certs = NULL
 * store = NULL
 * policy = policy from the request or NULL if absent (in this case
 *	TS_VFY_POLICY is cleared from flags as well)
 * md_alg = MD algorithm from request
 * imprint, imprint_len = imprint from request
 * data = NULL
 * nonce, nonce_len = nonce from the request or NULL if absent (in this case
 * 	TS_VFY_NONCE is cleared from flags as well)
 * tsa_name = NULL
 * Important: after calling this method TS_VFY_SIGNATURE should be added!
 */
TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx);

/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */

int TS_RESP_print_bio(BIO *bio, TS_RESP *a);
int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a);
int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a);

/* Common utility functions defined in ts/ts_lib.c */








|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<















>
>
>
>
>
>
>
>
>
>
>












|





|







471
472
473
474
475
476
477
478

























479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
				 | TS_VFY_VERSION	\
				 | TS_VFY_POLICY	\
				 | TS_VFY_DATA		\
				 | TS_VFY_NONCE		\
				 | TS_VFY_SIGNER	\
				 | TS_VFY_TSA_NAME)

typedef struct TS_verify_ctx TS_VERIFY_CTX;


























int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);
int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);

/*
 * Declarations related to response verification context,
 * they are defined in ts/ts_verify_ctx.c.
 */

/* Set all fields to zero. */
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void);
void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);

int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int flags);
int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int flags);
BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *bio);
X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *store);
/* R$ special */
#define TS_VERIFY_CTS_set_certs TS_VERIFY_CTX_set_certs
STACK_OF(X509) *TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx,
    STACK_OF(X509) *certs);
unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
    unsigned char *imprint, long imprint_len);

/*
 * If ctx is NULL, it allocates and returns a new object, otherwise
 * it returns ctx. It initialises all the members as follows:
 * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE)
 * certs = NULL
 * store = NULL
 * policy = policy from the request or NULL if absent (in this case
 *	TS_VFY_POLICY is cleared from flags as well)
 * md_alg = MD algorithm from request
 * imprint, imprint_len = imprint from request
 * data = NULL
 * nonce, nonce_len = nonce from the request or NULL if absent (in this case
 *	TS_VFY_NONCE is cleared from flags as well)
 * tsa_name = NULL
 * Important: after calling this method TS_VFY_SIGNATURE should be added!
 */
TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx);

/* Function declarations for TS_RESP defined in ts/ts_rsp_print.c */

int TS_RESP_print_bio(BIO *bio, TS_RESP *a);
int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a);
int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a);

/* Common utility functions defined in ts/ts_lib.c */

728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
    TS_RESP_CTX *ctx);
int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx);
int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx);
int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,
    TS_RESP_CTX *ctx);

/* -------------------------------------------------- */
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_TS_strings(void);

/* Error codes for the TS functions. */

/* Function codes. */
#define TS_F_D2I_TS_RESP				 147
#define TS_F_DEF_SERIAL_CB				 110







<
<
<
<
<







560
561
562
563
564
565
566





567
568
569
570
571
572
573
int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
    TS_RESP_CTX *ctx);
int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx);
int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx);
int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,
    TS_RESP_CTX *ctx);






void ERR_load_TS_strings(void);

/* Error codes for the TS functions. */

/* Function codes. */
#define TS_F_D2I_TS_RESP				 147
#define TS_F_DEF_SERIAL_CB				 110
Changes to jni/libressl/include/openssl/ui.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ui.h,v 1.12 2020/09/24 19:20:32 tb Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
 * project 2001.
 */
/* ====================================================================
 * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ui.h,v 1.14 2022/07/12 18:43:56 jsing Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
 * project 2001.
 */
/* ====================================================================
 * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385

/* A couple of popular utility functions */
int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
    int verify);
int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,
    int verify);

/* BEGIN ERROR CODES */
/*
 * The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_UI_strings(void);

/* Error codes for the UI functions. */

/* Function codes. */
#define UI_F_GENERAL_ALLOCATE_BOOLEAN			 108
#define UI_F_GENERAL_ALLOCATE_PROMPT			 109







<
<
<
<
<







367
368
369
370
371
372
373





374
375
376
377
378
379
380

/* A couple of popular utility functions */
int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
    int verify);
int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,
    int verify);






void ERR_load_UI_strings(void);

/* Error codes for the UI functions. */

/* Function codes. */
#define UI_F_GENERAL_ALLOCATE_BOOLEAN			 108
#define UI_F_GENERAL_ALLOCATE_PROMPT			 109
Changes to jni/libressl/include/openssl/x509.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509.h,v 1.89 2022/01/10 14:13:03 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509.h,v 1.90 2022/07/12 14:42:50 kn Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
int X509_TRUST_get_flags(const X509_TRUST *xp);
char *X509_TRUST_get0_name(const X509_TRUST *xp);
int X509_TRUST_get_trust(const X509_TRUST *xp);

int X509_up_ref(X509 *x);
STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_X509_strings(void);

/* Error codes for the X509 functions. */

/* Function codes. */
#define X509_F_ADD_CERT_DIR				 100
#define X509_F_BY_FILE_CTRL				 101







<
<
<
<







1132
1133
1134
1135
1136
1137
1138




1139
1140
1141
1142
1143
1144
1145
int X509_TRUST_get_flags(const X509_TRUST *xp);
char *X509_TRUST_get0_name(const X509_TRUST *xp);
int X509_TRUST_get_trust(const X509_TRUST *xp);

int X509_up_ref(X509 *x);
STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain);





void ERR_load_X509_strings(void);

/* Error codes for the X509 functions. */

/* Function codes. */
#define X509_F_ADD_CERT_DIR				 100
#define X509_F_BY_FILE_CTRL				 101
Changes to jni/libressl/include/openssl/x509_vfy.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509_vfy.h,v 1.50 2022/01/14 07:53:45 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509_vfy.h,v 1.54 2022/07/07 13:01:28 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
201
202
203
204
205
206
207





208
209
210
211
212
213
214
#define		X509_V_ERR_IP_ADDRESS_MISMATCH			64

/* Caller error */
#define		X509_V_ERR_INVALID_CALL				65
/* Issuer lookup error */
#define		X509_V_ERR_STORE_LOOKUP				66






/* Certificate verify flags */

/* Send issuer+subject checks to verify_cb */
#define	X509_V_FLAG_CB_ISSUER_CHECK		0x1
/* Use check time instead of current time */
#define	X509_V_FLAG_USE_CHECK_TIME		0x2
/* Lookup CRLs */







>
>
>
>
>







201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#define		X509_V_ERR_IP_ADDRESS_MISMATCH			64

/* Caller error */
#define		X509_V_ERR_INVALID_CALL				65
/* Issuer lookup error */
#define		X509_V_ERR_STORE_LOOKUP				66

/* Security level errors */
#define		X509_V_ERR_EE_KEY_TOO_SMALL                     67
#define		X509_V_ERR_CA_KEY_TOO_SMALL                     68
#define		X509_V_ERR_CA_MD_TOO_WEAK                       69

/* Certificate verify flags */

/* Send issuer+subject checks to verify_cb */
#define	X509_V_FLAG_CB_ISSUER_CHECK		0x1
/* Use check time instead of current time */
#define	X509_V_FLAG_USE_CHECK_TIME		0x2
/* Lookup CRLs */
422
423
424
425
426
427
428


429
430
431
432
433
434
435
int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
							unsigned long flags);
unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);


void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
						ASN1_OBJECT *policy);
int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
					STACK_OF(ASN1_OBJECT) *policies);
int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, const char *name,







>
>







427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
							unsigned long flags);
unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level);
time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param);
void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
						ASN1_OBJECT *policy);
int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
					STACK_OF(ASN1_OBJECT) *policies);
int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, const char *name,
Changes to jni/libressl/include/openssl/x509v3.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: x509v3.h,v 1.14 2022/01/14 09:01:36 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/* $OpenBSD: x509v3.h,v 1.15 2022/07/12 14:42:50 kn Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project 1999.
 */
/* ====================================================================
 * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, ASIdentifiers *ext,
    int allow_inheritance);
int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, IPAddrBlocks *ext,
    int allow_inheritance);

#endif /* !OPENSSL_NO_RFC3779 */

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_X509V3_strings(void);

/* Error codes for the X509V3 functions. */

/* Function codes. */
#define X509V3_F_A2I_GENERAL_NAME			 164
#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE		 161







<
<
<
<







1032
1033
1034
1035
1036
1037
1038




1039
1040
1041
1042
1043
1044
1045
int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, ASIdentifiers *ext,
    int allow_inheritance);
int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, IPAddrBlocks *ext,
    int allow_inheritance);

#endif /* !OPENSSL_NO_RFC3779 */





void ERR_load_X509V3_strings(void);

/* Error codes for the X509V3 functions. */

/* Function codes. */
#define X509V3_F_A2I_GENERAL_NAME			 164
#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE		 161
Changes to jni/libressl/m4/check-libc.m4.
1
2
3
4
5
6
7
8
9
10
AC_DEFUN([CHECK_LIBC_COMPAT], [
# Check for libc headers
AC_CHECK_HEADERS([endian.h err.h readpassphrase.h])
AC_CHECK_HEADERS([netinet/ip.h], [], [],
[#include <sys/types.h>
#include <arpa/inet.h>
])
AC_HEADER_RESOLV
# Check for general libc functions
AC_CHECK_FUNCS([asprintf freezero memmem])


|







1
2
3
4
5
6
7
8
9
10
AC_DEFUN([CHECK_LIBC_COMPAT], [
# Check for libc headers
AC_CHECK_HEADERS([endian.h machine/endian.h err.h readpassphrase.h])
AC_CHECK_HEADERS([netinet/ip.h], [], [],
[#include <sys/types.h>
#include <arpa/inet.h>
])
AC_HEADER_RESOLV
# Check for general libc functions
AC_CHECK_FUNCS([asprintf freezero memmem])
Changes to jni/libressl/man/ASN1_INTEGER_get.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.\" $OpenBSD: ASN1_INTEGER_get.3,v 1.5 2021/11/23 13:52:27 schwarze Exp $
.\" selective merge up to:
.\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.\" $OpenBSD: ASN1_INTEGER_get.3,v 1.6 2022/07/09 13:13:34 schwarze Exp $
.\" selective merge up to:
.\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2018, 2021, 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
62
63
64
65
66
67
68
69
70
71
72


73


74
75
76
77
78

79

80
81
82
83
84
85










86
87
88
89










90
91
92
93
94
95
96
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: November 23 2021 $
.Dt ASN1_INTEGER_GET 3
.Os
.Sh NAME


.Nm ASN1_INTEGER_get ,


.Nm ASN1_INTEGER_set ,
.Nm ASN1_INTEGER_cmp ,
.Nm ASN1_INTEGER_dup ,
.Nm BN_to_ASN1_INTEGER ,
.Nm ASN1_INTEGER_to_BN ,

.Nm ASN1_ENUMERATED_get ,

.Nm ASN1_ENUMERATED_set ,
.Nm BN_to_ASN1_ENUMERATED ,
.Nm ASN1_ENUMERATED_to_BN
.Nd ASN.1 INTEGER and ENUMERATED utilities
.Sh SYNOPSIS
.In openssl/asn1.h










.Ft long
.Fo ASN1_INTEGER_get
.Fa "const ASN1_INTEGER *a"
.Fc










.Ft int
.Fo ASN1_INTEGER_set
.Fa "ASN1_INTEGER *a"
.Fa "long v"
.Fc
.Ft int
.Fo ASN1_INTEGER_cmp







|



>
>

>
>





>

>






>
>
>
>
>
>
>
>
>
>




>
>
>
>
>
>
>
>
>
>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 9 2022 $
.Dt ASN1_INTEGER_GET 3
.Os
.Sh NAME
.Nm ASN1_INTEGER_get_uint64 ,
.Nm ASN1_INTEGER_get_int64 ,
.Nm ASN1_INTEGER_get ,
.Nm ASN1_INTEGER_set_uint64 ,
.Nm ASN1_INTEGER_set_int64 ,
.Nm ASN1_INTEGER_set ,
.Nm ASN1_INTEGER_cmp ,
.Nm ASN1_INTEGER_dup ,
.Nm BN_to_ASN1_INTEGER ,
.Nm ASN1_INTEGER_to_BN ,
.Nm ASN1_ENUMERATED_get_int64 ,
.Nm ASN1_ENUMERATED_get ,
.Nm ASN1_ENUMERATED_set_int64 ,
.Nm ASN1_ENUMERATED_set ,
.Nm BN_to_ASN1_ENUMERATED ,
.Nm ASN1_ENUMERATED_to_BN
.Nd ASN.1 INTEGER and ENUMERATED utilities
.Sh SYNOPSIS
.In openssl/asn1.h
.Ft int
.Fo ASN1_INTEGER_get_uint64
.Fa "uint64_t *out_val"
.Fa "const ASN1_INTEGER *a"
.Fc
.Ft int
.Fo ASN1_INTEGER_get_int64
.Fa "int64_t *out_val"
.Fa "const ASN1_INTEGER *a"
.Fc
.Ft long
.Fo ASN1_INTEGER_get
.Fa "const ASN1_INTEGER *a"
.Fc
.Ft int
.Fo ASN1_INTEGER_set_uint64
.Fa "ASN1_INTEGER *a"
.Fa "uint64_t v"
.Fc
.Ft int
.Fo ASN1_INTEGER_set_int64
.Fa "ASN1_INTEGER *a"
.Fa "int64_t v";
.Fc
.Ft int
.Fo ASN1_INTEGER_set
.Fa "ASN1_INTEGER *a"
.Fa "long v"
.Fc
.Ft int
.Fo ASN1_INTEGER_cmp
107
108
109
110
111
112
113





114
115
116
117





118
119
120
121
122
123
124
.Fa "ASN1_INTEGER *ai"
.Fc
.Ft BIGNUM *
.Fo ASN1_INTEGER_to_BN
.Fa "const ASN1_INTEGER *ai"
.Fa "BIGNUM *bn"
.Fc





.Ft long
.Fo ASN1_ENUMERATED_get
.Fa "const ASN1_ENUMERATED *a"
.Fc





.Ft int
.Fo ASN1_ENUMERATED_set
.Fa "ASN1_ENUMERATED *a"
.Fa "long v"
.Fc
.Ft ASN1_ENUMERATED *
.Fo BN_to_ASN1_ENUMERATED







>
>
>
>
>




>
>
>
>
>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.Fa "ASN1_INTEGER *ai"
.Fc
.Ft BIGNUM *
.Fo ASN1_INTEGER_to_BN
.Fa "const ASN1_INTEGER *ai"
.Fa "BIGNUM *bn"
.Fc
.Ft int
.Fo ASN1_ENUMERATED_get_int64
.Fa "int64_t *out_val"
.Fa "const ASN1_ENUMERATED *a"
.Fc
.Ft long
.Fo ASN1_ENUMERATED_get
.Fa "const ASN1_ENUMERATED *a"
.Fc
.Ft int
.Fo ASN1_ENUMERATED_set_int64
.Fa "ASN1_ENUMERATED *a"
.Fa "int64_t v"
.Fc
.Ft int
.Fo ASN1_ENUMERATED_set
.Fa "ASN1_ENUMERATED *a"
.Fa "long v"
.Fc
.Ft ASN1_ENUMERATED *
.Fo BN_to_ASN1_ENUMERATED
133
134
135
136
137
138
139










140
141
142
143
144
145
146



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
.Sh DESCRIPTION
These functions convert to and from
.Vt ASN1_INTEGER
and
.Vt ASN1_ENUMERATED
objects.
.Pp










.Fn ASN1_INTEGER_get
converts
.Fa a
to the
.Vt long
type.
.Pp



.Fn ASN1_INTEGER_set
sets the type of
.Fa a
to
.Dv V_ASN1_INTEGER
or
.Dv V_ASN1_NEG_INTEGER
depending on the sign of
.Fa v
and sets the value of
.Fa a
to
.Fa v .
.Pp
.Fn ASN1_INTEGER_cmp
compares the signed integer numbers represented by
.Fa a1







>
>
>
>
>
>
>
>
>
>







>
>
>

|







|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
.Sh DESCRIPTION
These functions convert to and from
.Vt ASN1_INTEGER
and
.Vt ASN1_ENUMERATED
objects.
.Pp
.Fn ASN1_INTEGER_get_uint64
and
.Fn ASN1_INTEGER_get_int64
store the value of
.Fa a
in
.Pf * Fa out_val
if successful.
.Pp
The deprecated function
.Fn ASN1_INTEGER_get
converts
.Fa a
to the
.Vt long
type.
.Pp
.Fn ASN1_INTEGER_set_uint64 ,
.Fn ASN1_INTEGER_set_int64 ,
and
.Fn ASN1_INTEGER_set
set the type of
.Fa a
to
.Dv V_ASN1_INTEGER
or
.Dv V_ASN1_NEG_INTEGER
depending on the sign of
.Fa v
and set the value of
.Fa a
to
.Fa v .
.Pp
.Fn ASN1_INTEGER_cmp
compares the signed integer numbers represented by
.Fa a1
202
203
204
205
206
207
208

209

210
211
212
213
214
215
216
217
218
219




















220
221
222
223
224
225
226
227
228
229
230


231

232
233
234
235
236
237
238
a new
.Vt BIGNUM
object is returned.
Otherwise, the existing object
.Fa bn
is used instead.
.Pp

.Fn ASN1_ENUMERATED_get ,

.Fn ASN1_ENUMERATED_set ,
.Fn BN_to_ASN1_ENUMERATED ,
and
.Fn ASN1_ENUMERATED_to_BN
behave like their
.Vt ASN1_INTEGER
counterparts except that they operate on an
.Vt ASN1_ENUMERATED
object.
.Sh RETURN VALUES




















.Fn ASN1_INTEGER_get
and
.Fn ASN1_ENUMERATED_get
return the converted value, 0 if
.Fa a
is
.Dv NULL ,
or \-1 on error, which is ambiguous because \-1 is a legitimate
value for an
.Vt ASN1_INTEGER .
.Pp


.Fn ASN1_INTEGER_set

and
.Fn ASN1_ENUMERATED_set
return 1 for success or 0 for failure.
They only fail if a memory allocation error occurs.
.Pp
.Fn ASN1_INTEGER_cmp
returns a value greater than, equal to, or less than 0







>

>










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











>
>
|
>







251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
a new
.Vt BIGNUM
object is returned.
Otherwise, the existing object
.Fa bn
is used instead.
.Pp
.Fn ASN1_ENUMERATED_get_int64 ,
.Fn ASN1_ENUMERATED_get ,
.Fn ASN1_ENUMERATED_set_int64 ,
.Fn ASN1_ENUMERATED_set ,
.Fn BN_to_ASN1_ENUMERATED ,
and
.Fn ASN1_ENUMERATED_to_BN
behave like their
.Vt ASN1_INTEGER
counterparts except that they operate on an
.Vt ASN1_ENUMERATED
object.
.Sh RETURN VALUES
.Fn ASN1_INTEGER_get_uint64
returns 1 in case of success or 0 if
.Fa a
is not of the type
.Dv V_ASN1_INTEGER
or greater than
.Dv UINT64_MAX .
.Pp
.Fn ASN1_INTEGER_get_int64
returns 1 in case of success or 0 if
.Fa a
is not of the type
.Dv V_ASN1_INTEGER
or
.Dv V_ASN1_NEG_INTEGER ,
less than
.Dv INT64_MIN ,
or greater than
.Dv INT64_MAX .
.Pp
.Fn ASN1_INTEGER_get
and
.Fn ASN1_ENUMERATED_get
return the converted value, 0 if
.Fa a
is
.Dv NULL ,
or \-1 on error, which is ambiguous because \-1 is a legitimate
value for an
.Vt ASN1_INTEGER .
.Pp
.Fn ASN1_INTEGER_set_uint64 ,
.Fn ASN1_INTEGER_set_int64 ,
.Fn ASN1_INTEGER_set ,
.Fn ASN1_ENUMERATED_set_int64 ,
and
.Fn ASN1_ENUMERATED_set
return 1 for success or 0 for failure.
They only fail if a memory allocation error occurs.
.Pp
.Fn ASN1_INTEGER_cmp
returns a value greater than, equal to, or less than 0
299
300
301
302
303
304
305










306
307
308
309
310
311
312
.Fn ASN1_ENUMERATED_get ,
.Fn ASN1_ENUMERATED_set ,
.Fn BN_to_ASN1_ENUMERATED ,
and
.Fn ASN1_ENUMERATED_to_BN
first appeared in OpenSSL 0.9.2b and have been available since
.Ox 2.6 .










.Sh CAVEATS
In general an
.Vt ASN1_INTEGER
or
.Vt ASN1_ENUMERATED
type can contain an integer of almost arbitrary size
and so cannot always be represented by a C







>
>
>
>
>
>
>
>
>
>







373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
.Fn ASN1_ENUMERATED_get ,
.Fn ASN1_ENUMERATED_set ,
.Fn BN_to_ASN1_ENUMERATED ,
and
.Fn ASN1_ENUMERATED_to_BN
first appeared in OpenSSL 0.9.2b and have been available since
.Ox 2.6 .
.Pp
.Fn ASN1_INTEGER_get_uint64 ,
.Fn ASN1_INTEGER_get_int64 ,
.Fn ASN1_INTEGER_set_uint64 ,
.Fn ASN1_INTEGER_set_int64 ,
.Fn ASN1_ENUMERATED_get_int64 ,
and
.Fn ASN1_ENUMERATED_set_int64
first appeared in OpenSSL 1.1.0 and have been available since
.Ox 7.2 .
.Sh CAVEATS
In general an
.Vt ASN1_INTEGER
or
.Vt ASN1_ENUMERATED
type can contain an integer of almost arbitrary size
and so cannot always be represented by a C
Changes to jni/libressl/man/ASN1_item_d2i.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: ASN1_item_d2i.3,v 1.15 2021/11/28 14:32:34 schwarze Exp $
.\" selective merge up to:
.\" OpenSSL doc/man3/d2i_X509.pod 256989ce Jun 19 15:00:32 2020 +0200
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org>
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: ASN1_item_d2i.3,v 1.16 2022/04/27 08:06:37 tb Exp $
.\" selective merge up to:
.\" OpenSSL doc/man3/d2i_X509.pod 256989ce Jun 19 15:00:32 2020 +0200
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org>
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: November 28 2021 $
.Dt ASN1_ITEM_D2I 3
.Os
.Sh NAME
.Nm ASN1_item_d2i ,
.Nm ASN1_item_d2i_bio ,
.Nm ASN1_item_d2i_fp ,
.Nm d2i_ASN1_TYPE ,
.Nm ASN1_item_i2d ,
.Nm ASN1_item_i2d_bio ,
.Nm ASN1_item_i2d_fp ,
.Nm ASN1_item_ndef_i2d ,
.Nm i2d_ASN1_TYPE ,
.Nm ASN1_item_dup ,
.Nm ASN1_item_print
.Nd decode and encode ASN.1 objects
.\" The functions ASN1_check_infinite_end and ASN1_const_check_infinite_end
.\" are intentionally undocumented because they are trivial
.\" and usused in real-world software.
.Sh SYNOPSIS
.In openssl/asn1.h
.Ft ASN1_VALUE *
.Fo ASN1_item_d2i
.Fa "ASN1_VALUE **val_out"
.Fa "const unsigned char **der_in"
.Fa "long length"







|















<
<
<







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84



85
86
87
88
89
90
91
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: April 27 2022 $
.Dt ASN1_ITEM_D2I 3
.Os
.Sh NAME
.Nm ASN1_item_d2i ,
.Nm ASN1_item_d2i_bio ,
.Nm ASN1_item_d2i_fp ,
.Nm d2i_ASN1_TYPE ,
.Nm ASN1_item_i2d ,
.Nm ASN1_item_i2d_bio ,
.Nm ASN1_item_i2d_fp ,
.Nm ASN1_item_ndef_i2d ,
.Nm i2d_ASN1_TYPE ,
.Nm ASN1_item_dup ,
.Nm ASN1_item_print
.Nd decode and encode ASN.1 objects



.Sh SYNOPSIS
.In openssl/asn1.h
.Ft ASN1_VALUE *
.Fo ASN1_item_d2i
.Fa "ASN1_VALUE **val_out"
.Fa "const unsigned char **der_in"
.Fa "long length"
Changes to jni/libressl/man/ASN1_item_digest.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.\" $OpenBSD: ASN1_item_digest.3,v 1.1 2021/11/07 15:29:01 schwarze Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 7 2021 $
.Dt ASN1_ITEM_DIGEST 3
.Os
.Sh NAME
.Nm ASN1_item_digest
.Nd DER-encode and hash an ASN.1 value
.Sh SYNOPSIS
.In openssl/x509.h
.Ft int
.Fo ASN1_item_digest
.Fa "const ASN1_ITEM *it"
.Fa "const EVP_MD *type"
.Fa "void *val_in"
.Fa "unsigned char *md"
.Fa "unsigned int *s"
.Fc
.Sh DESCRIPTION
.Fn ASN1_item_digest
assumes that that
.Fa val_in
is an
.Vt ASN1_VALUE
of the type specified by
.Fa it ,
encodes it into DER format by calling
.Xr ASN1_item_i2d 3 ,
|















|

















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.\" $OpenBSD: ASN1_item_digest.3,v 1.2 2022/09/11 04:39:46 jsg Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 11 2022 $
.Dt ASN1_ITEM_DIGEST 3
.Os
.Sh NAME
.Nm ASN1_item_digest
.Nd DER-encode and hash an ASN.1 value
.Sh SYNOPSIS
.In openssl/x509.h
.Ft int
.Fo ASN1_item_digest
.Fa "const ASN1_ITEM *it"
.Fa "const EVP_MD *type"
.Fa "void *val_in"
.Fa "unsigned char *md"
.Fa "unsigned int *s"
.Fc
.Sh DESCRIPTION
.Fn ASN1_item_digest
assumes that
.Fa val_in
is an
.Vt ASN1_VALUE
of the type specified by
.Fa it ,
encodes it into DER format by calling
.Xr ASN1_item_i2d 3 ,
Changes to jni/libressl/man/BIO_ctrl.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: BIO_ctrl.3,v 1.15 2020/12/03 22:47:21 jmc Exp $
.\"	OpenSSL b055fceb Thu Oct 20 09:56:18 2016 +0100
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2000, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: BIO_ctrl.3,v 1.16 2022/08/18 18:42:13 tb Exp $
.\"	OpenSSL b055fceb Thu Oct 20 09:56:18 2016 +0100
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2000, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: December 3 2020 $
.Dt BIO_CTRL 3
.Os
.Sh NAME
.Nm BIO_ctrl ,
.Nm BIO_callback_ctrl ,
.Nm BIO_ptr_ctrl ,
.Nm BIO_int_ctrl ,
.Nm BIO_reset ,
.Nm BIO_seek ,
.Nm BIO_tell ,
.Nm BIO_flush ,
.Nm BIO_eof ,
.Nm BIO_set_close ,
.Nm BIO_get_close ,
.Nm BIO_pending ,
.Nm BIO_wpending ,
.Nm BIO_ctrl_pending ,
.Nm BIO_ctrl_wpending ,
.Nm BIO_get_info_callback ,
.Nm BIO_set_info_callback ,
.Nm bio_info_cb
.Nd BIO control operations
.Sh SYNOPSIS
.In openssl/bio.h
.Ft long
.Fo BIO_ctrl
.Fa "BIO *bp"
.Fa "int cmd"
.Fa "long larg"
.Fa "void *parg"
.Fc
.Ft long
.Fo BIO_callback_ctrl
.Fa "BIO *b"
.Fa "int cmd"
.Fa "bio_info_cb cb"
.Fc
.Ft char *
.Fo BIO_ptr_ctrl
.Fa "BIO *bp"
.Fa "int cmd"
.Fa "long larg"
.Fc







|




















|














|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: August 18 2022 $
.Dt BIO_CTRL 3
.Os
.Sh NAME
.Nm BIO_ctrl ,
.Nm BIO_callback_ctrl ,
.Nm BIO_ptr_ctrl ,
.Nm BIO_int_ctrl ,
.Nm BIO_reset ,
.Nm BIO_seek ,
.Nm BIO_tell ,
.Nm BIO_flush ,
.Nm BIO_eof ,
.Nm BIO_set_close ,
.Nm BIO_get_close ,
.Nm BIO_pending ,
.Nm BIO_wpending ,
.Nm BIO_ctrl_pending ,
.Nm BIO_ctrl_wpending ,
.Nm BIO_get_info_callback ,
.Nm BIO_set_info_callback ,
.Nm BIO_info_cb
.Nd BIO control operations
.Sh SYNOPSIS
.In openssl/bio.h
.Ft long
.Fo BIO_ctrl
.Fa "BIO *bp"
.Fa "int cmd"
.Fa "long larg"
.Fa "void *parg"
.Fc
.Ft long
.Fo BIO_callback_ctrl
.Fa "BIO *b"
.Fa "int cmd"
.Fa "BIO_info_cb cb"
.Fc
.Ft char *
.Fo BIO_ptr_ctrl
.Fa "BIO *bp"
.Fa "int cmd"
.Fa "long larg"
.Fc
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
.Ft size_t
.Fo BIO_ctrl_wpending
.Fa "BIO *b"
.Fc
.Ft int
.Fo BIO_get_info_callback
.Fa "BIO *b"
.Fa "bio_info_cb **cbp"
.Fc
.Ft int
.Fo BIO_set_info_callback
.Fa "BIO *b"
.Fa "bio_info_cb *cb"
.Fc
.Ft typedef void
.Fo bio_info_cb
.Fa "BIO *b"
.Fa "int oper"
.Fa "const char *ptr"
.Fa "int arg1"
.Fa "long arg2"
.Fa "long arg3"
.Fc
.Sh DESCRIPTION
.Fn BIO_ctrl ,
.Fn BIO_callback_ctrl ,
.Fn BIO_ptr_ctrl ,
and
.Fn BIO_int_ctrl







|




|

|
|

|
<
|
<
<







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161

162


163
164
165
166
167
168
169
.Ft size_t
.Fo BIO_ctrl_wpending
.Fa "BIO *b"
.Fc
.Ft int
.Fo BIO_get_info_callback
.Fa "BIO *b"
.Fa "BIO_info_cb **cbp"
.Fc
.Ft int
.Fo BIO_set_info_callback
.Fa "BIO *b"
.Fa "BIO_info_cb *cb"
.Fc
.Ft typedef int
.Fo BIO_info_cb
.Fa "BIO *b"
.Fa "int state"

.Fa "int res"


.Fc
.Sh DESCRIPTION
.Fn BIO_ctrl ,
.Fn BIO_callback_ctrl ,
.Fn BIO_ptr_ctrl ,
and
.Fn BIO_int_ctrl
Changes to jni/libressl/man/BN_new.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: BN_new.3,v 1.17 2021/12/08 21:52:29 schwarze Exp $
.\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000
.\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200
.\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 2000, 2004 The OpenSSL Project.  All rights reserved.
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: BN_new.3,v 1.18 2022/07/13 21:51:35 schwarze Exp $
.\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000
.\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200
.\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 2000, 2004 The OpenSSL Project.  All rights reserved.
.\"
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: December 8 2021 $
.Dt BN_NEW 3
.Os
.Sh NAME
.Nm BN_new ,
.Nm BN_init ,
.Nm BN_clear ,
.Nm BN_free ,







|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt BN_NEW 3
.Os
.Sh NAME
.Nm BN_new ,
.Nm BN_init ,
.Nm BN_clear ,
.Nm BN_free ,
156
157
158
159
160
161
162

163
164
165
166
167
168
169
.Xr BN_generate_prime 3 ,
.Xr BN_get0_nist_prime_521 3 ,
.Xr BN_mod_inverse 3 ,
.Xr BN_mod_mul_montgomery 3 ,
.Xr BN_mod_mul_reciprocal 3 ,
.Xr BN_num_bytes 3 ,
.Xr BN_rand 3 ,

.Xr BN_set_bit 3 ,
.Xr BN_set_flags 3 ,
.Xr BN_set_negative 3 ,
.Xr BN_swap 3 ,
.Xr BN_zero 3 ,
.Xr crypto 3 ,
.Xr get_rfc3526_prime_8192 3







>







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
.Xr BN_generate_prime 3 ,
.Xr BN_get0_nist_prime_521 3 ,
.Xr BN_mod_inverse 3 ,
.Xr BN_mod_mul_montgomery 3 ,
.Xr BN_mod_mul_reciprocal 3 ,
.Xr BN_num_bytes 3 ,
.Xr BN_rand 3 ,
.Xr BN_security_bits 3 ,
.Xr BN_set_bit 3 ,
.Xr BN_set_flags 3 ,
.Xr BN_set_negative 3 ,
.Xr BN_swap 3 ,
.Xr BN_zero 3 ,
.Xr crypto 3 ,
.Xr get_rfc3526_prime_8192 3
Changes to jni/libressl/man/BN_num_bytes.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: BN_num_bytes.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>
.\" and Richard Levitte <levitte@openssl.org>.
.\" Copyright (c) 2000, 2004 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: BN_num_bytes.3,v 1.8 2022/07/13 21:51:35 schwarze Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>
.\" and Richard Levitte <levitte@openssl.org>.
.\" Copyright (c) 2000, 2004 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 27 2018 $
.Dt BN_NUM_BYTES 3
.Os
.Sh NAME
.Nm BN_num_bytes ,
.Nm BN_num_bits ,
.Nm BN_num_bits_word
.Nd get BIGNUM size







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt BN_NUM_BYTES 3
.Os
.Sh NAME
.Nm BN_num_bytes ,
.Nm BN_num_bits ,
.Nm BN_num_bits_word
.Nd get BIGNUM size
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126
127
128
129
130
.Fn BN_num_bytes
and multiply with 8 (although there's no real guarantee that will match
the "key size", just a lot more probability).
.Sh RETURN VALUES
The size.
.Sh SEE ALSO
.Xr BN_new 3 ,

.Xr DH_size 3 ,
.Xr DSA_size 3 ,
.Xr RSA_size 3
.Sh HISTORY
.Fn BN_num_bytes
and
.Fn BN_num_bits
first appeared in SSLeay 0.5.1.
.Fn BN_num_bits_word
first appeared in SSLeay 0.5.2.
These functions have been available since
.Ox 2.4 .







>












112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.Fn BN_num_bytes
and multiply with 8 (although there's no real guarantee that will match
the "key size", just a lot more probability).
.Sh RETURN VALUES
The size.
.Sh SEE ALSO
.Xr BN_new 3 ,
.Xr BN_security_bits 3 ,
.Xr DH_size 3 ,
.Xr DSA_size 3 ,
.Xr RSA_size 3
.Sh HISTORY
.Fn BN_num_bytes
and
.Fn BN_num_bits
first appeared in SSLeay 0.5.1.
.Fn BN_num_bits_word
first appeared in SSLeay 0.5.2.
These functions have been available since
.Ox 2.4 .
Changes to jni/libressl/man/DH_generate_parameters.3.
1
2

3

















4

5
6
7
8
9
10
11
.\"	$OpenBSD: DH_generate_parameters.3,v 1.13 2019/06/10 14:58:48 schwarze Exp $
.\"	OpenSSL 05ea606a May 20 20:52:46 2016 -0400

.\"

















.\" This file was written by Ulf Moeller <ulf@openssl.org>.

.\" Copyright (c) 2000, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
|
|
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.\" $OpenBSD: DH_generate_parameters.3,v 1.14 2022/07/13 13:47:59 schwarze Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The original file was written by Ulf Moeller <ulf@openssl.org>
.\" and Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2000, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72






73
74
75
76
77
78
79
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 10 2019 $
.Dt DH_GENERATE_PARAMETERS 3
.Os
.Sh NAME
.Nm DH_generate_parameters_ex ,
.Nm DH_check ,

.Nm DH_generate_parameters
.Nd generate and check Diffie-Hellman parameters
.Sh SYNOPSIS
.In openssl/dh.h
.Ft int
.Fo DH_generate_parameters_ex
.Fa "DH *dh"
.Fa "int prime_len"
.Fa "int generator"
.Fa "BN_GENCB *cb"
.Fc
.Ft int
.Fo DH_check
.Fa "DH *dh"
.Fa "int *codes"
.Fc






.Pp
Deprecated:
.Pp
.Ft DH *
.Fo DH_generate_parameters
.Fa "int prime_len"
.Fa "int generator"







|





>
















>
>
>
>
>
>







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt DH_GENERATE_PARAMETERS 3
.Os
.Sh NAME
.Nm DH_generate_parameters_ex ,
.Nm DH_check ,
.Nm DH_check_pub_key ,
.Nm DH_generate_parameters
.Nd generate and check Diffie-Hellman parameters
.Sh SYNOPSIS
.In openssl/dh.h
.Ft int
.Fo DH_generate_parameters_ex
.Fa "DH *dh"
.Fa "int prime_len"
.Fa "int generator"
.Fa "BN_GENCB *cb"
.Fc
.Ft int
.Fo DH_check
.Fa "DH *dh"
.Fa "int *codes"
.Fc
.Ft int
.Fo DH_check_pub_key
.Fa "const DH *dh"
.Fa "const BIGNUM *pub_key"
.Fa "int *codes"
.Fc
.Pp
Deprecated:
.Pp
.Ft DH *
.Fo DH_generate_parameters
.Fa "int prime_len"
.Fa "int generator"
126
127
128
129
130
131
132



























133
134

135
136
137
138
139
140
141
142
143
144
.Fa dh->g
cannot be checked for suitability: it is neither 2 nor 5.
.It Dv DH_NOT_SUITABLE_GENERATOR
The generator
.Fa dh->g
is not suitable.
.El



























.Sh RETURN VALUES
.Fn DH_generate_parameters_ex

and
.Fn DH_check
return 1 if the check could be performed, or 0 otherwise.
.Pp
.Fn DH_generate_parameters
(deprecated) returns a pointer to the
.Vt DH
structure, or
.Dv NULL
if the parameter generation fails.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
>

|
|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
.Fa dh->g
cannot be checked for suitability: it is neither 2 nor 5.
.It Dv DH_NOT_SUITABLE_GENERATOR
The generator
.Fa dh->g
is not suitable.
.El
.Pp
.Fn DH_check_pub_key
checks whether
.Fa pub_key
is a valid public key when using the domain parameters contained in
.Fa dh .
If no problems are found,
.Pf * Ar codes
is set to zero.
Otherwise, one or more of the following bits are set:
.Bl -tag -width Ds
.It Dv DH_CHECK_PUBKEY_TOO_SMALL
.Fa pub_key
is less than or equal to 1.
.It Dv DH_CHECK_PUBKEY_TOO_LARGE
.Fa pub_key
is greater than or equal to
.Fa dh->p No \- 1 .
.It DH_CHECK_PUBKEY_INVALID
.Fa dh->q
is set but
.Fa pub_key
to the power of
.Fa dh->q
is not 1 modulo
.Fa dh->p .
.El
.Sh RETURN VALUES
.Fn DH_generate_parameters_ex ,
.Fn DH_check ,
and
.Fn DH_check_pub_key
return 1 if the check could be performed or 0 otherwise.
.Pp
.Fn DH_generate_parameters
(deprecated) returns a pointer to the
.Vt DH
structure, or
.Dv NULL
if the parameter generation fails.
157
158
159
160
161
162
163

164
165
166
167
168
169
170
171
172
173
174
.Pp
The
.Fa cb_arg
argument to
.Fn DH_generate_parameters
was added in SSLeay 0.9.0.
.Pp

In versions before OpenSSL 0.9.5,
.Dv DH_CHECK_P_NOT_STRONG_PRIME
is used instead of
.Dv DH_CHECK_P_NOT_SAFE_PRIME .
.Pp
.Fn DH_generate_parameters_ex
first appeared in OpenSSL 0.9.8 and has been available since
.Ox 4.5 .
.Sh CAVEATS
.Fn DH_generate_parameters_ex
and







>
|
<
|
<







211
212
213
214
215
216
217
218
219

220

221
222
223
224
225
226
227
.Pp
The
.Fa cb_arg
argument to
.Fn DH_generate_parameters
was added in SSLeay 0.9.0.
.Pp
.Fn DH_check_pub_key
first appeared in OpenSSL 0.9.8a and has been available since

.Ox 4.0 .

.Pp
.Fn DH_generate_parameters_ex
first appeared in OpenSSL 0.9.8 and has been available since
.Ox 4.5 .
.Sh CAVEATS
.Fn DH_generate_parameters_ex
and
Changes to jni/libressl/man/DH_get0_pqg.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: DH_get0_pqg.3,v 1.5 2018/12/21 21:54:48 schwarze Exp $
.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2016, 2018 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: DH_get0_pqg.3,v 1.6 2022/07/13 21:51:35 schwarze Exp $
.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2016, 2018 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: December 21 2018 $
.Dt DH_GET0_PQG 3
.Os
.Sh NAME
.Nm DH_get0_pqg ,
.Nm DH_set0_pqg ,
.Nm DH_get0_key ,
.Nm DH_set0_key ,







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt DH_GET0_PQG 3
.Os
.Sh NAME
.Nm DH_get0_pqg ,
.Nm DH_set0_pqg ,
.Nm DH_get0_key ,
.Nm DH_set0_key ,
261
262
263
264
265
266
267

268
269
270
271
272
273
or
.Dv NULL
if no engine was set for this object.
.Sh SEE ALSO
.Xr DH_generate_key 3 ,
.Xr DH_generate_parameters 3 ,
.Xr DH_new 3 ,

.Xr DH_size 3 ,
.Xr DHparams_print 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0
and have been available since
.Ox 6.3 .







>






261
262
263
264
265
266
267
268
269
270
271
272
273
274
or
.Dv NULL
if no engine was set for this object.
.Sh SEE ALSO
.Xr DH_generate_key 3 ,
.Xr DH_generate_parameters 3 ,
.Xr DH_new 3 ,
.Xr DH_security_bits 3 ,
.Xr DH_size 3 ,
.Xr DHparams_print 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0
and have been available since
.Ox 6.3 .
Changes to jni/libressl/man/DH_new.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: DH_new.3,v 1.11 2019/06/10 14:58:48 schwarze Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: DH_new.3,v 1.12 2022/07/13 21:51:35 schwarze Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 10 2019 $
.Dt DH_NEW 3
.Os
.Sh NAME
.Nm DH_new ,
.Nm DH_up_ref ,
.Nm DH_free
.Nd allocate and free DH objects







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt DH_NEW 3
.Os
.Sh NAME
.Nm DH_new ,
.Nm DH_up_ref ,
.Nm DH_free
.Nd allocate and free DH objects
110
111
112
113
114
115
116

117
118
119
120
121
122
123
.Xr BN_new 3 ,
.Xr crypto 3 ,
.Xr d2i_DHparams 3 ,
.Xr DH_generate_key 3 ,
.Xr DH_generate_parameters 3 ,
.Xr DH_get0_pqg 3 ,
.Xr DH_get_ex_new_index 3 ,

.Xr DH_set_method 3 ,
.Xr DH_size 3 ,
.Xr DHparams_print 3 ,
.Xr DSA_dup_DH 3 ,
.Xr EVP_PKEY_CTX_set_dh_paramgen_prime_len 3 ,
.Xr EVP_PKEY_set1_DH 3
.Sh HISTORY







>







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
.Xr BN_new 3 ,
.Xr crypto 3 ,
.Xr d2i_DHparams 3 ,
.Xr DH_generate_key 3 ,
.Xr DH_generate_parameters 3 ,
.Xr DH_get0_pqg 3 ,
.Xr DH_get_ex_new_index 3 ,
.Xr DH_security_bits 3 ,
.Xr DH_set_method 3 ,
.Xr DH_size 3 ,
.Xr DHparams_print 3 ,
.Xr DSA_dup_DH 3 ,
.Xr EVP_PKEY_CTX_set_dh_paramgen_prime_len 3 ,
.Xr EVP_PKEY_set1_DH 3
.Sh HISTORY
Changes to jni/libressl/man/DH_size.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: DH_size.3,v 1.9 2018/03/27 17:35:50 schwarze Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>
.\" and Kurt Roeckx <kurt@roeckx.be>.
.\" Copyright (c) 2000, 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: DH_size.3,v 1.10 2022/07/13 21:51:35 schwarze Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>
.\" and Kurt Roeckx <kurt@roeckx.be>.
.\" Copyright (c) 2000, 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 27 2018 $
.Dt DH_SIZE 3
.Os
.Sh NAME
.Nm DH_size ,
.Nm DH_bits
.Nd get Diffie-Hellman prime size
.Sh SYNOPSIS







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt DH_SIZE 3
.Os
.Sh NAME
.Nm DH_size ,
.Nm DH_bits
.Nd get Diffie-Hellman prime size
.Sh SYNOPSIS
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
.Fa dh->p
must not be
.Dv NULL .
.Sh SEE ALSO
.Xr BN_num_bytes 3 ,
.Xr DH_generate_key 3 ,
.Xr DH_get0_key 3 ,
.Xr DH_new 3

.Sh HISTORY
.Fn DH_size
first appeared in SSLeay 0.5.1 and has been available since
.Ox 2.4 .
.Pp
.Fn DH_bits
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 6.3 .







|
>








81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
.Fa dh->p
must not be
.Dv NULL .
.Sh SEE ALSO
.Xr BN_num_bytes 3 ,
.Xr DH_generate_key 3 ,
.Xr DH_get0_key 3 ,
.Xr DH_new 3 ,
.Xr DH_security_bits 3
.Sh HISTORY
.Fn DH_size
first appeared in SSLeay 0.5.1 and has been available since
.Ox 2.4 .
.Pp
.Fn DH_bits
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 6.3 .
Changes to jni/libressl/man/DSA_get0_pqg.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: DSA_get0_pqg.3,v 1.4 2018/03/23 23:18:17 schwarze Exp $
.\" full merge up to: OpenSSL e90fc053 Jul 15 09:39:45 2017 -0400
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: DSA_get0_pqg.3,v 1.5 2022/07/13 21:51:35 schwarze Exp $
.\" full merge up to: OpenSSL e90fc053 Jul 15 09:39:45 2017 -0400
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 23 2018 $
.Dt DSA_GET0_PQG 3
.Os
.Sh NAME
.Nm DSA_get0_pqg ,
.Nm DSA_set0_pqg ,
.Nm DSA_get0_key ,
.Nm DSA_set0_key ,







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt DSA_GET0_PQG 3
.Os
.Sh NAME
.Nm DSA_get0_pqg ,
.Nm DSA_set0_pqg ,
.Nm DSA_get0_key ,
.Nm DSA_set0_key ,
240
241
242
243
244
245
246

247
248
249
250
251
252
.Sh SEE ALSO
.Xr DSA_do_sign 3 ,
.Xr DSA_dup_DH 3 ,
.Xr DSA_generate_key 3 ,
.Xr DSA_generate_parameters 3 ,
.Xr DSA_new 3 ,
.Xr DSA_print 3 ,

.Xr DSA_sign 3 ,
.Xr DSA_size 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0
and have been available since
.Ox 6.3 .







>






240
241
242
243
244
245
246
247
248
249
250
251
252
253
.Sh SEE ALSO
.Xr DSA_do_sign 3 ,
.Xr DSA_dup_DH 3 ,
.Xr DSA_generate_key 3 ,
.Xr DSA_generate_parameters 3 ,
.Xr DSA_new 3 ,
.Xr DSA_print 3 ,
.Xr DSA_security_bits 3 ,
.Xr DSA_sign 3 ,
.Xr DSA_size 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0
and have been available since
.Ox 6.3 .
Changes to jni/libressl/man/DSA_meth_new.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
.\" $OpenBSD: DSA_meth_new.3,v 1.2 2022/01/15 23:38:50 jsg Exp $
.\" selective merge up to: OpenSSL a970b14f Jul 31 18:58:40 2017 -0400
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
.\" $OpenBSD: DSA_meth_new.3,v 1.3 2022/07/10 13:41:59 schwarze Exp $
.\" selective merge up to: OpenSSL c4d3c19b Apr 3 13:57:12 2018 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2018, 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
61
62
63
64
65
66
67
68
69
70
71
72
73
74


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92









93
94
95
96
97
98
99
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: January 15 2022 $
.Dt DSA_METH_NEW 3
.Os
.Sh NAME
.Nm DSA_meth_new ,
.Nm DSA_meth_free ,
.Nm DSA_meth_dup ,


.Nm DSA_meth_set_sign ,
.Nm DSA_meth_set_finish
.Nd build up DSA methods
.Sh SYNOPSIS
.In openssl/dsa.h
.Ft DSA_METHOD *
.Fo DSA_meth_new
.Fa "const char *name"
.Fa "int flags"
.Fc
.Ft void
.Fo DSA_meth_free
.Fa "DSA_METHOD *meth"
.Fc
.Ft DSA_METHOD *
.Fo DSA_meth_dup
.Fa "const DSA_METHOD *meth"
.Fc









.Ft int
.Fo DSA_meth_set_sign
.Fa "DSA_METHOD *meth"
.Fa "DSA_SIG *(*sign)(const unsigned char *, int, DSA *)"
.Fc
.Ft int
.Fo DSA_meth_set_finish







|






>
>


















>
>
>
>
>
>
>
>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 10 2022 $
.Dt DSA_METH_NEW 3
.Os
.Sh NAME
.Nm DSA_meth_new ,
.Nm DSA_meth_free ,
.Nm DSA_meth_dup ,
.Nm DSA_meth_get0_name ,
.Nm DSA_meth_set1_name ,
.Nm DSA_meth_set_sign ,
.Nm DSA_meth_set_finish
.Nd build up DSA methods
.Sh SYNOPSIS
.In openssl/dsa.h
.Ft DSA_METHOD *
.Fo DSA_meth_new
.Fa "const char *name"
.Fa "int flags"
.Fc
.Ft void
.Fo DSA_meth_free
.Fa "DSA_METHOD *meth"
.Fc
.Ft DSA_METHOD *
.Fo DSA_meth_dup
.Fa "const DSA_METHOD *meth"
.Fc
.Ft const char *
.Fo DSA_meth_get0_name
.Fa "const DSA_METHOD *meth"
.Fc
.Ft int
.Fo DSA_meth_set1_name
.Fa "DSA_METHOD *meth"
.Fa "const char *name"
.Fc
.Ft int
.Fo DSA_meth_set_sign
.Fa "DSA_METHOD *meth"
.Fa "DSA_SIG *(*sign)(const unsigned char *, int, DSA *)"
.Fc
.Ft int
.Fo DSA_meth_set_finish
130
131
132
133
134
135
136












137
138
139
140
141
142
143
based on an existing one, but with some differences.
.Pp
.Fn DSA_meth_free
destroys
.Fa meth
and frees any memory associated with it.
.Pp












.Fn DSA_meth_set_sign
sets the function used for creating a DSA signature.
This function will be called from
.Xr DSA_do_sign 3
and indirectly from
.Xr DSA_sign 3 .
The parameters of







>
>
>
>
>
>
>
>
>
>
>
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
based on an existing one, but with some differences.
.Pp
.Fn DSA_meth_free
destroys
.Fa meth
and frees any memory associated with it.
.Pp
.Fn DSA_meth_get0_name
returns an internal pointer to the name of
.Fa meth .
.Fn DSA_meth_set1_name
stores a copy of the NUL-terminated
.Fa name
in
.Fa meth
after freeing the previously stored name.
Method names are ignored by the default DSA implementation but can be
used by alternative implementations and by the application program.
.Pp
.Fn DSA_meth_set_sign
sets the function used for creating a DSA signature.
This function will be called from
.Xr DSA_do_sign 3
and indirectly from
.Xr DSA_sign 3 .
The parameters of
162
163
164
165
166
167
168
169




170




171
172
173



174
175
176
177
178
179
180
181







182
183






object itself should not be freed by the
.Fa finish
function.
.Sh RETURN VALUES
.Fn DSA_meth_new
and
.Fn DSA_meth_dup
return the newly allocated DSA_METHOD object or NULL on failure.




.Pp




All
.Fn DSA_meth_set_*
functions return 1 on success or 0 on failure.



.Sh SEE ALSO
.Xr DSA_do_sign 3 ,
.Xr DSA_new 3 ,
.Xr DSA_set_method 3 ,
.Xr DSA_SIG_new 3 ,
.Xr DSA_sign 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0







and have been available since
.Ox 6.3 .













|
>
>
>
>

>
>
>
>
|


>
>
>







|
>
>
>
>
>
>
>
|

>
>
>
>
>
>
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
object itself should not be freed by the
.Fa finish
function.
.Sh RETURN VALUES
.Fn DSA_meth_new
and
.Fn DSA_meth_dup
return the newly allocated
.Vt DSA_METHOD
object or
.Dv NULL
on failure.
.Pp
.Fn DSA_meth_get0_name
returns an internal pointer which must not be freed by the caller.
.Pp
.Fn DSA_meth_set1_name
and all
.Fn DSA_meth_set_*
functions return 1 on success or 0 on failure.
In the current implementation, only
.Fn DSA_meth_set1_name
can actually fail.
.Sh SEE ALSO
.Xr DSA_do_sign 3 ,
.Xr DSA_new 3 ,
.Xr DSA_set_method 3 ,
.Xr DSA_SIG_new 3 ,
.Xr DSA_sign 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0.
.Pp
.Fn DSA_meth_new ,
.Fn DSA_meth_free ,
.Fn DSA_meth_dup ,
.Fn DSA_meth_set_sign ,
and
.Fn DSA_meth_set_finish
have been available since
.Ox 6.3 .
.Pp
.Fn DSA_meth_get0_name
and
.Fn DSA_meth_set1_name
have been available since
.Ox 7.2 .
Changes to jni/libressl/man/DSA_new.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: DSA_new.3,v 1.12 2019/06/10 14:58:48 schwarze Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 2000, 2002 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: DSA_new.3,v 1.13 2022/07/13 21:51:35 schwarze Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 2000, 2002 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 10 2019 $
.Dt DSA_NEW 3
.Os
.Sh NAME
.Nm DSA_new ,
.Nm DSA_up_ref ,
.Nm DSA_free
.Nd allocate and free DSA objects







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt DSA_NEW 3
.Os
.Sh NAME
.Nm DSA_new ,
.Nm DSA_up_ref ,
.Nm DSA_free
.Nd allocate and free DSA objects
115
116
117
118
119
120
121

122
123
124
125
126
127
128
.Xr DSA_dup_DH 3 ,
.Xr DSA_generate_key 3 ,
.Xr DSA_generate_parameters 3 ,
.Xr DSA_get0_pqg 3 ,
.Xr DSA_get_ex_new_index 3 ,
.Xr DSA_meth_new 3 ,
.Xr DSA_print 3 ,

.Xr DSA_set_method 3 ,
.Xr DSA_SIG_new 3 ,
.Xr DSA_sign 3 ,
.Xr DSA_size 3 ,
.Xr EVP_PKEY_set1_DSA 3 ,
.Xr RSA_new 3
.Sh STANDARDS







>







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
.Xr DSA_dup_DH 3 ,
.Xr DSA_generate_key 3 ,
.Xr DSA_generate_parameters 3 ,
.Xr DSA_get0_pqg 3 ,
.Xr DSA_get_ex_new_index 3 ,
.Xr DSA_meth_new 3 ,
.Xr DSA_print 3 ,
.Xr DSA_security_bits 3 ,
.Xr DSA_set_method 3 ,
.Xr DSA_SIG_new 3 ,
.Xr DSA_sign 3 ,
.Xr DSA_size 3 ,
.Xr EVP_PKEY_set1_DSA 3 ,
.Xr RSA_new 3
.Sh STANDARDS
Changes to jni/libressl/man/DSA_size.3.
1
2
3

















4

5
6
7
8
9
10
11
12
.\"	$OpenBSD: DSA_size.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $
.\"	OpenSSL 05ea606a May 20 20:52:46 2016 -0400
.\"

















.\" This file was written by Ulf Moeller <ulf@openssl.org>.

.\" Copyright (c) 2000, 2002 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
|
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.\" $OpenBSD: DSA_size.3,v 1.8 2022/07/13 21:44:23 schwarze Exp $
.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The original file was written by Ulf Moeller <ulf@openssl.org>
.\" and Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2000, 2002, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
44
45
46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62




63

64

65
66
67
68
69
70
71







72
73




74
75
76

77
78
79
80
81




.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 27 2018 $
.Dt DSA_SIZE 3
.Os
.Sh NAME
.Nm DSA_size

.Nd get DSA signature size
.Sh SYNOPSIS
.In openssl/dsa.h
.Ft int
.Fo DSA_size
.Fa "const DSA *dsa"
.Fc




.Sh DESCRIPTION

This function returns the size of an ASN.1 encoded DSA signature in

bytes.
It can be used to determine how much memory must be allocated for a DSA
signature.
.Pp
.Fa dsa->q
must not be
.Dv NULL .







.Sh RETURN VALUES
The size in bytes.




.Sh SEE ALSO
.Xr DSA_get0_pqg 3 ,
.Xr DSA_new 3 ,

.Xr DSA_sign 3
.Sh HISTORY
.Fn DSA_size
first appeared in SSLeay 0.6.0 and has been available since
.Ox 2.4 .











|



|
>
|






>
>
>
>

>
|
>
|






>
>
>
>
>
>
>

|
>
>
>
>



>





>
>
>
>
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt DSA_SIZE 3
.Os
.Sh NAME
.Nm DSA_size ,
.Nm DSA_bits
.Nd get DSA signature or key size
.Sh SYNOPSIS
.In openssl/dsa.h
.Ft int
.Fo DSA_size
.Fa "const DSA *dsa"
.Fc
.Ft int
.Fo DSA_bits
.Fa "const DSA *dsa"
.Fc
.Sh DESCRIPTION
.Fn DSA_size
returns the maximum size of an ASN.1 encoded DSA signature for the key
.Fa dsa
in bytes.
It can be used to determine how much memory must be allocated for a DSA
signature.
.Pp
.Fa dsa->q
must not be
.Dv NULL .
.Pp
.Fn DSA_bits
returns the number of significant bits in the public domain parameter
.Fa p
contained in
.Fa dsa .
This is also the number of bits in the public key.
.Sh RETURN VALUES
.Fn DSA_size
returns the size of the signature in bytes.
.Pp
.Fn DSA_bits
returns the size of the public key in bits.
.Sh SEE ALSO
.Xr DSA_get0_pqg 3 ,
.Xr DSA_new 3 ,
.Xr DSA_security_bits 3 ,
.Xr DSA_sign 3
.Sh HISTORY
.Fn DSA_size
first appeared in SSLeay 0.6.0 and has been available since
.Ox 2.4 .
.Pp
.Fn DSA_bits
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 7.1 .
Changes to jni/libressl/man/EC_GFp_simple_method.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: EC_GFp_simple_method.3,v 1.9 2018/03/23 05:48:56 schwarze Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2013 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: EC_GFp_simple_method.3,v 1.10 2022/07/02 17:09:09 jsing Exp $
.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2013 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 23 2018 $
.Dt EC_GFP_SIMPLE_METHOD 3
.Os
.Sh NAME
.Nm EC_GFp_simple_method ,
.Nm EC_GFp_mont_method ,
.Nm EC_GFp_nist_method ,
.Nm EC_GFp_nistp224_method ,







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 2 2022 $
.Dt EC_GFP_SIMPLE_METHOD 3
.Os
.Sh NAME
.Nm EC_GFp_simple_method ,
.Nm EC_GFp_mont_method ,
.Nm EC_GFp_nist_method ,
.Nm EC_GFp_nistp224_method ,
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
If the field type is Fp, then the value
.Dv NID_X9_62_prime_field
is returned.
If the field type is F2^m, then the value
.Dv NID_X9_62_characteristic_two_field
is returned.
These values are defined in the
.In openssl/obj_mac.h
header file.
.Sh RETURN VALUES
All
.Fn EC_GFp*
functions and
.Fn EC_GF2m_simple_method
always return a const pointer to an







|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
If the field type is Fp, then the value
.Dv NID_X9_62_prime_field
is returned.
If the field type is F2^m, then the value
.Dv NID_X9_62_characteristic_two_field
is returned.
These values are defined in the
.In openssl/objects.h
header file.
.Sh RETURN VALUES
All
.Fn EC_GFp*
functions and
.Fn EC_GF2m_simple_method
always return a const pointer to an
Changes to jni/libressl/man/EC_GROUP_copy.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: EC_GROUP_copy.3,v 1.12 2021/09/14 13:47:59 schwarze Exp $
.\" full merge up to: OpenSSL d900a015 Oct 8 14:40:42 2015 +0200
.\" selective merge up to: OpenSSL 24c23e1f Aug 22 10:51:25 2019 +0530
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>,
.\" Dr. Stephen Henson <steve@openssl.org>,
.\" and Jayaram X Matta <jayaramx.matta@intel.com>.
.\" Copyright (c) 2013, 2015, 2019 The OpenSSL Project.  All rights reserved.
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: EC_GROUP_copy.3,v 1.13 2022/07/02 17:09:09 jsing Exp $
.\" full merge up to: OpenSSL d900a015 Oct 8 14:40:42 2015 +0200
.\" selective merge up to: OpenSSL 24c23e1f Aug 22 10:51:25 2019 +0530
.\"
.\" This file was written by Matt Caswell <matt@openssl.org>,
.\" Dr. Stephen Henson <steve@openssl.org>,
.\" and Jayaram X Matta <jayaramx.matta@intel.com>.
.\" Copyright (c) 2013, 2015, 2019 The OpenSSL Project.  All rights reserved.
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 14 2021 $
.Dt EC_GROUP_COPY 3
.Os
.Sh NAME
.Nm EC_GROUP_copy ,
.Nm EC_GROUP_dup ,
.Nm EC_GROUP_method_of ,
.Nm EC_GROUP_set_generator ,







|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 2 2022 $
.Dt EC_GROUP_COPY 3
.Os
.Sh NAME
.Nm EC_GROUP_copy ,
.Nm EC_GROUP_dup ,
.Nm EC_GROUP_method_of ,
.Nm EC_GROUP_set_generator ,
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
.Pp
.Fn EC_GROUP_get_basis_type
returns the values
.Dv NID_X9_62_tpBasis
or
.Dv NID_X9_62_ppBasis
as defined in
.In openssl/obj_mac.h
for a trinomial or pentanomial, respectively.
Alternatively in the event of an error a 0 is returned.
.Sh SEE ALSO
.Xr d2i_ECPKParameters 3 ,
.Xr EC_GFp_simple_method 3 ,
.Xr EC_GROUP_new 3 ,
.Xr EC_KEY_new 3 ,







|







517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
.Pp
.Fn EC_GROUP_get_basis_type
returns the values
.Dv NID_X9_62_tpBasis
or
.Dv NID_X9_62_ppBasis
as defined in
.In openssl/objects.h
for a trinomial or pentanomial, respectively.
Alternatively in the event of an error a 0 is returned.
.Sh SEE ALSO
.Xr d2i_ECPKParameters 3 ,
.Xr EC_GFp_simple_method 3 ,
.Xr EC_GROUP_new 3 ,
.Xr EC_KEY_new 3 ,
Changes to jni/libressl/man/ERR.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: ERR.3,v 1.8 2019/06/10 09:49:48 schwarze Exp $
.\"	OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org> and
.\" Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2000, 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: ERR.3,v 1.10 2022/09/06 10:22:31 kn Exp $
.\"	OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org> and
.\" Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2000, 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 10 2019 $
.Dt ERR 3
.Os
.Sh NAME
.Nm ERR
.Nd OpenSSL error codes
.Sh SYNOPSIS
.In openssl/err.h







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 6 2022 $
.Dt ERR 3
.Os
.Sh NAME
.Nm ERR
.Nd OpenSSL error codes
.Sh SYNOPSIS
.In openssl/err.h
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
.Pa /usr/src/lib/libcrypto/err/err.c ) ,
and add
.Fn ERR_load_XXX_strings
to the
.Fn ERR_load_crypto_strings
function (in
.Sy /usr/src/lib/libcrypto/err/err_all.c ) .
Finally, add an entry
.Pp
.Dl L XXX xxx.h xxx_err.c
.Pp
to
.Sy /usr/src/lib/libcrypto/err/openssl.ec ,
and add
.Pa xxx_err.c
to the
.Pa Makefile .
Running
.Sy make errors
will then generate a file
.Pa xxx_err.c ,
and add all error codes used in the library to
.Pa xxx.h .
.Pp
Additionally the library include file must have a certain form.
Typically it will initially look like this:
.Bd -literal -offset indent
#ifndef HEADER_XXX_H
#define HEADER_XXX_H

#ifdef __cplusplus
extern "C" {
#endif

/* Include files */

#include <openssl/bio.h>
#include <openssl/x509.h>

/* Macros, structures and function prototypes */

/* BEGIN ERROR CODES */
.Ed
.Pp
The
.Sy BEGIN ERROR CODES
sequence is used by the error code generation script as the point to
place new error codes.
Any text after this point will be overwritten when
.Sy make errors
is run.
The closing #endif etc. will be automatically added by the script.
.Pp
The generated C error code file
.Pa xxx_err.c
will load the header files
.In stdio.h ,
.In openssl/err.h
and
.In openssl/xxx.h
so the header file must load any additional header files containing any
definitions it uses.
.Sh USING ERROR CODES IN EXTERNAL LIBRARIES
It is also possible to use OpenSSL's error code scheme in external
libraries.
The library needs to load its own codes and call the OpenSSL error code
insertion script
.Pa mkerr.pl
explicitly to add codes to the header file and generate the C error code
file.
This will normally be done if the external library needs to generate new
ASN.1 structures but it can also be used to add more general purpose
error code handling.
.Sh INTERNALS
The error queues are stored in a hash table with one
.Vt ERR_STATE
entry for each PID.
.Fn ERR_get_state
returns the current thread's
.Vt ERR_STATE .







|
<
<
<
<
<
<



<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



<
<
<
<
<
<
<
<







109
110
111
112
113
114
115
116






117
118
119













































120
121
122








123
124
125
126
127
128
129
.Pa /usr/src/lib/libcrypto/err/err.c ) ,
and add
.Fn ERR_load_XXX_strings
to the
.Fn ERR_load_crypto_strings
function (in
.Sy /usr/src/lib/libcrypto/err/err_all.c ) .
Finally, add






.Pa xxx_err.c
to the
.Pa Makefile .













































.Sh USING ERROR CODES IN EXTERNAL LIBRARIES
It is also possible to use OpenSSL's error code scheme in external
libraries.








.Sh INTERNALS
The error queues are stored in a hash table with one
.Vt ERR_STATE
entry for each PID.
.Fn ERR_get_state
returns the current thread's
.Vt ERR_STATE .
Changes to jni/libressl/man/EVP_DigestInit.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_DigestInit.3,v 1.23 2022/03/31 17:27:16 naddy Exp $
.\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000
.\" selective merge up to: OpenSSL a95d7574 Jul 2 12:16:38 2017 -0400
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_DigestInit.3,v 1.24 2022/08/31 14:27:34 tb Exp $
.\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000
.\" selective merge up to: OpenSSL a95d7574 Jul 2 12:16:38 2017 -0400
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dt EVP_DIGESTINIT 3
.Os
.Sh NAME
.Nm EVP_MD_CTX_new ,
.Nm EVP_MD_CTX_reset ,
.Nm EVP_MD_CTX_free ,
.Nm EVP_MD_CTX_init ,







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: August 31 2022 $
.Dt EVP_DIGESTINIT 3
.Os
.Sh NAME
.Nm EVP_MD_CTX_new ,
.Nm EVP_MD_CTX_reset ,
.Nm EVP_MD_CTX_free ,
.Nm EVP_MD_CTX_init ,
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
.Pp
.Fn EVP_MD_CTX_reset
cleans up
.Fa ctx
and resets it to the state it had after
.Fn EVP_MD_CTX_new ,
such that it can be reused.
It is also suitable for digest contexts on the stack that were
used and are no longer needed.
.Pp
.Fn EVP_MD_CTX_free
cleans up
.Fa ctx
and frees the space allocated to it.
.Pp
.Fn EVP_MD_CTX_init







<
<







263
264
265
266
267
268
269


270
271
272
273
274
275
276
.Pp
.Fn EVP_MD_CTX_reset
cleans up
.Fa ctx
and resets it to the state it had after
.Fn EVP_MD_CTX_new ,
such that it can be reused.


.Pp
.Fn EVP_MD_CTX_free
cleans up
.Fa ctx
and frees the space allocated to it.
.Pp
.Fn EVP_MD_CTX_init
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
If
.Fa impl
is
.Dv NULL ,
then the default implementation of digest
.Fa type
is used.
If
.Fa ctx
points to an unused object on the stack, it must be initialized with
.Fn EVP_MD_CTX_init
before calling this function.
.Pp
.Fn EVP_DigestUpdate
hashes
.Fa cnt
bytes of data at
.Fa d
into the digest context







<
<
<
<
<







310
311
312
313
314
315
316





317
318
319
320
321
322
323
If
.Fa impl
is
.Dv NULL ,
then the default implementation of digest
.Fa type
is used.





.Pp
.Fn EVP_DigestUpdate
hashes
.Fa cnt
bytes of data at
.Fa d
into the digest context
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
.Fn EVP_MD_CTX_copy_ex
can be used to copy the message digest state from
.Fa in
to
.Fa out .
This is useful if large amounts of data are to be hashed which only
differ in the last few bytes.
If
.Fa out
points to an unused object on the stack, it must be initialized with
.Fn EVP_MD_CTX_init
before calling this function.
.Pp
.Fn EVP_DigestInit
is a deprecated function behaving like
.Fn EVP_DigestInit_ex
except that it always uses the default digest implementation
and that it requires
.Fn EVP_MD_CTX_reset







<
<
<
<
<







377
378
379
380
381
382
383





384
385
386
387
388
389
390
.Fn EVP_MD_CTX_copy_ex
can be used to copy the message digest state from
.Fa in
to
.Fa out .
This is useful if large amounts of data are to be hashed which only
differ in the last few bytes.





.Pp
.Fn EVP_DigestInit
is a deprecated function behaving like
.Fn EVP_DigestInit_ex
except that it always uses the default digest implementation
and that it requires
.Fn EVP_MD_CTX_reset
Changes to jni/libressl/man/EVP_EncryptInit.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_EncryptInit.3,v 1.43 2022/03/31 17:27:16 naddy Exp $
.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800
.\"   EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod
.\"   7c6d372a Nov 20 13:20:01 2018 +0000
.\" selective merge up to: OpenSSL 16cfc2c9 Mar 8 22:30:28 2018 +0100
.\"   EVP_chacha20.pod 8fa4d95e Oct 21 11:59:09 2017 +0900
.\"
.\" This file is a derived work.
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_EncryptInit.3,v 1.44 2022/08/31 14:27:34 tb Exp $
.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800
.\"   EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod
.\"   7c6d372a Nov 20 13:20:01 2018 +0000
.\" selective merge up to: OpenSSL 16cfc2c9 Mar 8 22:30:28 2018 +0100
.\"   EVP_chacha20.pod 8fa4d95e Oct 21 11:59:09 2017 +0900
.\"
.\" This file is a derived work.
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dt EVP_ENCRYPTINIT 3
.Os
.Sh NAME
.Nm EVP_CIPHER_CTX_new ,
.Nm EVP_CIPHER_CTX_reset ,
.Nm EVP_CIPHER_CTX_cleanup ,
.Nm EVP_CIPHER_CTX_init ,







|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: August 31 2022 $
.Dt EVP_ENCRYPTINIT 3
.Os
.Sh NAME
.Nm EVP_CIPHER_CTX_new ,
.Nm EVP_CIPHER_CTX_reset ,
.Nm EVP_CIPHER_CTX_cleanup ,
.Nm EVP_CIPHER_CTX_init ,
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
and frees all allocated memory associated with it, except the
.Fa ctx
object itself, such that it can be reused for another series of calls to
.Fn EVP_CipherInit ,
.Fn EVP_CipherUpdate ,
and
.Fn EVP_CipherFinal .
It is also suitable for cipher contexts on the stack that were used
and are no longer needed.
.Fn EVP_CIPHER_CTX_cleanup
is a deprecated alias for
.Fn EVP_CIPHER_CTX_reset .
.Pp
.Fn EVP_CIPHER_CTX_init
is a deprecated function to clear a cipher context on the stack
before use.







<
<







439
440
441
442
443
444
445


446
447
448
449
450
451
452
and frees all allocated memory associated with it, except the
.Fa ctx
object itself, such that it can be reused for another series of calls to
.Fn EVP_CipherInit ,
.Fn EVP_CipherUpdate ,
and
.Fn EVP_CipherFinal .


.Fn EVP_CIPHER_CTX_cleanup
is a deprecated alias for
.Fn EVP_CIPHER_CTX_reset .
.Pp
.Fn EVP_CIPHER_CTX_init
is a deprecated function to clear a cipher context on the stack
before use.
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
sets up the cipher context
.Fa ctx
for encryption with cipher
.Fa type
from
.Vt ENGINE
.Fa impl .
If
.Fa ctx
points to an unused object on the stack, it must be initialized with
.Fn EVP_MD_CTX_init
before calling this function.
.Fa type
is normally supplied by a function such as
.Xr EVP_aes_256_cbc 3 .
If
.Fa impl
is
.Dv NULL ,







<
<
<
<
<







472
473
474
475
476
477
478





479
480
481
482
483
484
485
sets up the cipher context
.Fa ctx
for encryption with cipher
.Fa type
from
.Vt ENGINE
.Fa impl .





.Fa type
is normally supplied by a function such as
.Xr EVP_aes_256_cbc 3 .
If
.Fa impl
is
.Dv NULL ,
Changes to jni/libressl/man/EVP_PKEY_CTX_new.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.11 2020/06/24 19:55:55 schwarze Exp $
.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.12 2022/07/13 21:51:35 schwarze Exp $
.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 24 2020 $
.Dt EVP_PKEY_CTX_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_CTX_new ,
.Nm EVP_PKEY_CTX_new_id ,
.Nm EVP_PKEY_CTX_dup ,
.Nm EVP_PKEY_CTX_free







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt EVP_PKEY_CTX_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_CTX_new ,
.Nm EVP_PKEY_CTX_new_id ,
.Nm EVP_PKEY_CTX_dup ,
.Nm EVP_PKEY_CTX_free
153
154
155
156
157
158
159

160
161
162
163
164
165
166
structure or
.Dv NULL
if an error occurred.
.Sh SEE ALSO
.Xr EVP_DigestSignInit 3 ,
.Xr EVP_DigestVerifyInit 3 ,
.Xr EVP_PKEY_base_id 3 ,

.Xr EVP_PKEY_CTX_ctrl 3 ,
.Xr EVP_PKEY_decrypt 3 ,
.Xr EVP_PKEY_derive 3 ,
.Xr EVP_PKEY_encrypt 3 ,
.Xr EVP_PKEY_keygen 3 ,
.Xr EVP_PKEY_meth_set_init 3 ,
.Xr EVP_PKEY_new 3 ,







>







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
structure or
.Dv NULL
if an error occurred.
.Sh SEE ALSO
.Xr EVP_DigestSignInit 3 ,
.Xr EVP_DigestVerifyInit 3 ,
.Xr EVP_PKEY_base_id 3 ,
.Xr EVP_PKEY_check 3 ,
.Xr EVP_PKEY_CTX_ctrl 3 ,
.Xr EVP_PKEY_decrypt 3 ,
.Xr EVP_PKEY_derive 3 ,
.Xr EVP_PKEY_encrypt 3 ,
.Xr EVP_PKEY_keygen 3 ,
.Xr EVP_PKEY_meth_set_init 3 ,
.Xr EVP_PKEY_new 3 ,
Added jni/libressl/man/EVP_PKEY_CTX_set_hkdf_md.3.


























































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
.\" $OpenBSD: EVP_PKEY_CTX_set_hkdf_md.3,v 1.2 2022/05/06 10:10:10 tb Exp $
.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100
.\"
.\" This file was written by Alessandro Ghedini <alessandro@ghedini.me>,
.\" Matt Caswell <matt@openssl.org>, and Viktor Dukhovni <viktor@dukhovni.org>.
.\" Copyright (c) 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in
.\"    the documentation and/or other materials provided with the
.\"    distribution.
.\"
.\" 3. All advertising materials mentioning features or use of this
.\"    software must display the following acknowledgment:
.\"    "This product includes software developed by the OpenSSL Project
.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
.\"
.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
.\"    endorse or promote products derived from this software without
.\"    prior written permission. For written permission, please contact
.\"    openssl-core@openssl.org.
.\"
.\" 5. Products derived from this software may not be called "OpenSSL"
.\"    nor may "OpenSSL" appear in their names without prior written
.\"    permission of the OpenSSL Project.
.\"
.\" 6. Redistributions of any form whatsoever must retain the following
.\"    acknowledgment:
.\"    "This product includes software developed by the OpenSSL Project
.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: May 6 2022 $
.Dt EVP_PKEY_CTX_SET_HKDF_MD 3
.Os
.Sh NAME
.Nm EVP_PKEY_CTX_set_hkdf_md ,
.Nm EVP_PKEY_CTX_set1_hkdf_salt ,
.Nm EVP_PKEY_CTX_set1_hkdf_key ,
.Nm EVP_PKEY_CTX_add1_hkdf_info ,
.Nm EVP_PKEY_CTX_hkdf_mode
.Nd HMAC-based Extract-and-Expand key derivation algorithm
.Sh SYNOPSIS
.In openssl/kdf.h
.Ft int
.Fo EVP_PKEY_CTX_hkdf_mode
.Fa "EVP_PKEY_CTX *pctx"
.Fa "int mode"
.Fc
.Ft int
.Fo EVP_PKEY_CTX_set_hkdf_md
.Fa "EVP_PKEY_CTX *pctx"
.Fa "const EVP_MD *md"
.Fc
.Ft int
.Fo EVP_PKEY_CTX_set1_hkdf_salt
.Fa "EVP_PKEY_CTX *pctx"
.Fa "unsigned char *salt"
.Fa "int saltlen"
.Fc
.Ft int
.Fo EVP_PKEY_CTX_set1_hkdf_key
.Fa "EVP_PKEY_CTX *pctx"
.Fa "unsigned char *key"
.Fa "int keylen"
.Fc
.Ft int
.Fo EVP_PKEY_CTX_add1_hkdf_info
.Fa "EVP_PKEY_CTX *pctx"
.Fa "unsigned char *info"
.Fa "int infolen"
.Fc
.Sh DESCRIPTION
The EVP_PKEY_HKDF algorithm implements the HKDF key derivation function.
HKDF follows the "extract-then-expand" paradigm, where the KDF logically
consists of two modules.
The first stage takes the input keying material and "extracts" from it a
fixed-length pseudorandom key K.
The second stage "expands" the key K
into several additional pseudorandom keys (the output of the KDF).
.Pp
.Fn EVP_PKEY_CTX_hkdf_mode
sets the mode for the HKDF operation.
There are three modes that are currently defined:
.Bl -tag -width Ds
.It Dv EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND
This is the default mode.
Calling
.Xr EVP_PKEY_derive 3
on an EVP_PKEY_CTX set up for HKDF will perform an extract followed by
an expand operation in one go.
The derived key returned will be the result after the expand operation.
The intermediate fixed-length pseudorandom key K is not returned.
.Pp
In this mode the digest, key, salt and info values must be set before a
key is derived or an error occurs.
.It Dv EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY
In this mode calling
.Xr EVP_PKEY_derive 3
will just perform the extract operation.
The value returned will be the intermediate fixed-length pseudorandom
key K.
.Pp
The digest, key and salt values must be set before a key is derived or
an error occurs.
.It Dv EVP_PKEY_HKDEF_MODE_EXPAND_ONLY
In this mode calling
.Xr EVP_PKEY_derive 3
will just perform the expand operation.
The input key should be set to the intermediate fixed-length
pseudorandom key K returned from a previous extract operation.
.Pp
The digest, key and info values must be set before a key is derived or
an error occurs.
.El
.Pp
.Fn EVP_PKEY_CTX_set_hkdf_md
sets the message digest associated with the HKDF.
.Pp
.Fn EVP_PKEY_CTX_set1_hkdf_salt
sets the salt to
.Fa saltlen
bytes of the buffer
.Fa salt .
Any existing value is replaced.
.Pp
.Fn EVP_PKEY_CTX_set1_hkdf_key
sets the key to
.Fa keylen
bytes of the buffer
.Fa key .
Any existing value is replaced.
.Pp
.Fn EVP_PKEY_CTX_add1_hkdf_info
sets the info value to
.Fa infolen
bytes of the buffer
.Fa info .
If a value is already set, it is appended to the existing value.
.Sh STRING CTRLS
HKDF also supports string based control operations via
.Xr EVP_PKEY_CTX_ctrl_str 3 .
The
.Fa type
parameter "md" uses the supplied
.Fa value
as the name of the digest algorithm to use.
The
.Fa type
parameter "mode" accepts "EXTRACT_AND_EXPAND", "EXTRACT_ONLY"
and "EXPAND_ONLY" as
.Fa value
to determine the mode to use.
The
.Fa type
parameters "salt", "key" and "info" use the supplied
.Fa value
parameter as a
seed, key, or info.
The names "hexsalt", "hexkey" and "hexinfo" are similar except they take
a hex string which is converted to binary.
.Sh NOTES
All these functions are implemented as macros.
.Pp
A context for HKDF can be obtained by calling:
.Bd -literal
 EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
.Ed
.Pp
The total length of the info buffer cannot exceed 1024 bytes in length:
this should be more than enough for any normal use of HKDF.
.Pp
The output length of an HKDF expand operation is specified via the
length parameter to the
.Xr EVP_PKEY_derive 3
function.
Since the HKDF output length is variable, passing a
.Dv NULL
buffer as a means to obtain the requisite length is not meaningful with
HKDF in any mode that performs an expand operation.
Instead, the caller must allocate a buffer of the desired length, and
pass that buffer to
.Xr EVP_PKEY_derive 3
along with (a pointer initialized to) the desired length.
Passing a
.Dv NULL
buffer to obtain the length is allowed when using
.Dv EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY .
.Sh RETURN VALUES
All these functions return 1 for success and 0 or a negative value for
failure.
In particular a return value of -2 indicates the operation is not
supported by the public key algorithm.
.Sh EXAMPLES
This example derives 10 bytes using SHA-256 with the secret key
"secret", salt value "salt" and info value "label":
.Bd -literal
EVP_PKEY_CTX *pctx;
unsigned char out[10];
size_t outlen = sizeof(out);

if ((pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL)) == NULL)
	/* Error */

if (EVP_PKEY_derive_init(pctx) <= 0)
	/* Error */
if (EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()) <= 0)
	/* Error */
if (EVP_PKEY_CTX_set1_hkdf_salt(pctx, "salt", 4) <= 0)
	/* Error */
if (EVP_PKEY_CTX_set1_hkdf_key(pctx, "secret", 6) <= 0)
	/* Error */
if (EVP_PKEY_CTX_add1_hkdf_info(pctx, "label", 5) <= 0)
	/* Error */
if (EVP_PKEY_derive(pctx, out, &outlen) <= 0)
	/* Error */
.Ed
.Sh SEE ALSO
.Xr EVP_PKEY_CTX_ctrl_str 3 ,
.Xr EVP_PKEY_CTX_new 3 ,
.Xr EVP_PKEY_derive 3
.Sh STANDARDS
RFC 5869: HMAC-based Extract-and-Expand Key Derivation Function (HKDF)
.Sh HISTORY
.Fn EVP_PKEY_CTX_set_hkdf_md ,
.Fn EVP_PKEY_CTX_set1_hkdf_salt ,
.Fn EVP_PKEY_CTX_set1_hkdf_key ,
and
.Fn EVP_PKEY_CTX_add1_hkdf_info
first appeared in OpenSSL 1.1.0 and
.Fn EVP_PKEY_CTX_hkdf_mode
in OpenSSL 1.1.1.
These functions have been available since
.Ox 7.2 .
Changes to jni/libressl/man/EVP_PKEY_asn1_new.3.
1
2
3
4
5

6
7
8
9
10
11
12
.\" $OpenBSD: EVP_PKEY_asn1_new.3,v 1.7 2021/11/06 15:00:25 schwarze Exp $
.\" selective merge up to:
.\" OpenSSL man3/EVP_PKEY_ASN1_METHOD b0004708 Nov 1 00:45:24 2017 +0800
.\"
.\" This file was written by Richard Levitte <levitte@openssl.org>

.\" Copyright (c) 2017 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
|




>







1
2
3
4
5
6
7
8
9
10
11
12
13
.\" $OpenBSD: EVP_PKEY_asn1_new.3,v 1.8 2022/07/13 19:10:40 schwarze Exp $
.\" selective merge up to:
.\" OpenSSL man3/EVP_PKEY_ASN1_METHOD b0004708 Nov 1 00:45:24 2017 +0800
.\"
.\" This file was written by Richard Levitte <levitte@openssl.org>
.\" and Paul Yang <yang.yang@baishancloud.com>.
.\" Copyright (c) 2017 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65




66
67
68
69
70
71
72
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: November 6 2021 $
.Dt EVP_PKEY_ASN1_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_asn1_new ,
.Nm EVP_PKEY_asn1_copy ,
.Nm EVP_PKEY_asn1_free ,
.Nm EVP_PKEY_asn1_add0 ,
.Nm EVP_PKEY_asn1_add_alias ,
.Nm EVP_PKEY_asn1_set_public ,
.Nm EVP_PKEY_asn1_set_private ,
.Nm EVP_PKEY_asn1_set_param ,
.Nm EVP_PKEY_asn1_set_free ,
.Nm EVP_PKEY_asn1_set_ctrl




.Nd manipulating and registering an EVP_PKEY_ASN1_METHOD structure
.Sh SYNOPSIS
.In openssl/evp.h
.Ft EVP_PKEY_ASN1_METHOD *
.Fo EVP_PKEY_asn1_new
.Fa "int id"
.Fa "int flags"







|












|
>
>
>
>







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt EVP_PKEY_ASN1_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_asn1_new ,
.Nm EVP_PKEY_asn1_copy ,
.Nm EVP_PKEY_asn1_free ,
.Nm EVP_PKEY_asn1_add0 ,
.Nm EVP_PKEY_asn1_add_alias ,
.Nm EVP_PKEY_asn1_set_public ,
.Nm EVP_PKEY_asn1_set_private ,
.Nm EVP_PKEY_asn1_set_param ,
.Nm EVP_PKEY_asn1_set_free ,
.Nm EVP_PKEY_asn1_set_ctrl ,
.Nm EVP_PKEY_asn1_set_check ,
.Nm EVP_PKEY_asn1_set_public_check ,
.Nm EVP_PKEY_asn1_set_param_check ,
.Nm EVP_PKEY_asn1_set_security_bits
.Nd manipulating and registering an EVP_PKEY_ASN1_METHOD structure
.Sh SYNOPSIS
.In openssl/evp.h
.Ft EVP_PKEY_ASN1_METHOD *
.Fo EVP_PKEY_asn1_new
.Fa "int id"
.Fa "int flags"
128
129
130
131
132
133
134




















135
136
137
138
139
140
141
.Fa "void (*pkey_free)(EVP_PKEY *pkey)"
.Fc
.Ft void
.Fo EVP_PKEY_asn1_set_ctrl
.Fa "EVP_PKEY_ASN1_METHOD *ameth"
.Fa "int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)"
.Fc




















.Sh DESCRIPTION
.Vt EVP_PKEY_ASN1_METHOD
is a structure which holds a set of ASN.1 conversion, printing and
information methods for a specific public key algorithm.
.Pp
There are two places where the
.Vt EVP_PKEY_ASN1_METHOD







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
.Fa "void (*pkey_free)(EVP_PKEY *pkey)"
.Fc
.Ft void
.Fo EVP_PKEY_asn1_set_ctrl
.Fa "EVP_PKEY_ASN1_METHOD *ameth"
.Fa "int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)"
.Fc
.Ft void
.Fo EVP_PKEY_asn1_set_check
.Fa "EVP_PKEY_ASN1_METHOD *ameth"
.Fa "int (*pkey_check)(const EVP_PKEY *pk)"
.Fc
.Ft void
.Fo EVP_PKEY_asn1_set_public_check
.Fa "EVP_PKEY_ASN1_METHOD *ameth"
.Fa "int (*pkey_public_check)(const EVP_PKEY *pk)"
.Fc
.Ft void
.Fo EVP_PKEY_asn1_set_param_check
.Fa "EVP_PKEY_ASN1_METHOD *ameth"
.Fa "int (*pkey_param_check)(const EVP_PKEY *pk)"
.Fc
.Ft void
.Fo EVP_PKEY_asn1_set_security_bits
.Fa "EVP_PKEY_ASN1_METHOD *ameth"
.Fa "int (*pkey_security_bits)(const EVP_PKEY *pkey)"
.Fc
.Sh DESCRIPTION
.Vt EVP_PKEY_ASN1_METHOD
is a structure which holds a set of ASN.1 conversion, printing and
information methods for a specific public key algorithm.
.Pp
There are two places where the
.Vt EVP_PKEY_ASN1_METHOD
321
322
323
324
325
326
327
























328
329
330
331
332
333
334
.Pp
Add extra algorithm specific control.
This method is called by
.Xr EVP_PKEY_get_default_digest_nid 3 ,
.Fn PKCS7_SIGNER_INFO_set ,
.Fn PKCS7_RECIP_INFO_set ,
and other functions.
























.Ss Functions
.Fn EVP_PKEY_asn1_new
creates and returns a new
.Vt EVP_PKEY_ASN1_METHOD
object, and associates the given
.Fa id ,
.Fa flags ,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
.Pp
Add extra algorithm specific control.
This method is called by
.Xr EVP_PKEY_get_default_digest_nid 3 ,
.Fn PKCS7_SIGNER_INFO_set ,
.Fn PKCS7_RECIP_INFO_set ,
and other functions.
.Bd -unfilled
.Ft int Fn (*pkey_check) "const EVP_PKEY *pk"
.Ft int Fn (*pkey_public_check) "const EVP_PKEY *pk"
.Ft int Fn (*pkey_param_check) "const EVP_PKEY *pk"
.Ed
.Pp
Check the validity of
.Fa pk
for key-pair, public component, and parameters, respectively.
These methods must return 0 for an invalid key or 1 for a valid key.
They are called by
.Xr EVP_PKEY_check 3 ,
.Xr EVP_PKEY_public_check 3 ,
and
.Xr EVP_PKEY_param_check 3 ,
respectively.
.Bd -unfilled
.Ft int Fn (*pkey_security_bits) "const EVP_PKEY *pkey"
.Ed
.Pp
Return the security strength measured in bits of
.Fa pkey .
It is called by
.Xr EVP_PKEY_security_bits 3 .
.Ss Functions
.Fn EVP_PKEY_asn1_new
creates and returns a new
.Vt EVP_PKEY_ASN1_METHOD
object, and associates the given
.Fa id ,
.Fa flags ,
392
393
394
395
396
397
398




399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421










422
423











This function is not thread safe, it's recommended to only use this when
initializing the application.
.Pp
.Fn EVP_PKEY_asn1_set_public ,
.Fn EVP_PKEY_asn1_set_private ,
.Fn EVP_PKEY_asn1_set_param ,
.Fn EVP_PKEY_asn1_set_free ,




and
.Fn EVP_PKEY_asn1_set_ctrl
set the diverse methods of the given
.Vt EVP_PKEY_ASN1_METHOD
object.
.Sh RETURN VALUES
.Fn EVP_PKEY_asn1_new
returns a pointer to an
.Vt EVP_PKEY_ASN1_METHOD
object or
.Dv NULL
on error.
.Pp
.Fn EVP_PKEY_asn1_add0
and
.Fn EVP_PKEY_asn1_add_alias
return 0 on error or 1 on success.
.Sh SEE ALSO
.Xr EVP_PKEY_asn1_get_count 3 ,
.Xr EVP_PKEY_new 3 ,
.Xr X509_PUBKEY_new 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.0.0










and have been available since
.Ox 4.9 .


















>
>
>
>

|




















|
>
>
>
>
>
>
>
>
>
>
|

>
>
>
>
>
>
>
>
>
>
>
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
This function is not thread safe, it's recommended to only use this when
initializing the application.
.Pp
.Fn EVP_PKEY_asn1_set_public ,
.Fn EVP_PKEY_asn1_set_private ,
.Fn EVP_PKEY_asn1_set_param ,
.Fn EVP_PKEY_asn1_set_free ,
.Fn EVP_PKEY_asn1_set_ctrl ,
.Fn EVP_PKEY_asn1_set_check ,
.Fn EVP_PKEY_asn1_set_public_check ,
.Fn EVP_PKEY_asn1_set_param_check ,
and
.Fn EVP_PKEY_asn1_set_security_bits
set the diverse methods of the given
.Vt EVP_PKEY_ASN1_METHOD
object.
.Sh RETURN VALUES
.Fn EVP_PKEY_asn1_new
returns a pointer to an
.Vt EVP_PKEY_ASN1_METHOD
object or
.Dv NULL
on error.
.Pp
.Fn EVP_PKEY_asn1_add0
and
.Fn EVP_PKEY_asn1_add_alias
return 0 on error or 1 on success.
.Sh SEE ALSO
.Xr EVP_PKEY_asn1_get_count 3 ,
.Xr EVP_PKEY_new 3 ,
.Xr X509_PUBKEY_new 3
.Sh HISTORY
.Fn EVP_PKEY_asn1_new ,
.Fn EVP_PKEY_asn1_copy ,
.Fn EVP_PKEY_asn1_free ,
.Fn EVP_PKEY_asn1_add0 ,
.Fn EVP_PKEY_asn1_add_alias ,
.Fn EVP_PKEY_asn1_set_public ,
.Fn EVP_PKEY_asn1_set_private ,
.Fn EVP_PKEY_asn1_set_param ,
.Fn EVP_PKEY_asn1_set_free ,
and
.Fn EVP_PKEY_asn1_set_ctrl
first appeared in OpenSSL 1.0.0 and have been available since
.Ox 4.9 .
.Pp
.Fn EVP_PKEY_asn1_set_check ,
.Fn EVP_PKEY_asn1_set_public_check ,
and
.Fn EVP_PKEY_asn1_set_param_check
first appeared in OpenSSL 1.1.1 and have been available since
.Ox 7.1 .
.Pp
.Fn EVP_PKEY_asn1_set_security_bits
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 7.2 .
Added jni/libressl/man/EVP_PKEY_check.3.










































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
.\" $OpenBSD: EVP_PKEY_check.3,v 1.2 2022/07/14 14:49:09 tb Exp $
.\"
.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 14 2022 $
.Dt EVP_PKEY_CHECK 3
.Os
.Sh NAME
.Nm EVP_PKEY_check ,
.Nm EVP_PKEY_public_check ,
.Nm EVP_PKEY_param_check
.Nd key and parameter check functions
.Sh SYNOPSIS
.In openssl/evp.h
.Ft int
.Fn EVP_PKEY_check "EVP_PKEY_CTX *ctx"
.Ft int
.Fn EVP_PKEY_public_check "EVP_PKEY_CTX *ctx"
.Ft int
.Fn EVP_PKEY_param_check "EVP_PKEY_CTX *ctx"
.Sh DESCRIPTION
.Fn EVP_PKEY_check
performs various sanity checks on the key contained in
.Fa ctx
but only supports a small number of key types by default.
It preferably uses the function
.Fa check
configured for
.Fa ctx
with
.Xr EVP_PKEY_meth_set_check 3 .
It falls back to the function
.Fa pkey_check
configured for the private key contained in
.Fa ctx
with
.Xr EVP_PKEY_asn1_set_check 3 .
If that wasn't configured either, it attempts to use the following
check functions:
.Pp
.Bl -tag -width 3n -compact -offset -indent
.It DH
not supported, return value \-2
.It EC
.Xr EC_KEY_check_key 3
.It RSA
.Xr RSA_check_key 3
.El
.Pp
.Fn EVP_PKEY_public_check
performs various sanity checks on the public key contained in
.Fa ctx
but only supports a small number of key types by default.
It preferably uses the function
.Fa public_check
configured for
.Fa ctx
with
.Xr EVP_PKEY_meth_set_public_check 3 .
It falls back to the function
.Fa pkey_public_check
configured for the private key contained in
.Fa ctx
with
.Xr EVP_PKEY_asn1_set_public_check 3 .
If that wasn't configured either, it attempts to use the following
check functions:
.Pp
.Bl -tag -width 3n -compact -offset -indent
.It DH
.Xr DH_check_pub_key 3
.It EC
.Xr EC_KEY_check_key 3
.It RSA
not supported, return value \-2
.El
.Pp
.Fn EVP_PKEY_param_check
performs various sanity checks on the key parameters contained in
.Fa ctx
but only supports a small number of key types by default.
It preferably uses the function
.Fa check
configured for
.Fa ctx
with
.Xr EVP_PKEY_meth_set_param_check 3 .
It falls back to the function
.Fa pkey_check
configured for the private key contained in
.Fa ctx
with
.Xr EVP_PKEY_asn1_set_param_check 3 .
If that wasn't configured either, it attempts to use the following
check functions:
.Pp
.Bl -tag -width 3n -compact -offset -indent
.It DH
.Xr DH_check 3
.It EC
.Xr EC_GROUP_check 3
.It RSA
not supported, return value \-2
.El
.Sh RETURN VALUES
These functions return 1 if the check was performed and no problem
was found, 0 if a problem was found or if the check could not be
performed, for example because
.Fa ctx
does not contain an
.Vt EVP_PKEY
object, or \-2 if the required check function is neither configured for
.Fa ctx
nor for the
.Vt PKEY
contained therein, and the check in question is not supported by default
for the algorithm in question either.
.Sh SEE ALSO
.Xr DH_check 3 ,
.Xr EC_GROUP_check 3 ,
.Xr EC_KEY_new 3 ,
.Xr EVP_PKEY_asn1_new 3 ,
.Xr EVP_PKEY_CTX_new 3 ,
.Xr EVP_PKEY_meth_new 3 ,
.Xr EVP_PKEY_new 3 ,
.Xr RSA_check_key 3
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.1
and have been available since
.Ox 7.1 .
.Sh BUGS
For EC keys,
.Fn EVP_PKEY_public_check
also checks the
.Em private
key and fails if there is a problem with any of the private
components, even if no problem is found with the public key.
Changes to jni/libressl/man/EVP_PKEY_meth_new.3.
1
2
3
4
5
6
7
8
9
.\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $
.\" selective merge up to: OpenSSL 43f985fd Aug 21 11:47:17 2017 -0400
.\"
.\" This file was written by Paul Yang <yang.yang@baishancloud.com>
.\" Copyright (c) 2017 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
|
|







1
2
3
4
5
6
7
8
9
.\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.5 2022/07/13 19:10:40 schwarze Exp $
.\" selective merge up to: OpenSSL 335a587b May 7 11:59:11 2019 +0200
.\"
.\" This file was written by Paul Yang <yang.yang@baishancloud.com>
.\" Copyright (c) 2017 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 6 2019 $
.Dt EVP_PKEY_METH_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_meth_new ,
.Nm EVP_PKEY_meth_free ,
.Nm EVP_PKEY_meth_copy ,
.Nm EVP_PKEY_meth_find ,







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt EVP_PKEY_METH_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_meth_new ,
.Nm EVP_PKEY_meth_free ,
.Nm EVP_PKEY_meth_copy ,
.Nm EVP_PKEY_meth_find ,
66
67
68
69
70
71
72
73



74
75
76
77
78
79
80
.Nm EVP_PKEY_meth_set_verify ,
.Nm EVP_PKEY_meth_set_verify_recover ,
.Nm EVP_PKEY_meth_set_signctx ,
.Nm EVP_PKEY_meth_set_verifyctx ,
.Nm EVP_PKEY_meth_set_encrypt ,
.Nm EVP_PKEY_meth_set_decrypt ,
.Nm EVP_PKEY_meth_set_derive ,
.Nm EVP_PKEY_meth_set_ctrl



.Nd manipulate an EVP_PKEY_METHOD structure
.Sh SYNOPSIS
.In openssl/evp.h
.Ft EVP_PKEY_METHOD *
.Fo EVP_PKEY_meth_new
.Fa "int id"
.Fa "int flags"







|
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.Nm EVP_PKEY_meth_set_verify ,
.Nm EVP_PKEY_meth_set_verify_recover ,
.Nm EVP_PKEY_meth_set_signctx ,
.Nm EVP_PKEY_meth_set_verifyctx ,
.Nm EVP_PKEY_meth_set_encrypt ,
.Nm EVP_PKEY_meth_set_decrypt ,
.Nm EVP_PKEY_meth_set_derive ,
.Nm EVP_PKEY_meth_set_ctrl ,
.Nm EVP_PKEY_meth_set_check ,
.Nm EVP_PKEY_meth_set_public_check ,
.Nm EVP_PKEY_meth_set_param_check
.Nd manipulate an EVP_PKEY_METHOD structure
.Sh SYNOPSIS
.In openssl/evp.h
.Ft EVP_PKEY_METHOD *
.Fo EVP_PKEY_meth_new
.Fa "int id"
.Fa "int flags"
180
181
182
183
184
185
186















187
188
189
190
191
192
193
.Fc
.Ft void
.Fo EVP_PKEY_meth_set_ctrl
.Fa "EVP_PKEY_METHOD *pmeth"
.Fa "int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)"
.Fa "int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)"
.Fc















.Sh DESCRIPTION
The
.Vt EVP_PKEY_METHOD
structure holds a set of methods
for a specific public key cryptographic algorithm.
Those methods perform tasks such as generating keys, signing, verifying,
encrypting, decrypting, and so on.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
.Fc
.Ft void
.Fo EVP_PKEY_meth_set_ctrl
.Fa "EVP_PKEY_METHOD *pmeth"
.Fa "int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)"
.Fa "int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)"
.Fc
.Ft void
.Fo EVP_PKEY_meth_set_check
.Fa "EVP_PKEY_METHOD *pmeth"
.Fa "int (*check)(EVP_PKEY *pkey)"
.Fc
.Ft void
.Fo EVP_PKEY_meth_set_public_check
.Fa "EVP_PKEY_METHOD *pmeth"
.Fa "int (*public_check)(EVP_PKEY *pkey)"
.Fc
.Ft void
.Fo EVP_PKEY_meth_set_param_check
.Fa "EVP_PKEY_METHOD *pmeth"
.Fa "int (*param_check)(EVP_PKEY *pkey)"
.Fc
.Sh DESCRIPTION
The
.Vt EVP_PKEY_METHOD
structure holds a set of methods
for a specific public key cryptographic algorithm.
Those methods perform tasks such as generating keys, signing, verifying,
encrypting, decrypting, and so on.
447
448
449
450
451
452
453















454
455
456
457
458
459
460
.Fn ctrl
and
.Fn ctrl_str
methods are used to adjust algorithm-specific settings.
See
.Xr EVP_PKEY_CTX_ctrl 3
for details.















.Ss Functions
.Fn EVP_PKEY_meth_new
creates a new
.Vt EVP_PKEY_METHOD
object with the given
.Fa id
and







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
.Fn ctrl
and
.Fn ctrl_str
methods are used to adjust algorithm-specific settings.
See
.Xr EVP_PKEY_CTX_ctrl 3
for details.
.Bd -unfilled
.Ft int Fn (*check) "EVP_PKEY *pkey"
.Ft int Fn (*public_check) "EVP_PKEY *pkey"
.Ft int Fn (*param_check) "EVP_PKEY *pkey"
.Ed
These methods are used to validate a key pair, the public component,
and the parameters for the given
.Fa pkey ,
respectively.
They are called by
.Xr EVP_PKEY_check 3 ,
.Xr EVP_PKEY_public_check 3 ,
and
.Xr EVP_PKEY_param_check 3 ,
respectively.
.Ss Functions
.Fn EVP_PKEY_meth_new
creates a new
.Vt EVP_PKEY_METHOD
object with the given
.Fa id
and
549
550
551
552
553
554
555







.Fn EVP_PKEY_meth_set_ctrl
first appeared in OpenSSL 1.0.0 and have been available since
.Ox 4.9 .
.Pp
.Fn EVP_PKEY_meth_copy
first appeared in OpenSSL 1.0.1 and has been available since
.Ox 5.3 .














>
>
>
>
>
>
>
582
583
584
585
586
587
588
589
590
591
592
593
594
595
.Fn EVP_PKEY_meth_set_ctrl
first appeared in OpenSSL 1.0.0 and have been available since
.Ox 4.9 .
.Pp
.Fn EVP_PKEY_meth_copy
first appeared in OpenSSL 1.0.1 and has been available since
.Ox 5.3 .
.Pp
.Fn EVP_PKEY_meth_set_check ,
.Fn EVP_PKEY_meth_set_public_check ,
and
.Fn EVP_PKEY_meth_set_param_check
first appeared in OpenSSL 1.1.1 and have been available since
.Ox 7.1 .
Changes to jni/libressl/man/EVP_PKEY_new.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_PKEY_new.3,v 1.16 2021/10/25 13:48:12 schwarze Exp $
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>
.\" and Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2002, 2018 The OpenSSL Project.  All rights reserved.
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_PKEY_new.3,v 1.17 2022/07/13 21:51:35 schwarze Exp $
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>
.\" and Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2002, 2018 The OpenSSL Project.  All rights reserved.
.\"
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: October 25 2021 $
.Dt EVP_PKEY_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_new ,
.Nm EVP_PKEY_up_ref ,
.Nm EVP_PKEY_free ,
.Nm EVP_PKEY_new_CMAC_key ,







|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt EVP_PKEY_NEW 3
.Os
.Sh NAME
.Nm EVP_PKEY_new ,
.Nm EVP_PKEY_up_ref ,
.Nm EVP_PKEY_free ,
.Nm EVP_PKEY_new_CMAC_key ,
183
184
185
186
187
188
189

190
191
192
193
194
195

196
197
198
199
200
201
202
.Sh SEE ALSO
.Xr CMAC_Init 3 ,
.Xr d2i_PrivateKey 3 ,
.Xr evp 3 ,
.Xr EVP_PKCS82PKEY 3 ,
.Xr EVP_PKEY_add1_attr 3 ,
.Xr EVP_PKEY_asn1_new 3 ,

.Xr EVP_PKEY_cmp 3 ,
.Xr EVP_PKEY_CTX_new 3 ,
.Xr EVP_PKEY_get_default_digest_nid 3 ,
.Xr EVP_PKEY_meth_new 3 ,
.Xr EVP_PKEY_print_private 3 ,
.Xr EVP_PKEY_set1_RSA 3 ,

.Xr X509_get_pubkey_parameters 3
.Sh HISTORY
.Fn EVP_PKEY_new
and
.Fn EVP_PKEY_free
first appeared in SSLeay 0.6.0 and have been available since
.Ox 2.4 .







>






>







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
.Sh SEE ALSO
.Xr CMAC_Init 3 ,
.Xr d2i_PrivateKey 3 ,
.Xr evp 3 ,
.Xr EVP_PKCS82PKEY 3 ,
.Xr EVP_PKEY_add1_attr 3 ,
.Xr EVP_PKEY_asn1_new 3 ,
.Xr EVP_PKEY_check 3 ,
.Xr EVP_PKEY_cmp 3 ,
.Xr EVP_PKEY_CTX_new 3 ,
.Xr EVP_PKEY_get_default_digest_nid 3 ,
.Xr EVP_PKEY_meth_new 3 ,
.Xr EVP_PKEY_print_private 3 ,
.Xr EVP_PKEY_set1_RSA 3 ,
.Xr EVP_PKEY_size 3 ,
.Xr X509_get_pubkey_parameters 3
.Sh HISTORY
.Fn EVP_PKEY_new
and
.Fn EVP_PKEY_free
first appeared in SSLeay 0.6.0 and have been available since
.Ox 2.4 .
Changes to jni/libressl/man/EVP_PKEY_set1_RSA.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.\" $OpenBSD: EVP_PKEY_set1_RSA.3,v 1.18 2021/07/02 11:48:01 schwarze Exp $
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The original file was written by by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2002, 2015, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
|



















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.\" $OpenBSD: EVP_PKEY_set1_RSA.3,v 1.19 2022/09/11 04:39:46 jsg Exp $
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2002, 2015, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 2 2021 $
.Dt EVP_PKEY_SET1_RSA 3
.Os
.Sh NAME
.Nm EVP_PKEY_set1_RSA ,
.Nm EVP_PKEY_set1_DSA ,
.Nm EVP_PKEY_set1_DH ,
.Nm EVP_PKEY_set1_EC_KEY ,







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 11 2022 $
.Dt EVP_PKEY_SET1_RSA 3
.Os
.Sh NAME
.Nm EVP_PKEY_set1_RSA ,
.Nm EVP_PKEY_set1_DSA ,
.Nm EVP_PKEY_set1_DH ,
.Nm EVP_PKEY_set1_EC_KEY ,
Added jni/libressl/man/EVP_PKEY_size.3.
































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
.\" $OpenBSD: EVP_PKEY_size.3,v 1.1 2022/07/13 19:10:40 schwarze Exp $
.\" full merge up to: OpenSSL eed9d03b Jan 8 11:04:15 2020 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The original file was written by Richard Levitte <levitte@openssl.org>.
.\" Copyright (c) 2020 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in
.\"    the documentation and/or other materials provided with the
.\"    distribution.
.\"
.\" 3. All advertising materials mentioning features or use of this
.\"    software must display the following acknowledgment:
.\"    "This product includes software developed by the OpenSSL Project
.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
.\"
.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
.\"    endorse or promote products derived from this software without
.\"    prior written permission. For written permission, please contact
.\"    openssl-core@openssl.org.
.\"
.\" 5. Products derived from this software may not be called "OpenSSL"
.\"    nor may "OpenSSL" appear in their names without prior written
.\"    permission of the OpenSSL Project.
.\"
.\" 6. Redistributions of any form whatsoever must retain the following
.\"    acknowledgment:
.\"    "This product includes software developed by the OpenSSL Project
.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt EVP_PKEY_SIZE 3
.Os
.Sh NAME
.Nm EVP_PKEY_size ,
.Nm EVP_PKEY_bits ,
.Nm EVP_PKEY_security_bits
.Nd EVP_PKEY information functions
.Sh SYNOPSIS
.In openssl/evp.h
.Ft int
.Fo EVP_PKEY_size
.Fa "const EVP_PKEY *pkey"
.Fc
.Ft int
.Fo EVP_PKEY_bits
.Fa "const EVP_PKEY *pkey"
.Fc
.Ft int
.Fo EVP_PKEY_security_bits
.Fa "const EVP_PKEY *pkey"
.Fc
.Sh DESCRIPTION
.Fn EVP_PKEY_size
returns the maximum size in bytes needed for the output buffer
for almost any operation that can be done with
.Fa pkey .
The primary use is with
.Xr EVP_SignFinal 3
and
.Xr EVP_SealInit 3 .
The returned size is also large enough for the output buffer of
.Xr EVP_PKEY_sign 3 ,
.Xr EVP_PKEY_encrypt 3 ,
.Xr EVP_PKEY_decrypt 3 ,
and
.Xr EVP_PKEY_derive 3 .
.Pp
Unless the documentation for the operation says otherwise,
the size returned by
.Fn EVP_PKEY_size
is only an upper limit and the final content of the target
buffer may be smaller.
It is therefore crucial to take note of the size given back by the
function that performs the operation.
For example,
.Xr EVP_PKEY_sign 3
returns that length in the
.Pf * Fa siglen
argument.
.Pp
Using
.Fn EVP_PKEY_size
is discouraged with
.Xr EVP_DigestSignFinal 3 .
.Pp
Most functions using an output buffer support passing
.Dv NULL
for the buffer and a pointer to an integer
to get the exact size that this function call delivers
in the context that it is called in.
This allows those functions to be called twice, once to find out the
exact buffer size, then allocate the buffer in between, and call that
function again to actually output the data.
For those functions, it isn't strictly necessary to call
.Fn EVP_PKEY_size
to find out the buffer size, but it may still be useful in cases
where it's desirable to know the upper limit in advance.
.Pp
By default,
.Fn EVP_PKEY_size
is supported for the following algorithms:
.Bl -column GOST01 "EVP_MAX_BLOCK_LENGTH = 32"
.It        Ta same result as from:
.It CMAC   Ta Dv EVP_MAX_BLOCK_LENGTH No = 32
.It DH     Ta Xr DH_size 3
.It DSA    Ta Xr DSA_size 3
.It EC     Ta Xr ECDSA_size 3
.It GOST01 Ta 64 or 128
.It HMAC   Ta Dv EVP_MAX_MD_SIZE No = 64
.It RSA    Ta Xr RSA_size 3
.El
.Pp
The application program can support additional algorithms by calling
.Xr EVP_PKEY_asn1_set_public 3 .
.Pp
.Fn EVP_PKEY_bits
returns the cryptographic length of the cryptosystem to which the key in
.Fa pkey
belongs, in bits.
The definition of cryptographic length is specific to the key cryptosystem.
By default, the following algorithms are supported:
.Bl -column GOST01 "the public domain parameter p" DSA_bits(3)
.It        Ta cryptographic length = Ta same result as from:
.It        Ta significant bits in ... Ta
.It DH     Ta the public domain parameter Fa p Ta Xr DH_bits 3
.It DSA    Ta the public domain parameter Fa p Ta Xr DSA_bits 3
.It EC     Ta the order of the group Ta Xr EC_GROUP_order_bits 3
.It GOST01 Ta 256 or 512 Ta \(em
.It RSA    Ta the public modulus Ta Xr RSA_bits 3
.El
.Pp
The application program can support additional algorithms by calling
.Xr EVP_PKEY_asn1_set_public 3 .
.Pp
.Fn EVP_PKEY_security_bits
returns the security strength measured in bits of the given
.Fa pkey
as defined in NIST SP800-57.
By default, the following algorithms are supported:
.Bl -column GOST01 DSA_security_bits(3)
.It        Ta same result as from:
.It DH     Ta Xr DH_security_bits 3
.It DSA    Ta Xr DSA_security_bits 3
.It EC     Ta Xr EC_GROUP_order_bits 3 divided by 2
.It GOST01 Ta not supported, return value is \-2
.It RSA    Ta Xr RSA_security_bits 3
.El
.Pp
For EC keys, if the result is greater than 80, it is rounded down
to 256, 192, 128, 112, or 80.
.Pp
The application program can support additional algorithms by calling
.Xr EVP_PKEY_asn1_set_security_bits 3 .
.Sh RETURN VALUES
.Fn EVP_PKEY_size
and
.Fn EVP_PKEY_bits
return a positive number or 0 if this size isn't available.
.Pp
.Fn EVP_PKEY_security_bits
returns a number in the range from 0 to 256 inclusive
or \-2 if this function is unsupported for the algorithm used by
.Fa pkey .
It returns 0 if
.Fa pkey
is
.Dv NULL .
.Sh SEE ALSO
.Xr EVP_PKEY_decrypt 3 ,
.Xr EVP_PKEY_derive 3 ,
.Xr EVP_PKEY_encrypt 3 ,
.Xr EVP_PKEY_new 3 ,
.Xr EVP_PKEY_sign 3 ,
.Xr EVP_SealInit 3 ,
.Xr EVP_SignFinal 3
.Sh HISTORY
.Fn EVP_PKEY_size
first appeared in SSLeay 0.6.0 and
.Fn EVP_PKEY_bits
in SSLeay 0.9.0.
Both functions have been available since
.Ox 2.4 .
.Pp
.Fn EVP_PKEY_security_bits
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 7.2 .
Changes to jni/libressl/man/EVP_SignInit.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_SignInit.3,v 1.15 2022/03/31 17:27:17 naddy Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\" selective merge up to: OpenSSL 79b49fb0 Mar 20 10:03:10 2018 +1000
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2000-2002, 2005, 2006, 2014-2016 The OpenSSL Project.
.\" All rights reserved.
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: EVP_SignInit.3,v 1.16 2022/07/13 19:10:40 schwarze Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\" selective merge up to: OpenSSL 79b49fb0 Mar 20 10:03:10 2018 +1000
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2000-2002, 2005, 2006, 2014-2016 The OpenSSL Project.
.\" All rights reserved.
.\"
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dt EVP_SIGNINIT 3
.Os
.Sh NAME
.Nm EVP_SignInit_ex ,
.Nm EVP_SignUpdate ,
.Nm EVP_SignFinal ,
.Nm EVP_SignInit ,
.Nm EVP_PKEY_size ,
.Nm EVP_PKEY_bits
.Nd EVP signing functions
.Sh SYNOPSIS
.In openssl/evp.h
.Ft int
.Fo EVP_SignInit_ex
.Fa "EVP_MD_CTX *ctx"
.Fa "const EVP_MD *type"







|






|
<
<







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60


61
62
63
64
65
66
67
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt EVP_SIGNINIT 3
.Os
.Sh NAME
.Nm EVP_SignInit_ex ,
.Nm EVP_SignUpdate ,
.Nm EVP_SignFinal ,
.Nm EVP_SignInit


.Nd EVP signing functions
.Sh SYNOPSIS
.In openssl/evp.h
.Ft int
.Fo EVP_SignInit_ex
.Fa "EVP_MD_CTX *ctx"
.Fa "const EVP_MD *type"
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
.Fa "EVP_PKEY *pkey"
.Fc
.Ft void
.Fo EVP_SignInit
.Fa "EVP_MD_CTX *ctx"
.Fa "const EVP_MD *type"
.Fc
.Ft int
.Fo EVP_PKEY_size
.Fa "const EVP_PKEY *pkey"
.Fc
.Ft int
.Fo EVP_PKEY_bits
.Fa "const EVP_PKEY *pkey"
.Fc
.Sh DESCRIPTION
The EVP signature routines are a high level interface to digital
signatures.
.Pp
.Fn EVP_SignInit_ex
sets up a signing context
.Fa ctx







<
<
<
<
<
<
<
<







81
82
83
84
85
86
87








88
89
90
91
92
93
94
.Fa "EVP_PKEY *pkey"
.Fc
.Ft void
.Fo EVP_SignInit
.Fa "EVP_MD_CTX *ctx"
.Fa "const EVP_MD *type"
.Fc








.Sh DESCRIPTION
The EVP signature routines are a high level interface to digital
signatures.
.Pp
.Fn EVP_SignInit_ex
sets up a signing context
.Fa ctx
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
.Fa ctx
using the private key
.Fa pkey
and places the signature in
.Fa sig .
.Fa sig
must be at least
.Fn EVP_PKEY_size pkey
bytes in size.
.Fa s
is an OUT parameter, and not used as an IN parameter.
The number of bytes of data written (i.e.\&
the length of the signature) will be written to the integer at
.Fa s .
At most
.Fn EVP_PKEY_size pkey
bytes will be written.
.Pp
.Fn EVP_SignInit
initializes a signing context
.Fa ctx
to use the default implementation of digest
.Fa type .
.Pp
.Fn EVP_PKEY_size
returns the maximum size of a signature in bytes.
The actual signature returned by
.Fn EVP_SignFinal
may be smaller.
.Pp
The EVP interface to digital signatures should almost always be
used in preference to the low level interfaces.
This is because the code then becomes transparent to the algorithm used
and much more flexible.
.Pp
The call to
.Fn EVP_SignFinal







|







|








<
<
<
<
<
<







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141






142
143
144
145
146
147
148
.Fa ctx
using the private key
.Fa pkey
and places the signature in
.Fa sig .
.Fa sig
must be at least
.Xr EVP_PKEY_size 3
bytes in size.
.Fa s
is an OUT parameter, and not used as an IN parameter.
The number of bytes of data written (i.e.\&
the length of the signature) will be written to the integer at
.Fa s .
At most
.Xr EVP_PKEY_size 3
bytes will be written.
.Pp
.Fn EVP_SignInit
initializes a signing context
.Fa ctx
to use the default implementation of digest
.Fa type .
.Pp






The EVP interface to digital signatures should almost always be
used in preference to the low level interfaces.
This is because the code then becomes transparent to the algorithm used
and much more flexible.
.Pp
The call to
.Fn EVP_SignFinal
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
.Sh RETURN VALUES
.Fn EVP_SignInit_ex ,
.Fn EVP_SignUpdate ,
and
.Fn EVP_SignFinal
return 1 for success and 0 for failure.
.Pp
.Fn EVP_PKEY_size
returns the maximum size of a signature in bytes.
.Pp
.Fn EVP_PKEY_bits
returns the number of significant bits in the key
or 0 if an error occurs.
.Pp
The error codes can be obtained by
.Xr ERR_get_error 3 .
.Sh SEE ALSO
.Xr evp 3 ,
.Xr EVP_DigestInit 3 ,
.Xr EVP_PKEY_asn1_set_public 3 ,

.Xr EVP_VerifyInit 3
.Sh HISTORY
.Fn EVP_SignInit ,
.Fn EVP_SignUpdate ,
and
.Fn EVP_SignFinal
first appeared in SSLeay 0.5.1.
.Fn EVP_PKEY_size
first appeared in SSLeay 0.6.0.
.Fn EVP_PKEY_bits
first appeared in SSLeay 0.9.0.
These functions have been available since
.Ox 2.4 .
.Pp
.Fn EVP_SignInit_ex
first appeared in OpenSSL 0.9.7 and has been available since
.Ox 3.2 .
.Sh BUGS
Older versions of this documentation wrongly stated that calls to







<
<
<
<
<
<
<






>






|
<
<
<
<
<







160
161
162
163
164
165
166







167
168
169
170
171
172
173
174
175
176
177
178
179
180





181
182
183
184
185
186
187
.Sh RETURN VALUES
.Fn EVP_SignInit_ex ,
.Fn EVP_SignUpdate ,
and
.Fn EVP_SignFinal
return 1 for success and 0 for failure.
.Pp







The error codes can be obtained by
.Xr ERR_get_error 3 .
.Sh SEE ALSO
.Xr evp 3 ,
.Xr EVP_DigestInit 3 ,
.Xr EVP_PKEY_asn1_set_public 3 ,
.Xr EVP_PKEY_size 3 ,
.Xr EVP_VerifyInit 3
.Sh HISTORY
.Fn EVP_SignInit ,
.Fn EVP_SignUpdate ,
and
.Fn EVP_SignFinal
first appeared in SSLeay 0.5.1 and have been available since





.Ox 2.4 .
.Pp
.Fn EVP_SignInit_ex
first appeared in OpenSSL 0.9.7 and has been available since
.Ox 3.2 .
.Sh BUGS
Older versions of this documentation wrongly stated that calls to
Changes to jni/libressl/man/Makefile.am.
38
39
40
41
42
43
44

45
46
47
48
49
50
51
dist_man3_MANS += SSL_CTX_set_min_proto_version.3
dist_man3_MANS += SSL_CTX_set_mode.3
dist_man3_MANS += SSL_CTX_set_msg_callback.3
dist_man3_MANS += SSL_CTX_set_num_tickets.3
dist_man3_MANS += SSL_CTX_set_options.3
dist_man3_MANS += SSL_CTX_set_quiet_shutdown.3
dist_man3_MANS += SSL_CTX_set_read_ahead.3

dist_man3_MANS += SSL_CTX_set_session_cache_mode.3
dist_man3_MANS += SSL_CTX_set_session_id_context.3
dist_man3_MANS += SSL_CTX_set_ssl_version.3
dist_man3_MANS += SSL_CTX_set_timeout.3
dist_man3_MANS += SSL_CTX_set_tlsext_servername_callback.3
dist_man3_MANS += SSL_CTX_set_tlsext_status_cb.3
dist_man3_MANS += SSL_CTX_set_tlsext_ticket_key_cb.3







>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
dist_man3_MANS += SSL_CTX_set_min_proto_version.3
dist_man3_MANS += SSL_CTX_set_mode.3
dist_man3_MANS += SSL_CTX_set_msg_callback.3
dist_man3_MANS += SSL_CTX_set_num_tickets.3
dist_man3_MANS += SSL_CTX_set_options.3
dist_man3_MANS += SSL_CTX_set_quiet_shutdown.3
dist_man3_MANS += SSL_CTX_set_read_ahead.3
dist_man3_MANS += SSL_CTX_set_security_level.3
dist_man3_MANS += SSL_CTX_set_session_cache_mode.3
dist_man3_MANS += SSL_CTX_set_session_id_context.3
dist_man3_MANS += SSL_CTX_set_ssl_version.3
dist_man3_MANS += SSL_CTX_set_timeout.3
dist_man3_MANS += SSL_CTX_set_tlsext_servername_callback.3
dist_man3_MANS += SSL_CTX_set_tlsext_status_cb.3
dist_man3_MANS += SSL_CTX_set_tlsext_ticket_key_cb.3
293
294
295
296
297
298
299

300
301
302

303
304
305
306
307
308
309
310
311
312
313
314

315
316
317
318
319
320
321
dist_man3_MANS += EVP_DigestVerifyInit.3
dist_man3_MANS += EVP_EncodeInit.3
dist_man3_MANS += EVP_EncryptInit.3
dist_man3_MANS += EVP_OpenInit.3
dist_man3_MANS += EVP_PKCS82PKEY.3
dist_man3_MANS += EVP_PKEY_CTX_ctrl.3
dist_man3_MANS += EVP_PKEY_CTX_new.3

dist_man3_MANS += EVP_PKEY_add1_attr.3
dist_man3_MANS += EVP_PKEY_asn1_get_count.3
dist_man3_MANS += EVP_PKEY_asn1_new.3

dist_man3_MANS += EVP_PKEY_cmp.3
dist_man3_MANS += EVP_PKEY_decrypt.3
dist_man3_MANS += EVP_PKEY_derive.3
dist_man3_MANS += EVP_PKEY_encrypt.3
dist_man3_MANS += EVP_PKEY_get_default_digest_nid.3
dist_man3_MANS += EVP_PKEY_keygen.3
dist_man3_MANS += EVP_PKEY_meth_get0_info.3
dist_man3_MANS += EVP_PKEY_meth_new.3
dist_man3_MANS += EVP_PKEY_new.3
dist_man3_MANS += EVP_PKEY_print_private.3
dist_man3_MANS += EVP_PKEY_set1_RSA.3
dist_man3_MANS += EVP_PKEY_sign.3

dist_man3_MANS += EVP_PKEY_verify.3
dist_man3_MANS += EVP_PKEY_verify_recover.3
dist_man3_MANS += EVP_SealInit.3
dist_man3_MANS += EVP_SignInit.3
dist_man3_MANS += EVP_VerifyInit.3
dist_man3_MANS += EVP_aes_128_cbc.3
dist_man3_MANS += EVP_camellia_128_cbc.3







>



>












>







294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
dist_man3_MANS += EVP_DigestVerifyInit.3
dist_man3_MANS += EVP_EncodeInit.3
dist_man3_MANS += EVP_EncryptInit.3
dist_man3_MANS += EVP_OpenInit.3
dist_man3_MANS += EVP_PKCS82PKEY.3
dist_man3_MANS += EVP_PKEY_CTX_ctrl.3
dist_man3_MANS += EVP_PKEY_CTX_new.3
dist_man3_MANS += EVP_PKEY_CTX_set_hkdf_md.3
dist_man3_MANS += EVP_PKEY_add1_attr.3
dist_man3_MANS += EVP_PKEY_asn1_get_count.3
dist_man3_MANS += EVP_PKEY_asn1_new.3
dist_man3_MANS += EVP_PKEY_check.3
dist_man3_MANS += EVP_PKEY_cmp.3
dist_man3_MANS += EVP_PKEY_decrypt.3
dist_man3_MANS += EVP_PKEY_derive.3
dist_man3_MANS += EVP_PKEY_encrypt.3
dist_man3_MANS += EVP_PKEY_get_default_digest_nid.3
dist_man3_MANS += EVP_PKEY_keygen.3
dist_man3_MANS += EVP_PKEY_meth_get0_info.3
dist_man3_MANS += EVP_PKEY_meth_new.3
dist_man3_MANS += EVP_PKEY_new.3
dist_man3_MANS += EVP_PKEY_print_private.3
dist_man3_MANS += EVP_PKEY_set1_RSA.3
dist_man3_MANS += EVP_PKEY_sign.3
dist_man3_MANS += EVP_PKEY_size.3
dist_man3_MANS += EVP_PKEY_verify.3
dist_man3_MANS += EVP_PKEY_verify_recover.3
dist_man3_MANS += EVP_SealInit.3
dist_man3_MANS += EVP_SignInit.3
dist_man3_MANS += EVP_VerifyInit.3
dist_man3_MANS += EVP_aes_128_cbc.3
dist_man3_MANS += EVP_camellia_128_cbc.3
396
397
398
399
400
401
402

403
404
405
406
407
408
409
dist_man3_MANS += RSA_meth_new.3
dist_man3_MANS += RSA_new.3
dist_man3_MANS += RSA_padding_add_PKCS1_type_1.3
dist_man3_MANS += RSA_pkey_ctx_ctrl.3
dist_man3_MANS += RSA_print.3
dist_man3_MANS += RSA_private_encrypt.3
dist_man3_MANS += RSA_public_encrypt.3

dist_man3_MANS += RSA_set_method.3
dist_man3_MANS += RSA_sign.3
dist_man3_MANS += RSA_sign_ASN1_OCTET_STRING.3
dist_man3_MANS += RSA_size.3
dist_man3_MANS += SHA1.3
dist_man3_MANS += SMIME_crlf_copy.3
dist_man3_MANS += SMIME_read_ASN1.3







>







400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
dist_man3_MANS += RSA_meth_new.3
dist_man3_MANS += RSA_new.3
dist_man3_MANS += RSA_padding_add_PKCS1_type_1.3
dist_man3_MANS += RSA_pkey_ctx_ctrl.3
dist_man3_MANS += RSA_print.3
dist_man3_MANS += RSA_private_encrypt.3
dist_man3_MANS += RSA_public_encrypt.3
dist_man3_MANS += RSA_security_bits.3
dist_man3_MANS += RSA_set_method.3
dist_man3_MANS += RSA_sign.3
dist_man3_MANS += RSA_sign_ASN1_OCTET_STRING.3
dist_man3_MANS += RSA_size.3
dist_man3_MANS += SHA1.3
dist_man3_MANS += SMIME_crlf_copy.3
dist_man3_MANS += SMIME_read_ASN1.3
572
573
574
575
576
577
578

579

580
581
582


583


584
585
586
587
588
589
590
	ln -sf "AES_encrypt.3" "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"

	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"

	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"


	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"


	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
	ln -sf "ASN1_NULL_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
	ln -sf "ASN1_STRING_TABLE_add.3" "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"







>

>



>
>

>
>







577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
	ln -sf "AES_encrypt.3" "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get_int64.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set_int64.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_int64.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_uint64.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_int64.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_uint64.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
	ln -sf "ASN1_NULL_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
	ln -sf "ASN1_STRING_TABLE_add.3" "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"
706
707
708
709
710
711
712

713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"

	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/bio_info_cb.3"
	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"







>









<







717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733

734
735
736
737
738
739
740
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_info_cb.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"

	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"
1090
1091
1092
1093
1094
1095
1096

1097
1098
1099
1100
1101
1102
1103
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
	ln -sf "DH_generate_key.3" "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_check.3"

	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"







>







1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
	ln -sf "DH_generate_key.3" "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_check.3"
	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_check_pub_key.3"
	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"
1131
1132
1133
1134
1135
1136
1137


1138
1139
1140
1141
1142
1143
1144
1145
1146
1147

1148
1149
1150
1151
1152
1153
1154
	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"


	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_free.3"
	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_verify.3"

	ln -sf "ECDH_compute_key.3" "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"







>
>










>







1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_get0_name.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set1_name.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_free.3"
	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_verify.3"
	ln -sf "DSA_size.3" "$(DESTDIR)$(mandir)/man3/DSA_bits.3"
	ln -sf "ECDH_compute_key.3" "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"
1573
1574
1575
1576
1577
1578
1579




1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596

1597
1598
1599

1600
1601




1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621

1622
1623
1624
1625
1626
1627
1628
1629

1630

1631
1632
1633
1634
1635
1636
1637
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"




	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"

	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"

	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"




	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
	ln -sf "EVP_PKEY_decrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
	ln -sf "EVP_PKEY_encrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"

	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"

	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"

	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"







>
>
>
>

















>



>


>
>
>
>




















>








>

>







1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"
	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_add1_hkdf_info.3"
	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_hkdf_mode.3"
	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_key.3"
	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_salt.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_check.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param_check.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public_check.3"
	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_security_bits.3"
	ln -sf "EVP_PKEY_check.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_param_check.3"
	ln -sf "EVP_PKEY_check.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_public_check.3"
	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
	ln -sf "EVP_PKEY_decrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
	ln -sf "EVP_PKEY_encrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_check.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_param_check.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_public_check.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"
1659
1660
1661
1662
1663
1664
1665


1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
	ln -sf "EVP_PKEY_sign.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"


	ln -sf "EVP_PKEY_verify.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
	ln -sf "EVP_PKEY_verify_recover.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"
	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_size.3"
	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
	ln -sf "EVP_aes_128_cbc.3" "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"







>
>




<
<







1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699


1700
1701
1702
1703
1704
1705
1706
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
	ln -sf "EVP_PKEY_sign.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"
	ln -sf "EVP_PKEY_size.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
	ln -sf "EVP_PKEY_size.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_security_bits.3"
	ln -sf "EVP_PKEY_verify.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
	ln -sf "EVP_PKEY_verify_recover.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"


	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
	ln -sf "EVP_aes_128_cbc.3" "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"
2167
2168
2169
2170
2171
2172
2173



2174
2175
2176
2177
2178
2179
2180
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
	ln -sf "RSA_private_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
	ln -sf "RSA_public_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"



	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
	ln -sf "RSA_sign.3" "$(DESTDIR)$(mandir)/man3/RSA_verify.3"







>
>
>







2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
	ln -sf "RSA_private_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
	ln -sf "RSA_public_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"
	ln -sf "RSA_security_bits.3" "$(DESTDIR)$(mandir)/man3/BN_security_bits.3"
	ln -sf "RSA_security_bits.3" "$(DESTDIR)$(mandir)/man3/DH_security_bits.3"
	ln -sf "RSA_security_bits.3" "$(DESTDIR)$(mandir)/man3/DSA_security_bits.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
	ln -sf "RSA_sign.3" "$(DESTDIR)$(mandir)/man3/RSA_verify.3"
2341
2342
2343
2344
2345
2346
2347



2348
2349
2350
2351
2352
2353
2354
	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"



	ln -sf "SSL_CTX_set_session_cache_mode.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
	ln -sf "SSL_CTX_set_session_id_context.3" "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
	ln -sf "SSL_CTX_set_timeout.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
	ln -sf "SSL_CTX_set_tlsext_servername_callback.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"







>
>
>







2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"
	ln -sf "SSL_CTX_set_security_level.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_security_level.3"
	ln -sf "SSL_CTX_set_security_level.3" "$(DESTDIR)$(mandir)/man3/SSL_get_security_level.3"
	ln -sf "SSL_CTX_set_security_level.3" "$(DESTDIR)$(mandir)/man3/SSL_set_security_level.3"
	ln -sf "SSL_CTX_set_session_cache_mode.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
	ln -sf "SSL_CTX_set_session_id_context.3" "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
	ln -sf "SSL_CTX_set_timeout.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
	ln -sf "SSL_CTX_set_tlsext_servername_callback.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"
2799
2800
2801
2802
2803
2804
2805

2806
2807
2808
2809
2810
2811

2812
2813
2814
2815
2816
2817
2818
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"

	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"

	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"







>






>







2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_time.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_auth_level.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2c_ASN1_INTEGER.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"







<







3037
3038
3039
3040
3041
3042
3043

3044
3045
3046
3047
3048
3049
3050
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"

	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"
3451
3452
3453
3454
3455
3456
3457

3458

3459
3460
3461


3462


3463
3464
3465
3466
3467
3468
3469
	-rm -f "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"


	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"


	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"







>

>



>
>

>
>







3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
	-rm -f "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get_int64.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set_int64.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_int64.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_uint64.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_int64.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_uint64.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"
3585
3586
3587
3588
3589
3590
3591

3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/bio_info_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"







>









<







3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642

3643
3644
3645
3646
3647
3648
3649
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_info_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"
3969
3970
3971
3972
3973
3974
3975

3976
3977
3978
3979
3980
3981
3982
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_check.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"







>







4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_check_pub_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"
4010
4011
4012
4013
4014
4015
4016


4017
4018
4019
4020
4021
4022
4023
4024
4025
4026

4027
4028
4029
4030
4031
4032
4033
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"


	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_verify.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"







>
>










>







4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_get0_name.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set1_name.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_verify.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"
4452
4453
4454
4455
4456
4457
4458




4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475

4476
4477
4478

4479
4480




4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500

4501
4502
4503
4504
4505
4506
4507
4508

4509

4510
4511
4512
4513
4514
4515
4516
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"




	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"




	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"







>
>
>
>

















>



>


>
>
>
>




















>








>

>







4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_add1_hkdf_info.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_hkdf_mode.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_key.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_salt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_security_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_param_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_public_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_param_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_public_check.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"
4538
4539
4540
4541
4542
4543
4544


4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"


	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_size.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"







>
>




<
<







4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608


4609
4610
4611
4612
4613
4614
4615
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_security_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"


	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"
5046
5047
5048
5049
5050
5051
5052



5053
5054
5055
5056
5057
5058
5059
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"



	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_verify.3"







>
>
>







5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/BN_security_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DH_security_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_security_bits.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_verify.3"
5220
5221
5222
5223
5224
5225
5226



5227
5228
5229
5230
5231
5232
5233
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"



	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"







>
>
>







5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_security_level.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_security_level.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_security_level.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"
5678
5679
5680
5681
5682
5683
5684

5685
5686
5687
5688
5689
5690

5691
5692
5693
5694
5695
5696
5697
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"







>






>







5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_time.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_auth_level.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2c_ASN1_INTEGER.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"







<







5946
5947
5948
5949
5950
5951
5952

5953
5954
5955
5956
5957
5958
5959
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"

	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"
Changes to jni/libressl/man/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177


178
179
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
man5dir = $(mandir)/man5
NROFF = nroff
MANS = $(dist_man3_MANS) $(dist_man5_MANS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(dist_man3_MANS) $(dist_man5_MANS) \
	$(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







|



|
|
|









>
>










>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
man5dir = $(mandir)/man5
NROFF = nroff
MANS = $(dist_man3_MANS) $(dist_man5_MANS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(dist_man3_MANS) $(dist_man5_MANS) \
	$(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
317
318
319
320
321
322
323

324
325
326
327
328
329
330
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_min_proto_version.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_mode.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_msg_callback.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_num_tickets.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_options.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_quiet_shutdown.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_read_ahead.3 \

@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_session_cache_mode.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_session_id_context.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_ssl_version.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_timeout.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_tlsext_servername_callback.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_tlsext_status_cb.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_tlsext_ticket_key_cb.3 \







>







320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_min_proto_version.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_mode.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_msg_callback.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_num_tickets.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_options.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_quiet_shutdown.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_read_ahead.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_security_level.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_session_cache_mode.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_session_id_context.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_ssl_version.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_timeout.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_tlsext_servername_callback.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_tlsext_status_cb.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SSL_CTX_set_tlsext_ticket_key_cb.3 \
497
498
499
500
501
502
503

504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_DigestInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_DigestSignInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_DigestVerifyInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_EncodeInit.3 EVP_EncryptInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_OpenInit.3 EVP_PKCS82PKEY.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_CTX_ctrl.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_CTX_new.3 \

@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_add1_attr.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_asn1_get_count.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_asn1_new.3 EVP_PKEY_cmp.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_decrypt.3 EVP_PKEY_derive.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_encrypt.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_get_default_digest_nid.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_keygen.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_meth_get0_info.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_meth_new.3 EVP_PKEY_new.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_print_private.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_set1_RSA.3 EVP_PKEY_sign.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_verify.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_verify_recover.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_SealInit.3 EVP_SignInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_VerifyInit.3 EVP_aes_128_cbc.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_camellia_128_cbc.3 EVP_des_cbc.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_rc4.3 EVP_sm3.3 EVP_sm4_cbc.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_whirlpool.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EXTENDED_KEY_USAGE_new.3 \







>


|
|
|






|







501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_DigestInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_DigestSignInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_DigestVerifyInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_EncodeInit.3 EVP_EncryptInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_OpenInit.3 EVP_PKCS82PKEY.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_CTX_ctrl.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_CTX_new.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_CTX_set_hkdf_md.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_add1_attr.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_asn1_get_count.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_asn1_new.3 EVP_PKEY_check.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_cmp.3 EVP_PKEY_decrypt.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_derive.3 EVP_PKEY_encrypt.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_get_default_digest_nid.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_keygen.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_meth_get0_info.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_meth_new.3 EVP_PKEY_new.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_print_private.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_set1_RSA.3 EVP_PKEY_sign.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_size.3 EVP_PKEY_verify.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_PKEY_verify_recover.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_SealInit.3 EVP_SignInit.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_VerifyInit.3 EVP_aes_128_cbc.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_camellia_128_cbc.3 EVP_des_cbc.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_rc4.3 EVP_sm3.3 EVP_sm4_cbc.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EVP_whirlpool.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	EXTENDED_KEY_USAGE_new.3 \
566
567
568
569
570
571
572

573
574
575
576
577
578
579
580
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_generate_key.3 RSA_get0_key.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_get_ex_new_index.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_meth_new.3 RSA_new.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_padding_add_PKCS1_type_1.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_pkey_ctx_ctrl.3 RSA_print.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_private_encrypt.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_public_encrypt.3 \

@ENABLE_LIBTLS_ONLY_FALSE@	RSA_set_method.3 RSA_sign.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_sign_ASN1_OCTET_STRING.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_size.3 SHA1.3 SMIME_crlf_copy.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_read_ASN1.3 SMIME_read_CMS.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_read_PKCS7.3 SMIME_text.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_write_ASN1.3 SMIME_write_CMS.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_write_PKCS7.3 STACK_OF.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SXNET_new.3 TS_REQ_new.3 \







>
|







571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_generate_key.3 RSA_get0_key.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_get_ex_new_index.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_meth_new.3 RSA_new.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_padding_add_PKCS1_type_1.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_pkey_ctx_ctrl.3 RSA_print.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_private_encrypt.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_public_encrypt.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_security_bits.3 RSA_set_method.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_sign.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_sign_ASN1_OCTET_STRING.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	RSA_size.3 SHA1.3 SMIME_crlf_copy.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_read_ASN1.3 SMIME_read_CMS.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_read_PKCS7.3 SMIME_text.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_write_ASN1.3 SMIME_write_CMS.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SMIME_write_PKCS7.3 STACK_OF.3 \
@ENABLE_LIBTLS_ONLY_FALSE@	SXNET_new.3 TS_REQ_new.3 \
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
tags TAGS:

ctags CTAGS:

cscope cscopelist:


distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







817
818
819
820
821
822
823

824
825
826
827
828
829
830
	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
tags TAGS:

ctags CTAGS:

cscope cscopelist:


distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
985
986
987
988
989
990
991

992

993
994
995


996


997
998
999
1000
1001
1002
1003
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "AES_encrypt.3" "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"


@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"


@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_NULL_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_STRING_TABLE_add.3" "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"







>

>



>
>

>
>







990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "AES_encrypt.3" "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_num_asc.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_BIT_STRING_set.3" "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_uint64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_uint64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_INTEGER_get.3" "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_NULL_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_OBJECT_new.3" "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ASN1_STRING_TABLE_add.3" "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"
1119
1120
1121
1122
1123
1124
1125

1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/bio_info_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"







>









<







1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146

1147
1148
1149
1150
1151
1152
1153
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_info_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_ctrl.3" "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_dump.3" "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "BIO_f_asn1.3" "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"
1503
1504
1505
1506
1507
1508
1509

1510
1511
1512
1513
1514
1515
1516
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_generate_key.3" "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_check.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"







>







1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DES_set_key.3" "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_generate_key.3" "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_check_pub_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_generate_parameters.3" "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DH_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"
1544
1545
1546
1547
1548
1549
1550


1551
1552
1553
1554
1555
1556
1557
1558
1559
1560

1561
1562
1563
1564
1565
1566
1567
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"


@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_verify.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDH_compute_key.3" "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"







>
>










>







1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get0_pqg.3" "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_get_ex_new_index.3" "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_get0_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set1_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_meth_new.3" "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_new.3" "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_set_method.3" "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_sign.3" "$(DESTDIR)$(mandir)/man3/DSA_verify.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "DSA_size.3" "$(DESTDIR)$(mandir)/man3/DSA_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDH_compute_key.3" "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "ECDSA_SIG_new.3" "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"
1986
1987
1988
1989
1990
1991
1992




1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009

2010
2011
2012

2013
2014




2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034

2035
2036
2037
2038
2039
2040
2041
2042

2043

2044
2045
2046
2047
2048
2049
2050
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"




@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"




@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_decrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_encrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"







>
>
>
>

















>



>


>
>
>
>




















>








>

>







2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_ctrl.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_add1_hkdf_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_hkdf_mode.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_CTX_set_hkdf_md.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_salt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_add1_attr.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_get_count.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_asn1_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_check.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_param_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_check.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_public_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_cmp.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_decrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_derive.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_encrypt.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_keygen.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_param_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_public_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_meth_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_new.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"
2072
2073
2074
2075
2076
2077
2078


2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_sign.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"


@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_verify.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_verify_recover.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_size.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_aes_128_cbc.3" "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"







>
>




<
<







2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112


2113
2114
2115
2116
2117
2118
2119
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_set1_RSA.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_sign.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_size.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_size.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_verify.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_PKEY_verify_recover.3" "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SealInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"


@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_SignInit.3" "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_VerifyInit.3" "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "EVP_aes_128_cbc.3" "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"
2580
2581
2582
2583
2584
2585
2586



2587
2588
2589
2590
2591
2592
2593
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_private_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_public_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"



@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_sign.3" "$(DESTDIR)$(mandir)/man3/RSA_verify.3"







>
>
>







2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_print.3" "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_private_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_public_encrypt.3" "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_security_bits.3" "$(DESTDIR)$(mandir)/man3/BN_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_security_bits.3" "$(DESTDIR)$(mandir)/man3/DH_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_security_bits.3" "$(DESTDIR)$(mandir)/man3/DSA_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_set_method.3" "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "RSA_sign.3" "$(DESTDIR)$(mandir)/man3/RSA_verify.3"
2754
2755
2756
2757
2758
2759
2760



2761
2762
2763
2764
2765
2766
2767
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"



@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_session_cache_mode.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_session_id_context.3" "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_timeout.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_tlsext_servername_callback.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"







>
>
>







2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_quiet_shutdown.3" "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_read_ahead.3" "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_security_level.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_security_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_security_level.3" "$(DESTDIR)$(mandir)/man3/SSL_get_security_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_security_level.3" "$(DESTDIR)$(mandir)/man3/SSL_set_security_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_session_cache_mode.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_session_id_context.3" "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_ssl_version.3" "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_timeout.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "SSL_CTX_set_tlsext_servername_callback.3" "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"
3212
3213
3214
3215
3216
3217
3218

3219
3220
3221
3222
3223
3224

3225
3226
3227
3228
3229
3230
3231
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"







>






>







3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_time.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_auth_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_VERIFY_PARAM_set_flags.3" "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "X509_add1_trust_object.3" "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2c_ASN1_INTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"







<







3450
3451
3452
3453
3454
3455
3456

3457
3458
3459
3460
3461
3462
3463
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"

@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	ln -sf "d2i_ASN1_OCTET_STRING.3" "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"
3864
3865
3866
3867
3868
3869
3870

3871

3872
3873
3874


3875


3876
3877
3878
3879
3880
3881
3882
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"


@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"


@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"







>

>



>
>

>
>







3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/AES_set_encrypt_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_name_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_get_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_BIT_STRING_set_bit.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_get_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_set_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_ENUMERATED_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_cmp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_get_uint64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_int64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_set_uint64.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_INTEGER_to_BN.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BN_to_ASN1_INTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_NULL_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_create.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_OBJECT_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ASN1_STRING_TABLE_cleanup.3"
3998
3999
4000
4001
4002
4003
4004

4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/bio_info_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"







>









<







4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055

4056
4057
4058
4059
4060
4061
4062
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_callback_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ctrl_wpending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_eof.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_flush.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_get_info_callback.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_info_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_int_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_pending.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_ptr_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_reset.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_seek.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_close.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_set_info_callback.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_tell.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_wpending.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_dump_indent_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_get_suffix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_prefix.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BIO_asn1_set_suffix.3"
4382
4383
4384
4385
4386
4387
4388

4389
4390
4391
4392
4393
4394
4395
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_check.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"







>







4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_key_unchecked.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_set_odd_parity.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_2keys.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_string_to_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DES_xcbc_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_compute_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_check_pub_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_generate_parameters_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_engine.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_get0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_set_flags.3"
4423
4424
4425
4426
4427
4428
4429


4430
4431
4432
4433
4434
4435
4436
4437
4438
4439

4440
4441
4442
4443
4444
4445
4446
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"


@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_verify.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"







>
>










>







4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set0_pqg.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_test_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_ex_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_get0_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set1_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_finish.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_up_ref.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_sign_setup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_verify.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDH_size.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_OpenSSL.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_SIG_set0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/ECDSA_do_sign_ex.3"
4865
4866
4867
4868
4869
4870
4871




4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888

4889
4890
4891

4892
4893




4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913

4914
4915
4916
4917
4918
4919
4920
4921

4922

4923
4924
4925
4926
4927
4928
4929
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"




@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"




@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"







>
>
>
>

















>



>


>
>
>
>




















>








>

>







4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_outlen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_ecdh_kdf_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_signature_md.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_dup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_new_id.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_add1_hkdf_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_hkdf_mode.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_key.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set1_hkdf_salt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_add1_attr_by_txt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_delete_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_NID.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_by_OBJ.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get_attr_count.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_find_str.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_get0_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_get0_asn1.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_add_alias.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_param_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_private.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_public_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_asn1_set_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_param_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_public_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_cmp_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_copy_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_missing_parameters.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_decrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_derive_set_peer.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_encrypt_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_get_keygen_info.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_app_data.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_CTX_set_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_gen_cb.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_keygen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_paramgen_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_add0.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_find.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_cleanup.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_copy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_ctrl.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_derive.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_encrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_keygen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_param_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_paramgen.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_public_check.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_sign.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_signctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verify_recover.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_meth_set_verifyctx.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_free.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_new_CMAC_key.3"
4951
4952
4953
4954
4955
4956
4957


4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"


@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_size.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"







>
>




<
<







5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021


5022
5023
5024
5025
5026
5027
5028
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_id.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DH.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_DSA.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set1_EC_KEY.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_set_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_type.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_sign_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_PKEY_verify_recover_init.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SealUpdate.3"


@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_SignUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyFinal.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyInit_ex.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_VerifyUpdate.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/EVP_aes_128_cbc_hmac_sha1.3"
5459
5460
5461
5462
5463
5464
5465



5466
5467
5468
5469
5470
5471
5472
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"



@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_verify.3"







>
>
>







5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSAparams_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_print_fp.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_public_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_private_decrypt.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/BN_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DH_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/DSA_security_bits.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_PKCS1_SSLeay.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_get_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_new_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_set_default_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/RSA_verify.3"
5633
5634
5635
5636
5637
5638
5639



5640
5641
5642
5643
5644
5645
5646
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"



@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"







>
>
>







5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_quiet_shutdown.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_default_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_read_ahead.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_security_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_security_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_security_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_session_cache_mode.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_session_id_context.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_get_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_set_ssl_method.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_get_timeout.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/SSL_CTX_set_tlsext_servername_arg.3"
6091
6092
6093
6094
6095
6096
6097

6098
6099
6100
6101
6102
6103

6104
6105
6106
6107
6108
6109
6110
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"







>






>







6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add0_policy.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_add1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_clear_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get0_peername.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_flags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_get_time.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_email.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_host.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_ip_asc.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_name.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set1_policies.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_auth_level.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_depth.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_hostflags.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_purpose.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_time.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_VERIFY_PARAM_set_trust.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_add1_reject_object.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/X509_reject_clear.3"
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2c_ASN1_INTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"







<







6359
6360
6361
6362
6363
6364
6365

6366
6367
6368
6369
6370
6371
6372
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UINTEGER.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UNIVERSALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTCTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_UTF8STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_ASN1_VISIBLESTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DIRECTORYSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/d2i_DISPLAYTEXT.3"

@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BIT_STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_BMPSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_ENUMERATED.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALIZEDTIME.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_GENERALSTRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_IA5STRING.3"
@ENABLE_LIBTLS_ONLY_FALSE@	-rm -f "$(DESTDIR)$(mandir)/man3/i2d_ASN1_INTEGER.3"
Changes to jni/libressl/man/OBJ_NAME_add.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: OBJ_NAME_add.3,v 1.2 2021/12/18 17:47:45 schwarze Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: December 18 2021 $
.Dt OBJ_NAME_ADD 3
.Os
.Sh NAME
.Nm OBJ_NAME_add ,
.Nm OBJ_NAME_remove ,
.Nm OBJ_NAME_get ,
.Nm OBJ_NAME_new_index ,
|















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: OBJ_NAME_add.3,v 1.3 2022/09/10 10:22:46 jsg Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 10 2022 $
.Dt OBJ_NAME_ADD 3
.Os
.Sh NAME
.Nm OBJ_NAME_add ,
.Nm OBJ_NAME_remove ,
.Nm OBJ_NAME_get ,
.Nm OBJ_NAME_new_index ,
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
already exists.
Consequently, it is possible to define an alias
before setting the associated value.
.Pp
.Fn OBJ_NAME_remove
removes the key-value pair or alias with the key
.Pq Fa name , type
from the array, it it exists.
Otherwise, it has no effect.
If the bit
.Dv OBJ_NAME_ALIAS
is set in the
.Fa type
argument, it is ignored and cleared before using the
.Fa type .







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
already exists.
Consequently, it is possible to define an alias
before setting the associated value.
.Pp
.Fn OBJ_NAME_remove
removes the key-value pair or alias with the key
.Pq Fa name , type
from the array, if it exists.
Otherwise, it has no effect.
If the bit
.Dv OBJ_NAME_ALIAS
is set in the
.Fa type
argument, it is ignored and cleared before using the
.Fa type .
Changes to jni/libressl/man/RSA_new.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: RSA_new.3,v 1.16 2019/11/01 12:02:58 schwarze Exp $
.\" full merge up to:
.\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100
.\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final)
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: RSA_new.3,v 1.17 2022/07/13 21:51:35 schwarze Exp $
.\" full merge up to:
.\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100
.\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final)
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: November 1 2019 $
.Dt RSA_NEW 3
.Os
.Sh NAME
.Nm RSA_new ,
.Nm RSAPrivateKey_dup ,
.Nm RSAPublicKey_dup ,
.Nm RSA_up_ref ,







|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt RSA_NEW 3
.Os
.Sh NAME
.Nm RSA_new ,
.Nm RSAPrivateKey_dup ,
.Nm RSAPublicKey_dup ,
.Nm RSA_up_ref ,
226
227
228
229
230
231
232

233
234
235
236
237
238
239
.Xr RSA_meth_new 3 ,
.Xr RSA_padding_add_PKCS1_type_1 3 ,
.Xr RSA_pkey_ctx_ctrl 3 ,
.Xr RSA_print 3 ,
.Xr RSA_private_encrypt 3 ,
.Xr RSA_PSS_PARAMS_new 3 ,
.Xr RSA_public_encrypt 3 ,

.Xr RSA_set_method 3 ,
.Xr RSA_sign 3 ,
.Xr RSA_sign_ASN1_OCTET_STRING 3 ,
.Xr RSA_size 3
.Sh STANDARDS
SSL, PKCS #1 v2.0
.Pp







>







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
.Xr RSA_meth_new 3 ,
.Xr RSA_padding_add_PKCS1_type_1 3 ,
.Xr RSA_pkey_ctx_ctrl 3 ,
.Xr RSA_print 3 ,
.Xr RSA_private_encrypt 3 ,
.Xr RSA_PSS_PARAMS_new 3 ,
.Xr RSA_public_encrypt 3 ,
.Xr RSA_security_bits 3 ,
.Xr RSA_set_method 3 ,
.Xr RSA_sign 3 ,
.Xr RSA_sign_ASN1_OCTET_STRING 3 ,
.Xr RSA_size 3
.Sh STANDARDS
SSL, PKCS #1 v2.0
.Pp
Added jni/libressl/man/RSA_security_bits.3.


















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
.\" $OpenBSD: RSA_security_bits.3,v 1.1 2022/07/13 17:32:16 schwarze Exp $
.\"
.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt RSA_SECURITY_BITS 3
.Os
.Sh NAME
.Nm RSA_security_bits ,
.Nm DSA_security_bits ,
.Nm DH_security_bits ,
.Nm BN_security_bits
.Nd get security strength
.Sh SYNOPSIS
.In openssl/rsa.h
.Ft int
.Fn RSA_security_bits "const RSA *rsa"
.In openssl/dsa.h
.Ft int
.Fn DSA_security_bits "const DSA *dsa"
.In openssl/dh.h
.Ft int
.Fn DH_security_bits "const DH *dh"
.In openssl/bn.h
.Ft int
.Fo BN_security_bits
.Fa "int pubbits"
.Fa "int privbits"
.Fc
.Sh DESCRIPTION
These functions return the security strength of some specific types of
cryptographic keys, measured in bits.
It is approximately the binary logarithm of the number of operations
an attacker has to perform in order to break the key.
.Pp
.Fn RSA_security_bits
uses only the number of significant bits in the public modulus of
.Fa rsa
as returned by
.Xr RSA_bits 3 .
It returns
.Bl -column 256 for 15360 last_column -offset indent
.It 256 Ta for Ta 15360 Ta or more significant bits
.It 192 Ta     Ta  7680 Ta
.It 128 Ta     Ta  3072 Ta
.It 112 Ta     Ta  2048 Ta
.It  80 Ta     Ta  1024 Ta
.El
.Pp
or 0 otherwise.
.Pp
.Fn DSA_security_bits
uses the number of significant bits in the public domain parameter
.Fa p
contained in the
.Fa dsa
object, which is equal to the size of the public key, in the same way as
.Fn RSA_security_bits .
In addition, the public domain parameter
.Fa q
contained in the
.Fa dsa
object, which is equal to the size of the private key, is inspected.
The return value is either the security strength according to the above table
or half the size of the private key, whichever is smaller.
If the return value would be smaller than 80, 0 is returned instead.
.Pp
.Fn DH_security_bits
uses the number of significant bits in the shared secret contained in the
.Fa dh
object as returned by
.Xr DH_bits 3
in the same way as
.Fn RSA_security_bits .
If
.Fa dh
contains the domain parameter
.Fa q ,
its number of significant bits is used in the same way as for
.Fn DSA_security_bits
to limit the return value.
Otherwise, if
.Fa dh
contains the length of the secret exponent in bits,
that number is used.
If neither is available, only the above table is used
without calculating a minimum.
.Pp
.Fn BN_security_bits
is a combined function.
If \-1 is passed for the
.Fa privbits
argument, it behaves like
.Fn RSA_security_bits .
Otherwise, it behaves like
.Fn DSA_security_bits .
.Sh RETURN VALUES
All these functions return numbers in the range from 0 to 256 inclusive.
.Pp
.Fn DSA_security_bits
fails and returns \-1 unless both of the
.Fa p
and
.Fa q
domain parameters are present.
.Sh SEE ALSO
.Xr BN_num_bits 3 ,
.Xr DH_bits 3 ,
.Xr DH_get0_pqg 3 ,
.Xr DSA_get0_pqg 3 ,
.Xr RSA_bits 3 ,
.Xr SSL_CTX_set_security_level 3
.Rs
.%A Elaine Barker
.%T Recommendation for Key Management
.%I U.S. National Institute of Standards and Technology
.%R NIST Special Publication 800-57 Part 1 Revision 5
.%U https://doi.org/10.6028/NIST.SP.800-57pt1r5
.%C Gaithersburg, MD
.%D May 2020
.Re
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0
and have been available since
.Ox 7.2 .
Changes to jni/libressl/man/RSA_size.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: RSA_size.3,v 1.9 2018/03/27 17:35:50 schwarze Exp $
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org> and
.\" Kurt Roeckx <kurt@roeckx.be>.
.\" Copyright (c) 2000, 2002, 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: RSA_size.3,v 1.10 2022/07/13 21:51:35 schwarze Exp $
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org> and
.\" Kurt Roeckx <kurt@roeckx.be>.
.\" Copyright (c) 2000, 2002, 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 27 2018 $
.Dt RSA_SIZE 3
.Os
.Sh NAME
.Nm RSA_size ,
.Nm RSA_bits
.Nd get the RSA modulus size
.Sh SYNOPSIS







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt RSA_SIZE 3
.Os
.Sh NAME
.Nm RSA_size ,
.Nm RSA_bits
.Nd get the RSA modulus size
.Sh SYNOPSIS
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
must not be
.Dv NULL .
.Sh RETURN VALUES
The size.
.Sh SEE ALSO
.Xr BN_num_bits 3 ,
.Xr RSA_get0_key 3 ,
.Xr RSA_new 3

.Sh HISTORY
.Fn RSA_size
first appeared in SSLeay 0.4.4 and has been available since
.Ox 2.4 .
.Pp
.Fn RSA_bits
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 6.3 .







|
>








81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
must not be
.Dv NULL .
.Sh RETURN VALUES
The size.
.Sh SEE ALSO
.Xr BN_num_bits 3 ,
.Xr RSA_get0_key 3 ,
.Xr RSA_new 3 ,
.Xr RSA_security_bits 3
.Sh HISTORY
.Fn RSA_size
first appeared in SSLeay 0.4.4 and has been available since
.Ox 2.4 .
.Pp
.Fn RSA_bits
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 6.3 .
Changes to jni/libressl/man/SSL_CIPHER_get_name.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.13 2022/01/15 23:38:50 jsg Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
.\"
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>,
.\" Dr. Stephen Henson <steve@openssl.org>, Todd Short <tshort@akamai.com>,
.\" and Paul Yang <yang.yang@baishancloud.com>.
.\" Copyright (c) 2000, 2005, 2009, 2013, 2014, 2015, 2016, 2017
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.14 2022/07/17 08:51:07 jsg Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
.\"
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>,
.\" Dr. Stephen Henson <steve@openssl.org>, Todd Short <tshort@akamai.com>,
.\" and Paul Yang <yang.yang@baishancloud.com>.
.\" Copyright (c) 2000, 2005, 2009, 2013, 2014, 2015, 2016, 2017
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: January 15 2022 $
.Dt SSL_CIPHER_GET_NAME 3
.Os
.Sh NAME
.Nm SSL_CIPHER_get_name ,
.Nm SSL_CIPHER_get_bits ,
.Nm SSL_CIPHER_get_version ,
.Nm SSL_CIPHER_get_cipher_nid ,







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 17 2022 $
.Dt SSL_CIPHER_GET_NAME 3
.Os
.Sh NAME
.Nm SSL_CIPHER_get_name ,
.Nm SSL_CIPHER_get_bits ,
.Nm SSL_CIPHER_get_version ,
.Nm SSL_CIPHER_get_cipher_nid ,
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
is the representation of anonymous ciphers.
.It Enc= Ns Aq Ar symmetric encryption method
Encryption method with number of secret bits:
.Sy 3DES(168) ,
.Sy RC4(128) ,
.Sy AES(128) ,
.Sy AES(256) ,
.Sy AESCGM(128) ,
.Sy AESCGM(256) ,
.Sy Camellia(128) ,
.Sy Camellia(256) ,
.Sy ChaCha20-Poly1305 ,
.Sy GOST-28178-89-CNT ,
or
.Sy None .
.It Mac= Ns Aq Ar message authentication code







|
|







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
is the representation of anonymous ciphers.
.It Enc= Ns Aq Ar symmetric encryption method
Encryption method with number of secret bits:
.Sy 3DES(168) ,
.Sy RC4(128) ,
.Sy AES(128) ,
.Sy AES(256) ,
.Sy AESGCM(128) ,
.Sy AESGCM(256) ,
.Sy Camellia(128) ,
.Sy Camellia(256) ,
.Sy ChaCha20-Poly1305 ,
.Sy GOST-28178-89-CNT ,
or
.Sy None .
.It Mac= Ns Aq Ar message authentication code
Changes to jni/libressl/man/SSL_CTX_new.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_CTX_new.3,v 1.16 2021/04/15 16:30:14 tb Exp $
.\" full merge up to: OpenSSL 21cd6e00 Oct 21 14:40:15 2015 +0100
.\" selective merge up to: OpenSSL 8f75443f May 24 14:04:26 2019 +0200
.\"
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
.\" Copyright (c) 2000, 2005, 2012, 2013, 2015, 2016 The OpenSSL Project.
.\" All rights reserved.
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_CTX_new.3,v 1.17 2022/07/13 22:05:53 schwarze Exp $
.\" full merge up to: OpenSSL 21cd6e00 Oct 21 14:40:15 2015 +0100
.\" selective merge up to: OpenSSL 8f75443f May 24 14:04:26 2019 +0200
.\"
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
.\" Copyright (c) 2000, 2005, 2012, 2013, 2015, 2016 The OpenSSL Project.
.\" All rights reserved.
.\"
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: April 15 2021 $
.Dt SSL_CTX_NEW 3
.Os
.Sh NAME
.Nm SSL_CTX_new ,
.Nm SSL_CTX_up_ref ,
.Nm TLS_method ,
.Nm TLS_server_method ,







|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt SSL_CTX_NEW 3
.Os
.Sh NAME
.Nm SSL_CTX_new ,
.Nm SSL_CTX_up_ref ,
.Nm TLS_method ,
.Nm TLS_server_method ,
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
.Fn DTLSv1_2_client_method void
.Sh DESCRIPTION
.Fn SSL_CTX_new
creates a new
.Vt SSL_CTX
object as a framework to establish TLS or DTLS enabled connections.
It initializes the list of ciphers, the session cache setting, the
callbacks, the keys and certificates, and the options to its default
values.
.Pp
An
.Vt SSL_CTX
object is reference counted.
Creating a new
.Vt SSL_CTX
object sets its reference count to 1.







|
|







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
.Fn DTLSv1_2_client_method void
.Sh DESCRIPTION
.Fn SSL_CTX_new
creates a new
.Vt SSL_CTX
object as a framework to establish TLS or DTLS enabled connections.
It initializes the list of ciphers, the session cache setting, the
callbacks, the keys and certificates, the options, and the security
level to its default values.
.Pp
An
.Vt SSL_CTX
object is reference counted.
Creating a new
.Vt SSL_CTX
object sets its reference count to 1.
280
281
282
283
284
285
286

287
288
289
290
291
292
293
functions return pointers to constant static objects.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_accept 3 ,
.Xr SSL_CTX_free 3 ,
.Xr SSL_CTX_set_min_proto_version 3 ,
.Xr SSL_CTX_set_options 3 ,

.Xr SSL_set_connect_state 3
.Sh HISTORY
.Fn SSL_CTX_new
first appeared in SSLeay 0.5.1.
.Fn SSLv23_method ,
.Fn SSLv23_server_method ,
and







>







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
functions return pointers to constant static objects.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_accept 3 ,
.Xr SSL_CTX_free 3 ,
.Xr SSL_CTX_set_min_proto_version 3 ,
.Xr SSL_CTX_set_options 3 ,
.Xr SSL_CTX_set_security_level 3 ,
.Xr SSL_set_connect_state 3
.Sh HISTORY
.Fn SSL_CTX_new
first appeared in SSLeay 0.5.1.
.Fn SSLv23_method ,
.Fn SSLv23_server_method ,
and
Added jni/libressl/man/SSL_CTX_set_security_level.3.






























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
.\" $OpenBSD: SSL_CTX_set_security_level.3,v 1.1 2022/07/13 20:52:36 schwarze Exp $
.\"
.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt SSL_CTX_SET_SECURITY_LEVEL 3
.Os
.Sh NAME
.Nm SSL_CTX_set_security_level ,
.Nm SSL_set_security_level ,
.Nm SSL_CTX_get_security_level ,
.Nm SSL_get_security_level
.Nd change security level for TLS
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft void
.Fo SSL_CTX_set_security_level
.Fa "SSL_CTX *ctx"
.Fa "int level"
.Fc
.Ft void
.Fo SSL_set_security_level
.Fa "SSL *s"
.Fa "int level"
.Fc
.Ft int
.Fo SSL_CTX_get_security_level
.Fa "const SSL_CTX *ctx"
.Fc
.Ft int
.Fo SSL_get_security_level
.Fa "const SSL *s"
.Fc
.Sh DESCRIPTION
A security level is a set of restrictions on algorithms, key lengths,
protocol versions, and other features in TLS connections.
These restrictions apply in addition to those that exist from individually
selecting supported features, for example ciphers, curves, or algorithms.
.Pp
The following table shows properties of the various security levels:
.Bl -column # sec 15360 ECC TLS SHA1 -offset indent
.It # Ta   sec Ta   \0\0RSA Ta   ECC Ta TLS Ta MAC
.It 0 Ta \0\00 Ta \0\0\0\00 Ta \0\00 Ta 1.0 Ta MD5
.It 1 Ta  \080 Ta    \01024 Ta   160 Ta 1.0 Ta RC4
.It 2 Ta   112 Ta    \02048 Ta   224 Ta 1.0 Ta
.It 3 Ta   128 Ta    \03072 Ta   256 Ta 1.1 Ta SHA1
.It 4 Ta   192 Ta    \07680 Ta   384 Ta 1.2 Ta
.It 5 Ta   256 Ta     15360 Ta   512 Ta 1.2 Ta
.El
.Pp
The meaning of the columns is as follows:
.Pp
.Bl -tag -width features -compact
.It #
The number of the
.Fa level .
.It sec
The minimum security strength measured in bits, which is approximately
the binary logarithm of the number of operations an attacker has
to perform in order to break a cryptographic key.
This minimum strength is enforced for all relevant parameters
including cipher suite encryption algorithms, ECC curves, signature
algorithms, DH parameter sizes, and certificate algorithms and key
sizes.
See SP800-57 below
.Sx SEE ALSO
for details on individual algorithms.
.It RSA
The minimum key length in bits for the RSA, DSA, and DH algorithms.
.It ECC
The minimum key length in bits for ECC algorithms.
.It TLS
The minimum TLS protocol version.
.It MAC
Cipher suites using the given MACs are allowed on this level
and on lower levels, but not on higher levels.
.El
.Pp
Level 0 is only provided for backward compatibility and permits everything.
.Pp
Level 3 and higher disable support for session tickets
and only accept cipher suites that provide forward secrecy.
.Pp
The functions
.Fn SSL_CTX_set_security_level
and
.Fn SSL_set_security_level
choose the security
.Fa level
for
.Fa ctx
or
.Fa s ,
respectively.
If not set, security level 1 is used.
.Pp
.Xr SSL_CTX_new 3
initializes the security level of the new object to 1.
.Pp
.Xr SSL_new 3
and
.Xr SSL_set_SSL_CTX 3
copy the security level from the context to the SSL object.
.Pp
.Xr SSL_dup 3
copies the security level from the old to the new object.
.Sh RETURN VALUES
.Fn SSL_CTX_get_security_level
and
.Fn SSL_get_security_level
return the security level configured in
.Fa ctx
or
.Fa s ,
respectively.
.Sh SEE ALSO
.Xr EVP_PKEY_security_bits 3 ,
.Xr RSA_security_bits 3 ,
.Xr ssl 3 ,
.Xr SSL_CTX_new 3 ,
.Xr SSL_new 3
.Rs
.%A Elaine Barker
.%T Recommendation for Key Management
.%I U.S. National Institute of Standards and Technology
.%R NIST Special Publication 800-57 Part 1 Revision 5
.%U https://doi.org/10.6028/NIST.SP.800-57pt1r5
.%C Gaithersburg, MD
.%D May 2020
.Re
.Sh HISTORY
These functions first appeared in OpenSSL 1.1.0
and have been available since
.Ox 7.2 .
.Sh CAVEATS
Applications which do not check the return values
of configuration functions will misbehave.
For example, if an application does not check the return value
after trying to set a certificate and the certificate is rejected
because of the security level, the application may behave as if
no certificate had been provided at all.
.Pp
While some restrictions may be handled gracefully by negotiations
between the client and the server, other restrictions may be
fatal and abort the TLS handshake.
For example, this can happen if the peer certificate contains a key
that is too short or if the DH parameter size is too small.
Changes to jni/libressl/man/SSL_dup.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: SSL_dup.3,v 1.4 2019/06/12 09:36:30 schwarze Exp $
.\"
.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: June 12 2019 $
.Dt SSL_DUP 3
.Os
.Sh NAME
.Nm SSL_dup
.Nd deep copy of an SSL object
.Sh SYNOPSIS
.In openssl/ssl.h
|















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: SSL_dup.3,v 1.5 2022/07/13 22:05:53 schwarze Exp $
.\"
.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt SSL_DUP 3
.Os
.Sh NAME
.Nm SSL_dup
.Nd deep copy of an SSL object
.Sh SYNOPSIS
.In openssl/ssl.h
50
51
52
53
54
55
56
57

58
59
60
61
.Dv NULL
on failure.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_clear 3 ,
.Xr SSL_copy_session_id 3 ,
.Xr SSL_free 3 ,
.Xr SSL_new 3

.Sh HISTORY
.Fn SSL_dup
first appeared in SSLeay 0.8.0 and has been available since
.Ox 2.4 .







|
>




50
51
52
53
54
55
56
57
58
59
60
61
62
.Dv NULL
on failure.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_clear 3 ,
.Xr SSL_copy_session_id 3 ,
.Xr SSL_free 3 ,
.Xr SSL_new 3 ,
.Xr SSL_set_security_level 3
.Sh HISTORY
.Fn SSL_dup
first appeared in SSLeay 0.8.0 and has been available since
.Ox 2.4 .
Changes to jni/libressl/man/SSL_new.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_new.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $
.\" full merge up to: OpenSSL 1c7ae3dd Mar 29 19:17:55 2017 +1000
.\"
.\" This file was written by Richard Levitte <levitte@openssl.org>
.\" and Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2000, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_new.3,v 1.7 2022/07/13 22:05:53 schwarze Exp $
.\" full merge up to: OpenSSL 1c7ae3dd Mar 29 19:17:55 2017 +1000
.\"
.\" This file was written by Richard Levitte <levitte@openssl.org>
.\" and Matt Caswell <matt@openssl.org>.
.\" Copyright (c) 2000, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 27 2018 $
.Dt SSL_NEW 3
.Os
.Sh NAME
.Nm SSL_new ,
.Nm SSL_up_ref
.Nd create a new SSL structure for a connection
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft SSL *
.Fn SSL_new "SSL_CTX *ctx"
.Ft int
.Fn SSL_up_ref "SSL *ssl"
.Sh DESCRIPTION
.Fn SSL_new
creates a new
.Vt SSL
structure which is needed to hold the data for a TLS/SSL connection.
The new structure inherits the settings of the underlying context
.Fa ctx :
connection method, options, verification settings,
timeout settings.
The reference count of the new structure is set to 1.
.Pp
.Fn SSL_up_ref
increments the reference count of
.Fa ssl
by 1.
.Sh RETURN VALUES







|




















|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt SSL_NEW 3
.Os
.Sh NAME
.Nm SSL_new ,
.Nm SSL_up_ref
.Nd create a new SSL structure for a connection
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft SSL *
.Fn SSL_new "SSL_CTX *ctx"
.Ft int
.Fn SSL_up_ref "SSL *ssl"
.Sh DESCRIPTION
.Fn SSL_new
creates a new
.Vt SSL
structure which is needed to hold the data for a TLS/SSL connection.
The new structure inherits the settings of the underlying context
.Fa ctx :
connection method, options, verification settings,
timeout settings, security level.
The reference count of the new structure is set to 1.
.Pp
.Fn SSL_up_ref
increments the reference count of
.Fa ssl
by 1.
.Sh RETURN VALUES
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107
108
109
.Pp
.Fn SSL_up_ref
returns 1 for success or 0 for failure.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_clear 3 ,
.Xr SSL_CTX_set_options 3 ,

.Xr SSL_free 3 ,
.Xr SSL_get_SSL_CTX 3
.Sh HISTORY
.Fn SSL_new
appeared in SSLeay 0.4 or earlier and has been available since
.Ox 2.4 .
.Pp
.Fn SSL_up_ref
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 6.3 .







>










93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
.Pp
.Fn SSL_up_ref
returns 1 for success or 0 for failure.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_clear 3 ,
.Xr SSL_CTX_set_options 3 ,
.Xr SSL_CTX_set_security_level 3 ,
.Xr SSL_free 3 ,
.Xr SSL_get_SSL_CTX 3
.Sh HISTORY
.Fn SSL_new
appeared in SSLeay 0.4 or earlier and has been available since
.Ox 2.4 .
.Pp
.Fn SSL_up_ref
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 6.3 .
Changes to jni/libressl/man/SSL_set1_param.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_set1_param.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $
.\" full merge up to:
.\" OpenSSL man3/SSL_CTX_get0_param 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: SSL_set1_param.3,v 1.6 2022/09/10 10:22:46 jsg Exp $
.\" full merge up to:
.\" OpenSSL man3/SSL_CTX_get0_param 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 12 2019 $
.Dt SSL_SET1_PARAM 3
.Os
.Sh NAME
.Nm SSL_CTX_get0_param ,
.Nm SSL_get0_param ,
.Nm SSL_CTX_set1_param ,
.Nm SSL_set1_param







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 10 2022 $
.Dt SSL_SET1_PARAM 3
.Os
.Sh NAME
.Nm SSL_CTX_get0_param ,
.Nm SSL_get0_param ,
.Nm SSL_CTX_set1_param ,
.Nm SSL_set1_param
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.Fn SSL_get0_param
retrieve an internal pointer to the verification parameters for
.Fa ctx
or
.Fa ssl ,
respectively.
The returned pointer must not be freed by the calling application,
but the application can modify the parameters pointed to
to suit its needs: for example to add a hostname check.
.Pp
.Fn SSL_CTX_set1_param
and
.Fn SSL_set1_param
set the verification parameters to
.Fa vpm







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.Fn SSL_get0_param
retrieve an internal pointer to the verification parameters for
.Fa ctx
or
.Fa ssl ,
respectively.
The returned pointer must not be freed by the calling application,
but the application can modify the parameters pointed to,
to suit its needs: for example to add a hostname check.
.Pp
.Fn SSL_CTX_set1_param
and
.Fn SSL_set1_param
set the verification parameters to
.Fa vpm
Changes to jni/libressl/man/SSL_set_SSL_CTX.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: SSL_set_SSL_CTX.3,v 1.3 2020/09/22 13:27:08 schwarze Exp $
.\"
.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 22 2020 $
.Dt SSL_SET_SSL_CTX 3
.Os
.Sh NAME
.Nm SSL_set_SSL_CTX
.Nd modify an SSL connection object to use another context
.Sh SYNOPSIS
.In openssl/ssl.h
|















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: SSL_set_SSL_CTX.3,v 1.4 2022/07/13 22:05:53 schwarze Exp $
.\"
.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt SSL_SET_SSL_CTX 3
.Os
.Sh NAME
.Nm SSL_set_SSL_CTX
.Nd modify an SSL connection object to use another context
.Sh SYNOPSIS
.In openssl/ssl.h
55
56
57
58
59
60
61
62

63
64
65
66
.Dv NULL
if memory allocation fails.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_clear 3 ,
.Xr SSL_CTX_new 3 ,
.Xr SSL_get_SSL_CTX 3 ,
.Xr SSL_new 3

.Sh HISTORY
.Fn SSL_set_SSL_CTX
first appeared in OpenSSL 0.9.8f and has been available since
.Ox 4.5 .







|
>




55
56
57
58
59
60
61
62
63
64
65
66
67
.Dv NULL
if memory allocation fails.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_clear 3 ,
.Xr SSL_CTX_new 3 ,
.Xr SSL_get_SSL_CTX 3 ,
.Xr SSL_new 3 ,
.Xr SSL_set_security_level 3
.Sh HISTORY
.Fn SSL_set_SSL_CTX
first appeared in OpenSSL 0.9.8f and has been available since
.Ox 4.5 .
Changes to jni/libressl/man/X509_NAME_get_index_by_NID.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: X509_NAME_get_index_by_NID.3,v 1.12 2019/06/14 13:59:32 schwarze Exp $
.\"	OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2002, 2006, 2014, 2015, 2016 The OpenSSL Project.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: X509_NAME_get_index_by_NID.3,v 1.13 2022/07/02 17:09:09 jsing Exp $
.\"	OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2002, 2006, 2014, 2015, 2016 The OpenSSL Project.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 14 2019 $
.Dt X509_NAME_GET_INDEX_BY_NID 3
.Os
.Sh NAME
.Nm X509_NAME_get_index_by_NID ,
.Nm X509_NAME_get_index_by_OBJ ,
.Nm X509_NAME_entry_count ,
.Nm X509_NAME_get_entry ,







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 2 2022 $
.Dt X509_NAME_GET_INDEX_BY_NID 3
.Os
.Sh NAME
.Nm X509_NAME_get_index_by_NID ,
.Nm X509_NAME_get_index_by_OBJ ,
.Nm X509_NAME_entry_count ,
.Nm X509_NAME_get_entry ,
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
.Dv NULL ,
nothing is written, but the return value is calculated as usual.
.Pp
All relevant
.Dv NID_*
and
.Dv OBJ_*
codes can be found in the header files
.In openssl/obj_mac.h
and
.In openssl/objects.h .
.Pp
Applications which could pass invalid NIDs to
.Fn X509_NAME_get_index_by_NID
should check for the return value of -2.
Alternatively the NID validity can be determined first by checking that
.Fn OBJ_nid2obj nid
is not







|
|
|
<







153
154
155
156
157
158
159
160
161
162

163
164
165
166
167
168
169
.Dv NULL ,
nothing is written, but the return value is calculated as usual.
.Pp
All relevant
.Dv NID_*
and
.Dv OBJ_*
codes can be found in the
.In openssl/objects.h
header file.

.Pp
Applications which could pass invalid NIDs to
.Fn X509_NAME_get_index_by_NID
should check for the return value of -2.
Alternatively the NID validity can be determined first by checking that
.Fn OBJ_nid2obj nid
is not
Changes to jni/libressl/man/X509_STORE_CTX_get_error.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.22 2022/02/03 18:05:31 tb Exp $
.\" full merge up to:
.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100
.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.23 2022/05/19 07:04:41 tb Exp $
.\" full merge up to:
.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100
.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: February 3 2022 $
.Dt X509_STORE_CTX_GET_ERROR 3
.Os
.Sh NAME
.Nm X509_STORE_CTX_get_error ,
.Nm X509_STORE_CTX_set_error ,
.Nm X509_STORE_CTX_get_error_depth ,
.Nm X509_STORE_CTX_set_error_depth ,







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: May 19 2022 $
.Dt X509_STORE_CTX_GET_ERROR 3
.Os
.Sh NAME
.Nm X509_STORE_CTX_get_error ,
.Nm X509_STORE_CTX_set_error ,
.Nm X509_STORE_CTX_get_error_depth ,
.Nm X509_STORE_CTX_set_error_depth ,
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
subject key identifier was present and did not match the authority key
identifier current certificate.
This is only set if issuer check debugging is enabled; it is used for
status notification and is
.Sy not
in itself an error.
.It Dv X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH : \
 Noauthority and issuer serial number mismatch
The current candidate issuer certificate was rejected because its issuer
name and serial number was present and did not match the authority key
identifier of the current certificate.
This is only set if issuer check debugging is enabled; it is used for
status notification and is
.Sy not
in itself an error.







|







462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
subject key identifier was present and did not match the authority key
identifier current certificate.
This is only set if issuer check debugging is enabled; it is used for
status notification and is
.Sy not
in itself an error.
.It Dv X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH : \
 No authority and issuer serial number mismatch
The current candidate issuer certificate was rejected because its issuer
name and serial number was present and did not match the authority key
identifier of the current certificate.
This is only set if issuer check debugging is enabled; it is used for
status notification and is
.Sy not
in itself an error.
Changes to jni/libressl/man/X509_VERIFY_PARAM_new.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: X509_VERIFY_PARAM_new.3,v 1.3 2021/11/13 18:50:31 schwarze Exp $
.\"
.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 13 2021 $
.Dt X509_VERIFY_PARAM_NEW 3
.Os
.Sh NAME
.Nm X509_VERIFY_PARAM_new ,
.Nm X509_VERIFY_PARAM_inherit ,
.Nm X509_VERIFY_PARAM_set1 ,
.Nm X509_VERIFY_PARAM_free ,
|















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: X509_VERIFY_PARAM_new.3,v 1.4 2022/09/10 10:22:46 jsg Exp $
.\"
.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 10 2022 $
.Dt X509_VERIFY_PARAM_NEW 3
.Os
.Sh NAME
.Nm X509_VERIFY_PARAM_new ,
.Nm X509_VERIFY_PARAM_inherit ,
.Nm X509_VERIFY_PARAM_set1 ,
.Nm X509_VERIFY_PARAM_free ,
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
.Dv X509_V_FLAG_USE_CHECK_TIME
is not set in the
.Fa destination
object, whereas the time value in the
.Fa destination
object is not inspected before overwriting it
.It
the acceptable policy set set with
.Xr X509_VERIFY_PARAM_set1_policies 3
.It
the maximum verification depth set with
.Xr X509_VERIFY_PARAM_set_depth 3
.It
the list of expected DNS hostnames built with
.Xr X509_VERIFY_PARAM_set1_host 3







|







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
.Dv X509_V_FLAG_USE_CHECK_TIME
is not set in the
.Fa destination
object, whereas the time value in the
.Fa destination
object is not inspected before overwriting it
.It
the acceptable policy set with
.Xr X509_VERIFY_PARAM_set1_policies 3
.It
the maximum verification depth set with
.Xr X509_VERIFY_PARAM_set_depth 3
.It
the list of expected DNS hostnames built with
.Xr X509_VERIFY_PARAM_set1_host 3
Changes to jni/libressl/man/X509_VERIFY_PARAM_set_flags.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.\" $OpenBSD: X509_VERIFY_PARAM_set_flags.3,v 1.25 2022/03/31 17:27:17 naddy Exp $
.\" full merge up to: OpenSSL d33def66 Feb 9 14:17:13 2016 -0500
.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.\" $OpenBSD: X509_VERIFY_PARAM_set_flags.3,v 1.26 2022/07/13 21:17:03 schwarze Exp $
.\" full merge up to: OpenSSL d33def66 Feb 9 14:17:13 2016 -0500
.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2018, 2021, 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

83
84
85
86

87
88
89
90
91
92
93
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dt X509_VERIFY_PARAM_SET_FLAGS 3
.Os
.Sh NAME
.Nm X509_VERIFY_PARAM_get0_name ,
.Nm X509_VERIFY_PARAM_set1_name ,
.Nm X509_VERIFY_PARAM_set_flags ,
.Nm X509_VERIFY_PARAM_clear_flags ,
.Nm X509_VERIFY_PARAM_get_flags ,
.Nm X509_VERIFY_PARAM_set_purpose ,
.Nm X509_VERIFY_PARAM_set_trust ,
.Nm X509_VERIFY_PARAM_set_time ,

.Nm X509_VERIFY_PARAM_add0_policy ,
.Nm X509_VERIFY_PARAM_set1_policies ,
.Nm X509_VERIFY_PARAM_set_depth ,
.Nm X509_VERIFY_PARAM_get_depth ,

.Nm X509_VERIFY_PARAM_set1_host ,
.Nm X509_VERIFY_PARAM_add1_host ,
.Nm X509_VERIFY_PARAM_set_hostflags ,
.Nm X509_VERIFY_PARAM_get0_peername ,
.Nm X509_VERIFY_PARAM_set1_email ,
.Nm X509_VERIFY_PARAM_set1_ip ,
.Nm X509_VERIFY_PARAM_set1_ip_asc







|











>




>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dt X509_VERIFY_PARAM_SET_FLAGS 3
.Os
.Sh NAME
.Nm X509_VERIFY_PARAM_get0_name ,
.Nm X509_VERIFY_PARAM_set1_name ,
.Nm X509_VERIFY_PARAM_set_flags ,
.Nm X509_VERIFY_PARAM_clear_flags ,
.Nm X509_VERIFY_PARAM_get_flags ,
.Nm X509_VERIFY_PARAM_set_purpose ,
.Nm X509_VERIFY_PARAM_set_trust ,
.Nm X509_VERIFY_PARAM_set_time ,
.Nm X509_VERIFY_PARAM_get_time ,
.Nm X509_VERIFY_PARAM_add0_policy ,
.Nm X509_VERIFY_PARAM_set1_policies ,
.Nm X509_VERIFY_PARAM_set_depth ,
.Nm X509_VERIFY_PARAM_get_depth ,
.Nm X509_VERIFY_PARAM_set_auth_level ,
.Nm X509_VERIFY_PARAM_set1_host ,
.Nm X509_VERIFY_PARAM_add1_host ,
.Nm X509_VERIFY_PARAM_set_hostflags ,
.Nm X509_VERIFY_PARAM_get0_peername ,
.Nm X509_VERIFY_PARAM_set1_email ,
.Nm X509_VERIFY_PARAM_set1_ip ,
.Nm X509_VERIFY_PARAM_set1_ip_asc
128
129
130
131
132
133
134




135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153





154
155
156
157
158
159
160
.Fa "int trust"
.Fc
.Ft void
.Fo X509_VERIFY_PARAM_set_time
.Fa "X509_VERIFY_PARAM *param"
.Fa "time_t t"
.Fc




.Ft int
.Fo X509_VERIFY_PARAM_add0_policy
.Fa "X509_VERIFY_PARAM *param"
.Fa "ASN1_OBJECT *policy"
.Fc
.Ft int
.Fo X509_VERIFY_PARAM_set1_policies
.Fa "X509_VERIFY_PARAM *param"
.Fa "STACK_OF(ASN1_OBJECT) *policies"
.Fc
.Ft void
.Fo X509_VERIFY_PARAM_set_depth
.Fa "X509_VERIFY_PARAM *param"
.Fa "int depth"
.Fc
.Ft int
.Fo X509_VERIFY_PARAM_get_depth
.Fa "const X509_VERIFY_PARAM *param"
.Fc





.Ft int
.Fo X509_VERIFY_PARAM_set1_host
.Fa "X509_VERIFY_PARAM *param"
.Fa "const char *name"
.Fa "size_t namelen"
.Fc
.Ft int







>
>
>
>



















>
>
>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
.Fa "int trust"
.Fc
.Ft void
.Fo X509_VERIFY_PARAM_set_time
.Fa "X509_VERIFY_PARAM *param"
.Fa "time_t t"
.Fc
.Ft time_t
.Fo X509_VERIFY_PARAM_get_time
.Fa const X509_VERIFY_PARAM *param"
.Fc
.Ft int
.Fo X509_VERIFY_PARAM_add0_policy
.Fa "X509_VERIFY_PARAM *param"
.Fa "ASN1_OBJECT *policy"
.Fc
.Ft int
.Fo X509_VERIFY_PARAM_set1_policies
.Fa "X509_VERIFY_PARAM *param"
.Fa "STACK_OF(ASN1_OBJECT) *policies"
.Fc
.Ft void
.Fo X509_VERIFY_PARAM_set_depth
.Fa "X509_VERIFY_PARAM *param"
.Fa "int depth"
.Fc
.Ft int
.Fo X509_VERIFY_PARAM_get_depth
.Fa "const X509_VERIFY_PARAM *param"
.Fc
.Ft void
.Fo X509_VERIFY_PARAM_set_auth_level
.Fa "X509_VERIFY_PARAM *param"
.Fa "int auth_level"
.Fc
.Ft int
.Fo X509_VERIFY_PARAM_set1_host
.Fa "X509_VERIFY_PARAM *param"
.Fa "const char *name"
.Fa "size_t namelen"
.Fc
.Ft int
318
319
320
321
322
323
324

















325
326
327
328
329
330
331
.Pp
.Fn X509_VERIFY_PARAM_set_depth
sets the maximum verification depth to
.Fa depth .
That is the maximum number of untrusted CA certificates that can appear
in a chain.
.Pp

















.Fn X509_VERIFY_PARAM_set1_host
sets the expected DNS hostname to
.Fa name
clearing any previously specified hostname or names.
If
.Fa name
is







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
.Pp
.Fn X509_VERIFY_PARAM_set_depth
sets the maximum verification depth to
.Fa depth .
That is the maximum number of untrusted CA certificates that can appear
in a chain.
.Pp
.Fn X509_VERIFY_PARAM_set_auth_level
sets the security level as defined in
.Xr SSL_CTX_set_security_level 3
for certificate chain validation.
For a certificate chain to validate, the public keys of all the
certificates must meet the specified security level.
The signature algorithm security level is not enforced for the
chain's trust anchor certificate, which is either directly trusted
or validated by means other than its signature.
.Pp
From the point of view of the X.509 library,
the default security level is 0.
However, the SSL library
uses a different default security level of 1 and calls
.Fn X509_VERIFY_PARAM_set_auth_level
with its own level before validating a certificate chain.
.Pp
.Fn X509_VERIFY_PARAM_set1_host
sets the expected DNS hostname to
.Fa name
clearing any previously specified hostname or names.
If
.Fa name
is
463
464
465
466
467
468
469






470
471
472
473
474
475
476
.Vt X509_VERIFY_PARAM
object so that future calls to
.Xr X509_verify_cert 3
using the poisoned object will fail.
.Pp
.Fn X509_VERIFY_PARAM_get_flags
returns the current verification flags.






.Pp
.Fn X509_VERIFY_PARAM_get_depth
returns the current verification depth.
.Pp
.Fn X509_VERIFY_PARAM_get0_name
and
.Fn X509_VERIFY_PARAM_get0_peername







>
>
>
>
>
>







491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
.Vt X509_VERIFY_PARAM
object so that future calls to
.Xr X509_verify_cert 3
using the poisoned object will fail.
.Pp
.Fn X509_VERIFY_PARAM_get_flags
returns the current verification flags.
.Pp
.Fn X509_VERIFY_PARAM_get_time
always returns the configured verification time.
It does so even if the returned time will not be used because the flag
.Dv X509_V_FLAG_USE_CHECK_TIME
is unset.
.Pp
.Fn X509_VERIFY_PARAM_get_depth
returns the current verification depth.
.Pp
.Fn X509_VERIFY_PARAM_get0_name
and
.Fn X509_VERIFY_PARAM_get0_peername
683
684
685
686
687
688
689







690
691
692
693
694
695
696
697
698
699
700
701
.Fn X509_VERIFY_PARAM_get0_peername ,
.Fn X509_VERIFY_PARAM_set1_email ,
.Fn X509_VERIFY_PARAM_set1_ip ,
and
.Fn X509_VERIFY_PARAM_set1_ip_asc
first appeared in OpenSSL 1.0.2 and have been available since
.Ox 6.3 .







.Sh BUGS
Delta CRL checking is currently primitive.
Only a single delta can be used and (partly due to limitations of
.Vt X509_STORE )
constructed CRLs are not maintained.
.Pp
If CRLs checking is enabled, CRLs are expected to be available in
the corresponding
.Vt X509_STORE
structure.
No attempt is made to download CRLs from the CRL distribution points
extension.







>
>
>
>
>
>
>












717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
.Fn X509_VERIFY_PARAM_get0_peername ,
.Fn X509_VERIFY_PARAM_set1_email ,
.Fn X509_VERIFY_PARAM_set1_ip ,
and
.Fn X509_VERIFY_PARAM_set1_ip_asc
first appeared in OpenSSL 1.0.2 and have been available since
.Ox 6.3 .
.Pp
.Fn X509_VERIFY_PARAM_set_auth_level
first appeared in OpenSSL 1.1.0 and
.Fn X509_VERIFY_PARAM_get_time
in OpenSSL 1.1.0d.
Both functions have been available since
.Ox 7.2 .
.Sh BUGS
Delta CRL checking is currently primitive.
Only a single delta can be used and (partly due to limitations of
.Vt X509_STORE )
constructed CRLs are not maintained.
.Pp
If CRLs checking is enabled, CRLs are expected to be available in
the corresponding
.Vt X509_STORE
structure.
No attempt is made to download CRLs from the CRL distribution points
extension.
Changes to jni/libressl/man/X509_check_ca.3.
1
2
3
4
5
6
7
8
.\"	$OpenBSD: X509_check_ca.3,v 1.6 2022/02/18 01:41:17 jsg Exp $
.\"	OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>.
.\" Copyright (c) 2015, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
|







1
2
3
4
5
6
7
8
.\"	$OpenBSD: X509_check_ca.3,v 1.7 2022/05/10 19:44:29 tb Exp $
.\"	OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>.
.\" Copyright (c) 2015, 2016 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: February 18 2022 $
.Dt X509_CHECK_CA 3
.Os
.Sh NAME
.Nm X509_check_ca
.Nd check whether a certificate is a CA certificate
.Sh SYNOPSIS
.In openssl/x509v3.h







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: May 10 2022 $
.Dt X509_CHECK_CA 3
.Os
.Sh NAME
.Nm X509_check_ca
.Nd check whether a certificate is a CA certificate
.Sh SYNOPSIS
.In openssl/x509v3.h
89
90
91
92
93
94
95

96
97
98
99
100
101
102














a certificate with an outdated Netscape Certificate Type extension telling
that it is a CA certificate
.El
.Sh SEE ALSO
.Xr BASIC_CONSTRAINTS_new 3 ,
.Xr EXTENDED_KEY_USAGE_new 3 ,
.Xr X509_check_issued 3 ,

.Xr X509_EXTENSION_new 3 ,
.Xr X509_new 3 ,
.Xr X509_verify_cert 3
.Sh HISTORY
.Fn X509_check_ca
first appeared in OpenSSL 0.9.7f and has been available since
.Ox 3.8 .





















>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
a certificate with an outdated Netscape Certificate Type extension telling
that it is a CA certificate
.El
.Sh SEE ALSO
.Xr BASIC_CONSTRAINTS_new 3 ,
.Xr EXTENDED_KEY_USAGE_new 3 ,
.Xr X509_check_issued 3 ,
.Xr X509_check_purpose 3 ,
.Xr X509_EXTENSION_new 3 ,
.Xr X509_new 3 ,
.Xr X509_verify_cert 3
.Sh HISTORY
.Fn X509_check_ca
first appeared in OpenSSL 0.9.7f and has been available since
.Ox 3.8 .
.Sh BUGS
If
.Fn X509_check_ca
fails to cache X509v3 extension values, the return value may
be incorrect.
An application should
call
.Xr X509_check_purpose 3
with a
.Fa purpose
argument of \-1,
ensuring that the X509v3 extensions are cached,
before calling
.Fn X509_check_ca .
Changes to jni/libressl/man/X509_check_trust.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: X509_check_trust.3,v 1.5 2021/11/26 13:48:21 jsg Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 26 2021 $
.Dt X509_CHECK_TRUST 3
.Os
.Sh NAME
.Nm X509_check_trust ,
.Nm X509_TRUST_set_default
.Nd check whether a certificate is trusted
.Sh SYNOPSIS
|















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: X509_check_trust.3,v 1.6 2022/09/10 10:22:46 jsg Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 10 2022 $
.Dt X509_CHECK_TRUST 3
.Os
.Sh NAME
.Nm X509_check_trust ,
.Nm X509_TRUST_set_default
.Nd check whether a certificate is trusted
.Sh SYNOPSIS
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
.Fa handler
function passed to it is used instead of the standard algorithm,
but only in the case where the
.Fa trust
argument of
.Fn X509_check_trust
is invalid.
The compatibility step is not used used in this case.
.Pp
If the return value of the first call to
.Fn X509_TRUST_set_default
is saved and passed back to
.Fn X509_TRUST_set_default
later on, the standard behaviour
of using the standard algorithm for invalid







|







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
.Fa handler
function passed to it is used instead of the standard algorithm,
but only in the case where the
.Fa trust
argument of
.Fn X509_check_trust
is invalid.
The compatibility step is not used in this case.
.Pp
If the return value of the first call to
.Fn X509_TRUST_set_default
is saved and passed back to
.Fn X509_TRUST_set_default
later on, the standard behaviour
of using the standard algorithm for invalid
Changes to jni/libressl/man/X509_policy_tree_level_count.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: X509_policy_tree_level_count.3,v 1.4 2021/11/11 12:06:25 schwarze Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 11 2021 $
.Dt X509_POLICY_TREE_LEVEL_COUNT 3
.Os
.Sh NAME
.Nm X509_policy_tree_level_count ,
.Nm X509_policy_tree_get0_level ,
.Nm X509_policy_level_node_count ,
.Nm X509_policy_level_get0_node ,
|















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: X509_policy_tree_level_count.3,v 1.5 2022/09/10 08:50:53 jsg Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 10 2022 $
.Dt X509_POLICY_TREE_LEVEL_COUNT 3
.Os
.Sh NAME
.Nm X509_policy_tree_level_count ,
.Nm X509_policy_tree_get0_level ,
.Nm X509_policy_level_node_count ,
.Nm X509_policy_level_get0_node ,
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
returns
.Dv NULL
if the
.Fa node
argument is
.Dv NULL
or located on level 0.
Otherwise, it returns an an internal pointer to the parent node of the
.Fa node
argument.
The parent node is always located on the previous level.
.Sh SEE ALSO
.Xr ASN1_OBJECT_new 3 ,
.Xr OBJ_obj2txt 3 ,
.Xr POLICYQUALINFO_new 3 ,







|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
returns
.Dv NULL
if the
.Fa node
argument is
.Dv NULL
or located on level 0.
Otherwise, it returns an internal pointer to the parent node of the
.Fa node
argument.
The parent node is always located on the previous level.
.Sh SEE ALSO
.Xr ASN1_OBJECT_new 3 ,
.Xr OBJ_obj2txt 3 ,
.Xr POLICYQUALINFO_new 3 ,
Changes to jni/libressl/man/d2i_ASN1_OBJECT.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.12 2022/03/29 17:41:20 schwarze Exp $
.\"
.\" Copyright (c) 2017, 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: March 29 2022 $
.Dt D2I_ASN1_OBJECT 3
.Os
.Sh NAME
.Nm d2i_ASN1_OBJECT ,
.Nm i2d_ASN1_OBJECT
.\" c2i_ASN1_OBJECT is intentionally undocumented because it is unused
.\" in real-world software and was removed from the OpenSSL 1.1.1 API
.Nd decode and encode ASN.1 object identifiers
.Sh SYNOPSIS
.In openssl/asn1.h
.Ft ASN1_OBJECT *
.Fo d2i_ASN1_OBJECT
.Fa "ASN1_OBJECT **val_out"
.Fa "unsigned char **der_in"
|















|





<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22


23
24
25
26
27
28
29
.\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.13 2022/09/12 14:33:47 tb Exp $
.\"
.\" Copyright (c) 2017, 2022 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 12 2022 $
.Dt D2I_ASN1_OBJECT 3
.Os
.Sh NAME
.Nm d2i_ASN1_OBJECT ,
.Nm i2d_ASN1_OBJECT


.Nd decode and encode ASN.1 object identifiers
.Sh SYNOPSIS
.In openssl/asn1.h
.Ft ASN1_OBJECT *
.Fo d2i_ASN1_OBJECT
.Fa "ASN1_OBJECT **val_out"
.Fa "unsigned char **der_in"
Changes to jni/libressl/man/d2i_ASN1_OCTET_STRING.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.\"	$OpenBSD: d2i_ASN1_OCTET_STRING.3,v 1.17 2022/03/29 14:27:59 naddy Exp $
.\"
.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: March 29 2022 $
.Dt D2I_ASN1_OCTET_STRING 3
.Os
.Sh NAME
.Nm d2i_ASN1_OCTET_STRING ,
.Nm i2d_ASN1_OCTET_STRING ,
.Nm d2i_ASN1_BIT_STRING ,
.Nm i2d_ASN1_BIT_STRING ,
.Nm d2i_ASN1_INTEGER ,
.Nm i2d_ASN1_INTEGER ,
.Nm i2c_ASN1_INTEGER ,
.Nm d2i_ASN1_UINTEGER ,
.Nm d2i_ASN1_ENUMERATED ,
.Nm i2d_ASN1_ENUMERATED ,
.Nm d2i_ASN1_UTF8STRING ,
.Nm i2d_ASN1_UTF8STRING ,
.Nm d2i_ASN1_IA5STRING ,
.Nm i2d_ASN1_IA5STRING ,
|















|









<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
.\"	$OpenBSD: d2i_ASN1_OCTET_STRING.3,v 1.19 2022/09/12 14:36:09 tb Exp $
.\"
.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 12 2022 $
.Dt D2I_ASN1_OCTET_STRING 3
.Os
.Sh NAME
.Nm d2i_ASN1_OCTET_STRING ,
.Nm i2d_ASN1_OCTET_STRING ,
.Nm d2i_ASN1_BIT_STRING ,
.Nm i2d_ASN1_BIT_STRING ,
.Nm d2i_ASN1_INTEGER ,
.Nm i2d_ASN1_INTEGER ,

.Nm d2i_ASN1_UINTEGER ,
.Nm d2i_ASN1_ENUMERATED ,
.Nm i2d_ASN1_ENUMERATED ,
.Nm d2i_ASN1_UTF8STRING ,
.Nm i2d_ASN1_UTF8STRING ,
.Nm d2i_ASN1_IA5STRING ,
.Nm i2d_ASN1_IA5STRING ,
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.Nm i2d_DISPLAYTEXT ,
.Nm d2i_ASN1_GENERALIZEDTIME ,
.Nm i2d_ASN1_GENERALIZEDTIME ,
.Nm d2i_ASN1_UTCTIME ,
.Nm i2d_ASN1_UTCTIME ,
.Nm d2i_ASN1_TIME ,
.Nm i2d_ASN1_TIME
.\" i2c_ASN1_BIT_STRING, c2i_ASN1_BIT_STRING, and c2i_ASN1_INTEGER
.\" are intentionally undocumented because they are unused in
.\" real-world software and were removed from the OpenSSL 1.1.1 API
.Nd decode and encode ASN1_STRING objects
.Sh SYNOPSIS
.In openssl/asn1.h
.Ft ASN1_OCTET_STRING *
.Fo d2i_ASN1_OCTET_STRING
.Fa "ASN1_OCTET_STRING **val_out"
.Fa "const unsigned char **der_in"







<
<
<







51
52
53
54
55
56
57



58
59
60
61
62
63
64
.Nm i2d_DISPLAYTEXT ,
.Nm d2i_ASN1_GENERALIZEDTIME ,
.Nm i2d_ASN1_GENERALIZEDTIME ,
.Nm d2i_ASN1_UTCTIME ,
.Nm i2d_ASN1_UTCTIME ,
.Nm d2i_ASN1_TIME ,
.Nm i2d_ASN1_TIME



.Nd decode and encode ASN1_STRING objects
.Sh SYNOPSIS
.In openssl/asn1.h
.Ft ASN1_OCTET_STRING *
.Fo d2i_ASN1_OCTET_STRING
.Fa "ASN1_OCTET_STRING **val_out"
.Fa "const unsigned char **der_in"
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.Fo d2i_ASN1_INTEGER
.Fa "ASN1_INTEGER **val_out"
.Fa "const unsigned char **der_in"
.Fa "long length"
.Fc
.Ft int
.Fo i2d_ASN1_INTEGER
.Fa "ASN1_INTEGER *val_in"
.Fa "unsigned char **der_out"
.Fc
.Ft int
.Fo i2c_ASN1_INTEGER
.Fa "ASN1_INTEGER *val_in"
.Fa "unsigned char **der_out"
.Fc
.Ft ASN1_INTEGER *
.Fo d2i_ASN1_UINTEGER
.Fa "ASN1_INTEGER **val_out"
.Fa "const unsigned char **der_in"







<
<
<
<
<







84
85
86
87
88
89
90





91
92
93
94
95
96
97
.Fo d2i_ASN1_INTEGER
.Fa "ASN1_INTEGER **val_out"
.Fa "const unsigned char **der_in"
.Fa "long length"
.Fc
.Ft int
.Fo i2d_ASN1_INTEGER





.Fa "ASN1_INTEGER *val_in"
.Fa "unsigned char **der_out"
.Fc
.Ft ASN1_INTEGER *
.Fo d2i_ASN1_UINTEGER
.Fa "ASN1_INTEGER **val_out"
.Fa "const unsigned char **der_in"
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
.It Vt ASN1_T61STRING       Ta 0x14 Ta T61String
.It Vt ASN1_VISIBLESTRING   Ta 0x1a Ta VisibleString
.It Vt ASN1_PRINTABLESTRING Ta 0x13 Ta PrintableString
.It Vt ASN1_GENERALIZEDTIME Ta 0x18 Ta GeneralizedTime
.It Vt ASN1_UTCTIME         Ta 0x17 Ta UTCTime
.El
.Pp
.Fn i2c_ASN1_INTEGER
writes only the content bytes of
.Fa val_in
to
.Pf * Fa der_out
and advances
.Pf * Fa der_out
to the byte after the last one written.
The identifier and content length bytes are not written.
It is the responsibility of the caller to make sure that the buffer
pointed to by
.Pf * Fa der_out
is long enough, such that no buffer overflow can occur.
This function does not support automatic memory allocation.
If
.Fa der_out
is a
.Dv NULL
pointer, the function only calculates the number of content bytes
that would be written, without writing them anywhere.
.Pp
.Fn d2i_DIRECTORYSTRING
and
.Fn i2d_DIRECTORYSTRING
decode and encode an ASN.1
.Vt DirectoryString
structure defined in RFC 5280 section 4.1.2.4
and used for ASN.1







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







288
289
290
291
292
293
294





















295
296
297
298
299
300
301
.It Vt ASN1_T61STRING       Ta 0x14 Ta T61String
.It Vt ASN1_VISIBLESTRING   Ta 0x1a Ta VisibleString
.It Vt ASN1_PRINTABLESTRING Ta 0x13 Ta PrintableString
.It Vt ASN1_GENERALIZEDTIME Ta 0x18 Ta GeneralizedTime
.It Vt ASN1_UTCTIME         Ta 0x17 Ta UTCTime
.El
.Pp





















.Fn d2i_DIRECTORYSTRING
and
.Fn i2d_DIRECTORYSTRING
decode and encode an ASN.1
.Vt DirectoryString
structure defined in RFC 5280 section 4.1.2.4
and used for ASN.1
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
.Dv NULL
if an error occurs.
.Pp
The
.Fn i2d_*
encoding functions return the number of bytes successfully encoded
or a negative value if an error occurs.
.Pp
.Fn i2c_ASN1_INTEGER
returns the number of content bytes that were or would be written or 0 if
.Fa val_in
is a
.Dv NULL
pointer or if its
.Xr ASN1_STRING_length 3
is negative.
.Sh SEE ALSO
.Xr ASN1_item_d2i 3 ,
.Xr ASN1_STRING_new 3
.Sh STANDARDS
ITU-T Recommendation X.680, also known as ISO/IEC 8824-1:
Information technology - Abstract Syntax Notation One (ASN.1):
Specification of basic notation







<
<
<
<
<
<
<
<
<







384
385
386
387
388
389
390









391
392
393
394
395
396
397
.Dv NULL
if an error occurs.
.Pp
The
.Fn i2d_*
encoding functions return the number of bytes successfully encoded
or a negative value if an error occurs.









.Sh SEE ALSO
.Xr ASN1_item_d2i 3 ,
.Xr ASN1_STRING_new 3
.Sh STANDARDS
ITU-T Recommendation X.680, also known as ISO/IEC 8824-1:
Information technology - Abstract Syntax Notation One (ASN.1):
Specification of basic notation
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
.Fn d2i_DISPLAYTEXT
and
.Fn i2d_DISPLAYTEXT
first appeared in OpenSSL 0.9.3.
These functions have been available since
.Ox 2.6 .
.Pp
.Fn i2c_ASN1_INTEGER
first appeared in OpenSSL 0.9.6 and has been available since
.Ox 2.9 .
.Pp
.Fn d2i_ASN1_UNIVERSALSTRING ,
.Fn i2d_ASN1_UNIVERSALSTRING ,
.Fn d2i_ASN1_GENERALSTRING ,
and
.Fn i2d_ASN1_GENERALSTRING
first appeared in OpenSSL 0.9.7 and have been available since
.Ox 3.2 .







<
<
<
<







441
442
443
444
445
446
447




448
449
450
451
452
453
454
.Fn d2i_DISPLAYTEXT
and
.Fn i2d_DISPLAYTEXT
first appeared in OpenSSL 0.9.3.
These functions have been available since
.Ox 2.6 .
.Pp




.Fn d2i_ASN1_UNIVERSALSTRING ,
.Fn i2d_ASN1_UNIVERSALSTRING ,
.Fn d2i_ASN1_GENERALSTRING ,
and
.Fn i2d_ASN1_GENERALSTRING
first appeared in OpenSSL 0.9.7 and have been available since
.Ox 3.2 .
Changes to jni/libressl/man/i2a_ASN1_STRING.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: i2a_ASN1_STRING.3,v 1.2 2021/11/23 13:52:27 schwarze Exp $
.\"
.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 23 2021 $
.Dt I2A_ASN1_STRING 3
.Os
.Sh NAME
.Nm i2a_ASN1_STRING ,
.Nm i2a_ASN1_INTEGER ,
.Nm i2a_ASN1_ENUMERATED ,
.Nm a2i_ASN1_STRING ,
|















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.\" $OpenBSD: i2a_ASN1_STRING.3,v 1.4 2022/09/10 12:36:18 jsg Exp $
.\"
.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 10 2022 $
.Dt I2A_ASN1_STRING 3
.Os
.Sh NAME
.Nm i2a_ASN1_STRING ,
.Nm i2a_ASN1_INTEGER ,
.Nm i2a_ASN1_ENUMERATED ,
.Nm a2i_ASN1_STRING ,
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.Fn a2i_ASN1_ENUMERATED
parse a hexadecimal representation of an ASN.1 string into
.Fa out_string .
Both lower-case and upper-case hexadecimal digits are accepted.
Every pair of input digits is converted into one output byte.
.Pp
On every input line, the trailing newline character and an optional
carrier return character character preceding it are ignored.
The trailing newline need not be present on the last line.
If there is a backslash character before the newline character,
parsing is continued on the next input line.
.Pp
At least one pair of input digits is required by
.Fn a2i_ASN1_INTEGER
and







|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.Fn a2i_ASN1_ENUMERATED
parse a hexadecimal representation of an ASN.1 string into
.Fa out_string .
Both lower-case and upper-case hexadecimal digits are accepted.
Every pair of input digits is converted into one output byte.
.Pp
On every input line, the trailing newline character and an optional
carriage return character preceding it are ignored.
The trailing newline need not be present on the last line.
If there is a backslash character before the newline character,
parsing is continued on the next input line.
.Pp
At least one pair of input digits is required by
.Fn a2i_ASN1_INTEGER
and
Changes to jni/libressl/man/ssl.3.
1
2
3
4
5
6
7
8
.\" $OpenBSD: ssl.3,v 1.20 2020/09/21 08:53:56 schwarze Exp $
.\" full merge up to: OpenSSL e330f55d Nov 11 00:51:04 2016 +0100
.\" selective merge up to: OpenSSL 322755cc Sep 1 08:40:51 2018 +0800
.\"
.\" This file was written by Ralf S. Engelschall <rse@openssl.org>,
.\" Ben Laurie <ben@openssl.org>, and Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 1998-2002, 2005, 2013, 2015 The OpenSSL Project.
.\" All rights reserved.
|







1
2
3
4
5
6
7
8
.\" $OpenBSD: ssl.3,v 1.22 2022/09/17 16:03:21 kn Exp $
.\" full merge up to: OpenSSL e330f55d Nov 11 00:51:04 2016 +0100
.\" selective merge up to: OpenSSL 322755cc Sep 1 08:40:51 2018 +0800
.\"
.\" This file was written by Ralf S. Engelschall <rse@openssl.org>,
.\" Ben Laurie <ben@openssl.org>, and Ulf Moeller <ulf@openssl.org>.
.\" Copyright (c) 1998-2002, 2005, 2013, 2015 The OpenSSL Project.
.\" All rights reserved.
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 21 2020 $
.Dt SSL 3
.Os
.Sh NAME
.Nm ssl
.Nd OpenSSL SSL/TLS library
.Sh DESCRIPTION
The OpenSSL







|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 17 2022 $
.Dt SSL 3
.Os
.Sh NAME
.Nm ssl
.Nd OpenSSL SSL/TLS library
.Sh DESCRIPTION
The OpenSSL
229
230
231
232
233
234
235

236
237
238
239
240
241
242
connections created from that context.
.Pp
Protocol and algorithm configuration:
.Xr SSL_CTX_set_alpn_select_cb 3 ,
.Xr SSL_CTX_set_cipher_list 3 ,
.Xr SSL_CTX_set_min_proto_version 3 ,
.Xr SSL_CTX_set_options 3 ,

.Xr SSL_CTX_set_tlsext_use_srtp 3 ,
.Xr SSL_CTX_set_tmp_dh_callback 3 ,
.Xr SSL_CTX_set1_groups 3
.Pp
Certificate configuration:
.Xr SSL_CTX_add1_chain_cert 3 ,
.Xr SSL_CTX_get_verify_mode 3 ,







>







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
connections created from that context.
.Pp
Protocol and algorithm configuration:
.Xr SSL_CTX_set_alpn_select_cb 3 ,
.Xr SSL_CTX_set_cipher_list 3 ,
.Xr SSL_CTX_set_min_proto_version 3 ,
.Xr SSL_CTX_set_options 3 ,
.Xr SSL_CTX_set_security_level 3 ,
.Xr SSL_CTX_set_tlsext_use_srtp 3 ,
.Xr SSL_CTX_set_tmp_dh_callback 3 ,
.Xr SSL_CTX_set1_groups 3
.Pp
Certificate configuration:
.Xr SSL_CTX_add1_chain_cert 3 ,
.Xr SSL_CTX_get_verify_mode 3 ,
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
.Pp
To transmit data:
.Xr DTLSv1_listen 3 ,
.Xr SSL_accept 3 ,
.Xr SSL_connect 3 ,
.Xr SSL_do_handshake 3 ,
.Xr SSL_read 3 ,
.\" XXX enable after the 6.8 release: Xr SSL_read_early_data 3 ,
.Xr SSL_renegotiate 3 ,
.Xr SSL_shutdown 3 ,
.Xr SSL_write 3
.Pp
To inspect the state after a connection is established:
.Xr SSL_export_keying_material 3 ,
.Xr SSL_get_client_random 3 ,







|







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
.Pp
To transmit data:
.Xr DTLSv1_listen 3 ,
.Xr SSL_accept 3 ,
.Xr SSL_connect 3 ,
.Xr SSL_do_handshake 3 ,
.Xr SSL_read 3 ,
.Xr SSL_read_early_data 3 ,
.Xr SSL_renegotiate 3 ,
.Xr SSL_shutdown 3 ,
.Xr SSL_write 3
.Pp
To inspect the state after a connection is established:
.Xr SSL_export_keying_material 3 ,
.Xr SSL_get_client_random 3 ,
Changes to jni/libressl/missing.
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.






|







1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

Changes to jni/libressl/scripts/test.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	mkdir build-shared

	cd build-static

	# test cmake and ninja
	if [ `uname` = "Darwin" ]; then
		cmake ..
		make
		make test

		cd ../build-shared
		cmake -DBUILD_SHARED_LIBS=ON ..
		make
		make test
	else
		sudo apt-get update
		sudo apt-get install -y cmake ninja-build

		cmake -GNinja ..
		ninja
		ninja test

		cd ../build-shared
		cmake -GNinja -DBUILD_SHARED_LIBS=ON ..
		ninja
		ninja test
	fi

elif [ "x$ARCH" = "xmingw32" -o "x$ARCH" = "xmingw64" ]; then
	sudo apt-get update
	sudo apt-get install -y cmake ninja-build

	CPU=i686
	if [ "x$ARCH" = "xmingw64" ]; then
		CPU=x86_64
	fi
	export CC=$CPU-w64-mingw32-gcc

	if [ -z $(which $CC) ]; then
		sudo apt-get update
		sudo apt-get install -y mingw-w64 make
		export PATH=$PATH:/opt/$ARCH/bin
	fi

	./configure --host=$CPU-w64-mingw32
	make -j

	(
	 rm -fr build-static
	 mkdir build-static
	 cd build-static
	 cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake ..
	 ninja
	)
	(
	 rm -fr build-shared
	 mkdir build-shared
	 cd build-shared
	 cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake -DBUILD_SHARED_LIBS=ON ..
	 ninja
	)

elif [ "x$ARCH" = "xarm32" -o "x$ARCH" = "xarm64" ]; then
	sudo apt-get update
	sudo apt-get install -y qemu-user-static binfmt-support

	if [ "x$ARCH" = "xarm32" ]; then







|




|






|




|




















|






|






|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	mkdir build-shared

	cd build-static

	# test cmake and ninja
	if [ `uname` = "Darwin" ]; then
		cmake ..
		make -j 4
		make test

		cd ../build-shared
		cmake -DBUILD_SHARED_LIBS=ON ..
		make -j 4
		make test
	else
		sudo apt-get update
		sudo apt-get install -y cmake ninja-build

		cmake -GNinja ..
		ninja -j 4
		ninja test

		cd ../build-shared
		cmake -GNinja -DBUILD_SHARED_LIBS=ON ..
		ninja -j 4
		ninja test
	fi

elif [ "x$ARCH" = "xmingw32" -o "x$ARCH" = "xmingw64" ]; then
	sudo apt-get update
	sudo apt-get install -y cmake ninja-build

	CPU=i686
	if [ "x$ARCH" = "xmingw64" ]; then
		CPU=x86_64
	fi
	export CC=$CPU-w64-mingw32-gcc

	if [ -z $(which $CC) ]; then
		sudo apt-get update
		sudo apt-get install -y mingw-w64 make
		export PATH=$PATH:/opt/$ARCH/bin
	fi

	./configure --host=$CPU-w64-mingw32
	make -j 4

	(
	 rm -fr build-static
	 mkdir build-static
	 cd build-static
	 cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake ..
	 ninja -j 4
	)
	(
	 rm -fr build-shared
	 mkdir build-shared
	 cd build-shared
	 cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake -DBUILD_SHARED_LIBS=ON ..
	 ninja -j 4
	)

elif [ "x$ARCH" = "xarm32" -o "x$ARCH" = "xarm64" ]; then
	sudo apt-get update
	sudo apt-get install -y qemu-user-static binfmt-support

	if [ "x$ARCH" = "xarm32" ]; then
Changes to jni/libressl/ssl/CMakeLists.txt.
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
	ssl_init.c
	ssl_kex.c
	ssl_lib.c
	ssl_methods.c
	ssl_packet.c
	ssl_pkt.c
	ssl_rsa.c

	ssl_sess.c
	ssl_sigalgs.c
	ssl_srvr.c
	ssl_stat.c
	ssl_tlsext.c
	ssl_transcript.c
	ssl_txt.c
	ssl_versions.c
	t1_enc.c
	t1_lib.c
	tls_buffer.c
	tls_content.c
	tls_key_share.c

	tls12_key_schedule.c
	tls12_lib.c
	tls12_record_layer.c
	tls13_client.c
	tls13_error.c
	tls13_handshake.c
	tls13_handshake_msg.c
	tls13_key_schedule.c
	tls13_legacy.c
	tls13_lib.c

	tls13_record.c
	tls13_record_layer.c
	tls13_server.c
)

set(
	BS_SRC







>













>










>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	ssl_init.c
	ssl_kex.c
	ssl_lib.c
	ssl_methods.c
	ssl_packet.c
	ssl_pkt.c
	ssl_rsa.c
	ssl_seclevel.c
	ssl_sess.c
	ssl_sigalgs.c
	ssl_srvr.c
	ssl_stat.c
	ssl_tlsext.c
	ssl_transcript.c
	ssl_txt.c
	ssl_versions.c
	t1_enc.c
	t1_lib.c
	tls_buffer.c
	tls_content.c
	tls_key_share.c
	tls_lib.c
	tls12_key_schedule.c
	tls12_lib.c
	tls12_record_layer.c
	tls13_client.c
	tls13_error.c
	tls13_handshake.c
	tls13_handshake_msg.c
	tls13_key_schedule.c
	tls13_legacy.c
	tls13_lib.c
	tls13_quic.c
	tls13_record.c
	tls13_record_layer.c
	tls13_server.c
)

set(
	BS_SRC
Changes to jni/libressl/ssl/Makefile.am.
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
libssl_la_SOURCES += ssl_init.c
libssl_la_SOURCES += ssl_kex.c
libssl_la_SOURCES += ssl_lib.c
libssl_la_SOURCES += ssl_methods.c
libssl_la_SOURCES += ssl_packet.c
libssl_la_SOURCES += ssl_pkt.c
libssl_la_SOURCES += ssl_rsa.c

libssl_la_SOURCES += ssl_sess.c
libssl_la_SOURCES += ssl_sigalgs.c
libssl_la_SOURCES += ssl_srvr.c
libssl_la_SOURCES += ssl_stat.c
libssl_la_SOURCES += ssl_tlsext.c
libssl_la_SOURCES += ssl_transcript.c
libssl_la_SOURCES += ssl_txt.c
libssl_la_SOURCES += ssl_versions.c
libssl_la_SOURCES += t1_enc.c
libssl_la_SOURCES += t1_lib.c
libssl_la_SOURCES += tls_buffer.c
libssl_la_SOURCES += tls_content.c
libssl_la_SOURCES += tls_key_share.c

libssl_la_SOURCES += tls12_key_schedule.c
libssl_la_SOURCES += tls12_lib.c
libssl_la_SOURCES += tls12_record_layer.c
libssl_la_SOURCES += tls13_client.c
libssl_la_SOURCES += tls13_error.c
libssl_la_SOURCES += tls13_handshake.c
libssl_la_SOURCES += tls13_handshake_msg.c
libssl_la_SOURCES += tls13_key_schedule.c
libssl_la_SOURCES += tls13_legacy.c
libssl_la_SOURCES += tls13_lib.c

libssl_la_SOURCES += tls13_record.c
libssl_la_SOURCES += tls13_record_layer.c
libssl_la_SOURCES += tls13_server.c

noinst_HEADERS += srtp.h
noinst_HEADERS += dtls_locl.h
noinst_HEADERS += ssl_locl.h







>













>










>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
libssl_la_SOURCES += ssl_init.c
libssl_la_SOURCES += ssl_kex.c
libssl_la_SOURCES += ssl_lib.c
libssl_la_SOURCES += ssl_methods.c
libssl_la_SOURCES += ssl_packet.c
libssl_la_SOURCES += ssl_pkt.c
libssl_la_SOURCES += ssl_rsa.c
libssl_la_SOURCES += ssl_seclevel.c
libssl_la_SOURCES += ssl_sess.c
libssl_la_SOURCES += ssl_sigalgs.c
libssl_la_SOURCES += ssl_srvr.c
libssl_la_SOURCES += ssl_stat.c
libssl_la_SOURCES += ssl_tlsext.c
libssl_la_SOURCES += ssl_transcript.c
libssl_la_SOURCES += ssl_txt.c
libssl_la_SOURCES += ssl_versions.c
libssl_la_SOURCES += t1_enc.c
libssl_la_SOURCES += t1_lib.c
libssl_la_SOURCES += tls_buffer.c
libssl_la_SOURCES += tls_content.c
libssl_la_SOURCES += tls_key_share.c
libssl_la_SOURCES += tls_lib.c
libssl_la_SOURCES += tls12_key_schedule.c
libssl_la_SOURCES += tls12_lib.c
libssl_la_SOURCES += tls12_record_layer.c
libssl_la_SOURCES += tls13_client.c
libssl_la_SOURCES += tls13_error.c
libssl_la_SOURCES += tls13_handshake.c
libssl_la_SOURCES += tls13_handshake_msg.c
libssl_la_SOURCES += tls13_key_schedule.c
libssl_la_SOURCES += tls13_legacy.c
libssl_la_SOURCES += tls13_lib.c
libssl_la_SOURCES += tls13_quic.c
libssl_la_SOURCES += tls13_record.c
libssl_la_SOURCES += tls13_record_layer.c
libssl_la_SOURCES += tls13_server.c

noinst_HEADERS += srtp.h
noinst_HEADERS += dtls_locl.h
noinst_HEADERS += ssl_locl.h
Changes to jni/libressl/ssl/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
am__DEPENDENCIES_1 =
libssl_la_DEPENDENCIES = $(abs_top_builddir)/crypto/libcrypto.la \
	$(am__DEPENDENCIES_1) libbs.la
am_libssl_la_OBJECTS = bio_ssl.lo d1_both.lo d1_lib.lo d1_pkt.lo \
	d1_srtp.lo pqueue.lo s3_cbc.lo s3_lib.lo ssl_algs.lo \
	ssl_asn1.lo ssl_both.lo ssl_cert.lo ssl_ciph.lo ssl_ciphers.lo \
	ssl_clnt.lo ssl_err.lo ssl_init.lo ssl_kex.lo ssl_lib.lo \
	ssl_methods.lo ssl_packet.lo ssl_pkt.lo ssl_rsa.lo ssl_sess.lo \

	ssl_sigalgs.lo ssl_srvr.lo ssl_stat.lo ssl_tlsext.lo \
	ssl_transcript.lo ssl_txt.lo ssl_versions.lo t1_enc.lo \
	t1_lib.lo tls_buffer.lo tls_content.lo tls_key_share.lo \
	tls12_key_schedule.lo tls12_lib.lo tls12_record_layer.lo \
	tls13_client.lo tls13_error.lo tls13_handshake.lo \
	tls13_handshake_msg.lo tls13_key_schedule.lo tls13_legacy.lo \
	tls13_lib.lo tls13_record.lo tls13_record_layer.lo \
	tls13_server.lo
libssl_la_OBJECTS = $(am_libssl_la_OBJECTS)
libssl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(libssl_la_LDFLAGS) $(LDFLAGS) -o $@
@ENABLE_LIBTLS_ONLY_FALSE@am_libssl_la_rpath = -rpath $(libdir)
@ENABLE_LIBTLS_ONLY_TRUE@am_libssl_la_rpath =
AM_V_P = $(am__v_P_@AM_V@)







|
>
|
|
|



|
|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
am__DEPENDENCIES_1 =
libssl_la_DEPENDENCIES = $(abs_top_builddir)/crypto/libcrypto.la \
	$(am__DEPENDENCIES_1) libbs.la
am_libssl_la_OBJECTS = bio_ssl.lo d1_both.lo d1_lib.lo d1_pkt.lo \
	d1_srtp.lo pqueue.lo s3_cbc.lo s3_lib.lo ssl_algs.lo \
	ssl_asn1.lo ssl_both.lo ssl_cert.lo ssl_ciph.lo ssl_ciphers.lo \
	ssl_clnt.lo ssl_err.lo ssl_init.lo ssl_kex.lo ssl_lib.lo \
	ssl_methods.lo ssl_packet.lo ssl_pkt.lo ssl_rsa.lo \
	ssl_seclevel.lo ssl_sess.lo ssl_sigalgs.lo ssl_srvr.lo \
	ssl_stat.lo ssl_tlsext.lo ssl_transcript.lo ssl_txt.lo \
	ssl_versions.lo t1_enc.lo t1_lib.lo tls_buffer.lo \
	tls_content.lo tls_key_share.lo tls_lib.lo \
	tls12_key_schedule.lo tls12_lib.lo tls12_record_layer.lo \
	tls13_client.lo tls13_error.lo tls13_handshake.lo \
	tls13_handshake_msg.lo tls13_key_schedule.lo tls13_legacy.lo \
	tls13_lib.lo tls13_quic.lo tls13_record.lo \
	tls13_record_layer.lo tls13_server.lo
libssl_la_OBJECTS = $(am_libssl_la_OBJECTS)
libssl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(libssl_la_LDFLAGS) $(LDFLAGS) -o $@
@ENABLE_LIBTLS_ONLY_FALSE@am_libssl_la_rpath = -rpath $(libdir)
@ENABLE_LIBTLS_ONLY_TRUE@am_libssl_la_rpath =
AM_V_P = $(am__v_P_@AM_V@)
191
192
193
194
195
196
197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213

214
215
216
217
218
219
220
	./$(DEPDIR)/ssl_asn1.Plo ./$(DEPDIR)/ssl_both.Plo \
	./$(DEPDIR)/ssl_cert.Plo ./$(DEPDIR)/ssl_ciph.Plo \
	./$(DEPDIR)/ssl_ciphers.Plo ./$(DEPDIR)/ssl_clnt.Plo \
	./$(DEPDIR)/ssl_err.Plo ./$(DEPDIR)/ssl_init.Plo \
	./$(DEPDIR)/ssl_kex.Plo ./$(DEPDIR)/ssl_lib.Plo \
	./$(DEPDIR)/ssl_methods.Plo ./$(DEPDIR)/ssl_packet.Plo \
	./$(DEPDIR)/ssl_pkt.Plo ./$(DEPDIR)/ssl_rsa.Plo \

	./$(DEPDIR)/ssl_sess.Plo ./$(DEPDIR)/ssl_sigalgs.Plo \
	./$(DEPDIR)/ssl_srvr.Plo ./$(DEPDIR)/ssl_stat.Plo \
	./$(DEPDIR)/ssl_tlsext.Plo ./$(DEPDIR)/ssl_transcript.Plo \
	./$(DEPDIR)/ssl_txt.Plo ./$(DEPDIR)/ssl_versions.Plo \
	./$(DEPDIR)/t1_enc.Plo ./$(DEPDIR)/t1_lib.Plo \
	./$(DEPDIR)/tls12_key_schedule.Plo ./$(DEPDIR)/tls12_lib.Plo \
	./$(DEPDIR)/tls12_record_layer.Plo \
	./$(DEPDIR)/tls13_client.Plo ./$(DEPDIR)/tls13_error.Plo \
	./$(DEPDIR)/tls13_handshake.Plo \
	./$(DEPDIR)/tls13_handshake_msg.Plo \
	./$(DEPDIR)/tls13_key_schedule.Plo \
	./$(DEPDIR)/tls13_legacy.Plo ./$(DEPDIR)/tls13_lib.Plo \
	./$(DEPDIR)/tls13_record.Plo \
	./$(DEPDIR)/tls13_record_layer.Plo \
	./$(DEPDIR)/tls13_server.Plo ./$(DEPDIR)/tls_buffer.Plo \
	./$(DEPDIR)/tls_content.Plo ./$(DEPDIR)/tls_key_share.Plo

am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
	$(AM_CFLAGS) $(CFLAGS)







>
|
|
|
|
|
|
<





|


|
>







192
193
194
195
196
197
198
199
200
201
202
203
204
205

206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
	./$(DEPDIR)/ssl_asn1.Plo ./$(DEPDIR)/ssl_both.Plo \
	./$(DEPDIR)/ssl_cert.Plo ./$(DEPDIR)/ssl_ciph.Plo \
	./$(DEPDIR)/ssl_ciphers.Plo ./$(DEPDIR)/ssl_clnt.Plo \
	./$(DEPDIR)/ssl_err.Plo ./$(DEPDIR)/ssl_init.Plo \
	./$(DEPDIR)/ssl_kex.Plo ./$(DEPDIR)/ssl_lib.Plo \
	./$(DEPDIR)/ssl_methods.Plo ./$(DEPDIR)/ssl_packet.Plo \
	./$(DEPDIR)/ssl_pkt.Plo ./$(DEPDIR)/ssl_rsa.Plo \
	./$(DEPDIR)/ssl_seclevel.Plo ./$(DEPDIR)/ssl_sess.Plo \
	./$(DEPDIR)/ssl_sigalgs.Plo ./$(DEPDIR)/ssl_srvr.Plo \
	./$(DEPDIR)/ssl_stat.Plo ./$(DEPDIR)/ssl_tlsext.Plo \
	./$(DEPDIR)/ssl_transcript.Plo ./$(DEPDIR)/ssl_txt.Plo \
	./$(DEPDIR)/ssl_versions.Plo ./$(DEPDIR)/t1_enc.Plo \
	./$(DEPDIR)/t1_lib.Plo ./$(DEPDIR)/tls12_key_schedule.Plo \
	./$(DEPDIR)/tls12_lib.Plo ./$(DEPDIR)/tls12_record_layer.Plo \

	./$(DEPDIR)/tls13_client.Plo ./$(DEPDIR)/tls13_error.Plo \
	./$(DEPDIR)/tls13_handshake.Plo \
	./$(DEPDIR)/tls13_handshake_msg.Plo \
	./$(DEPDIR)/tls13_key_schedule.Plo \
	./$(DEPDIR)/tls13_legacy.Plo ./$(DEPDIR)/tls13_lib.Plo \
	./$(DEPDIR)/tls13_quic.Plo ./$(DEPDIR)/tls13_record.Plo \
	./$(DEPDIR)/tls13_record_layer.Plo \
	./$(DEPDIR)/tls13_server.Plo ./$(DEPDIR)/tls_buffer.Plo \
	./$(DEPDIR)/tls_content.Plo ./$(DEPDIR)/tls_key_share.Plo \
	./$(DEPDIR)/tls_lib.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
	$(AM_CFLAGS) $(CFLAGS)
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279


280
281
282
283
284
285
286
287
288
289

290
291
292
293
294
295
296
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







<
<



















>
>










>







254
255
256
257
258
259
260


261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
noinst_HEADERS = bytestring.h srtp.h dtls_locl.h ssl_locl.h \
	ssl_sigalgs.h ssl_tlsext.h tls_content.h tls_internal.h \
	tls13_internal.h tls13_handshake.h tls13_record.h
libssl_la_SOURCES = bio_ssl.c d1_both.c d1_lib.c d1_pkt.c d1_srtp.c \
	pqueue.c s3_cbc.c s3_lib.c ssl_algs.c ssl_asn1.c ssl_both.c \
	ssl_cert.c ssl_ciph.c ssl_ciphers.c ssl_clnt.c ssl_err.c \
	ssl_init.c ssl_kex.c ssl_lib.c ssl_methods.c ssl_packet.c \
	ssl_pkt.c ssl_rsa.c ssl_sess.c ssl_sigalgs.c ssl_srvr.c \
	ssl_stat.c ssl_tlsext.c ssl_transcript.c ssl_txt.c \
	ssl_versions.c t1_enc.c t1_lib.c tls_buffer.c tls_content.c \
	tls_key_share.c tls12_key_schedule.c tls12_lib.c \
	tls12_record_layer.c tls13_client.c tls13_error.c \
	tls13_handshake.c tls13_handshake_msg.c tls13_key_schedule.c \
	tls13_legacy.c tls13_lib.c tls13_record.c tls13_record_layer.c \
	tls13_server.c
all: all-am

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \







|
|

|


|
|







405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
noinst_HEADERS = bytestring.h srtp.h dtls_locl.h ssl_locl.h \
	ssl_sigalgs.h ssl_tlsext.h tls_content.h tls_internal.h \
	tls13_internal.h tls13_handshake.h tls13_record.h
libssl_la_SOURCES = bio_ssl.c d1_both.c d1_lib.c d1_pkt.c d1_srtp.c \
	pqueue.c s3_cbc.c s3_lib.c ssl_algs.c ssl_asn1.c ssl_both.c \
	ssl_cert.c ssl_ciph.c ssl_ciphers.c ssl_clnt.c ssl_err.c \
	ssl_init.c ssl_kex.c ssl_lib.c ssl_methods.c ssl_packet.c \
	ssl_pkt.c ssl_rsa.c ssl_seclevel.c ssl_sess.c ssl_sigalgs.c \
	ssl_srvr.c ssl_stat.c ssl_tlsext.c ssl_transcript.c ssl_txt.c \
	ssl_versions.c t1_enc.c t1_lib.c tls_buffer.c tls_content.c \
	tls_key_share.c tls_lib.c tls12_key_schedule.c tls12_lib.c \
	tls12_record_layer.c tls13_client.c tls13_error.c \
	tls13_handshake.c tls13_handshake_msg.c tls13_key_schedule.c \
	tls13_legacy.c tls13_lib.c tls13_quic.c tls13_record.c \
	tls13_record_layer.c tls13_server.c
all: all-am

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
529
530
531
532
533
534
535

536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555

556
557
558
559
560
561

562
563
564
565
566
567
568
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_init.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_kex.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_methods.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_packet.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_pkt.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_rsa.Plo@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_sess.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_sigalgs.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_srvr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_stat.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_tlsext.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_transcript.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_txt.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_versions.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1_enc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls12_key_schedule.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls12_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls12_record_layer.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_client.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_error.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_handshake.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_handshake_msg.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_key_schedule.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_legacy.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_lib.Plo@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_record.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_record_layer.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_server.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_buffer.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_content.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_key_share.Plo@am__quote@ # am--include-marker


$(am__depfiles_remade):
	@$(MKDIR_P) $(@D)
	@echo '# dummy' >$@-t && $(am__mv) $@-t $@

am--depfiles: $(am__depfiles_remade)








>




















>






>







532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_init.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_kex.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_methods.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_packet.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_pkt.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_rsa.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_seclevel.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_sess.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_sigalgs.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_srvr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_stat.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_tlsext.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_transcript.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_txt.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_versions.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1_enc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls12_key_schedule.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls12_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls12_record_layer.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_client.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_error.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_handshake.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_handshake_msg.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_key_schedule.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_legacy.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_quic.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_record.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_record_layer.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls13_server.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_buffer.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_content.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_key_share.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_lib.Plo@am__quote@ # am--include-marker

$(am__depfiles_remade):
	@$(MKDIR_P) $(@D)
	@echo '# dummy' >$@-t && $(am__mv) $@-t $@

am--depfiles: $(am__depfiles_remade)

643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







649
650
651
652
653
654
655

656
657
658
659
660
661
662
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
747
748
749
750
751
752
753

754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773

774
775
776
777
778
779

780
781
782
783
784
785
786
	-rm -f ./$(DEPDIR)/ssl_init.Plo
	-rm -f ./$(DEPDIR)/ssl_kex.Plo
	-rm -f ./$(DEPDIR)/ssl_lib.Plo
	-rm -f ./$(DEPDIR)/ssl_methods.Plo
	-rm -f ./$(DEPDIR)/ssl_packet.Plo
	-rm -f ./$(DEPDIR)/ssl_pkt.Plo
	-rm -f ./$(DEPDIR)/ssl_rsa.Plo

	-rm -f ./$(DEPDIR)/ssl_sess.Plo
	-rm -f ./$(DEPDIR)/ssl_sigalgs.Plo
	-rm -f ./$(DEPDIR)/ssl_srvr.Plo
	-rm -f ./$(DEPDIR)/ssl_stat.Plo
	-rm -f ./$(DEPDIR)/ssl_tlsext.Plo
	-rm -f ./$(DEPDIR)/ssl_transcript.Plo
	-rm -f ./$(DEPDIR)/ssl_txt.Plo
	-rm -f ./$(DEPDIR)/ssl_versions.Plo
	-rm -f ./$(DEPDIR)/t1_enc.Plo
	-rm -f ./$(DEPDIR)/t1_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls12_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_client.Plo
	-rm -f ./$(DEPDIR)/tls13_error.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake_msg.Plo
	-rm -f ./$(DEPDIR)/tls13_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls13_legacy.Plo
	-rm -f ./$(DEPDIR)/tls13_lib.Plo

	-rm -f ./$(DEPDIR)/tls13_record.Plo
	-rm -f ./$(DEPDIR)/tls13_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_server.Plo
	-rm -f ./$(DEPDIR)/tls_buffer.Plo
	-rm -f ./$(DEPDIR)/tls_content.Plo
	-rm -f ./$(DEPDIR)/tls_key_share.Plo

	-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
	distclean-tags

dvi: dvi-am

dvi-am:







>




















>






>







752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
	-rm -f ./$(DEPDIR)/ssl_init.Plo
	-rm -f ./$(DEPDIR)/ssl_kex.Plo
	-rm -f ./$(DEPDIR)/ssl_lib.Plo
	-rm -f ./$(DEPDIR)/ssl_methods.Plo
	-rm -f ./$(DEPDIR)/ssl_packet.Plo
	-rm -f ./$(DEPDIR)/ssl_pkt.Plo
	-rm -f ./$(DEPDIR)/ssl_rsa.Plo
	-rm -f ./$(DEPDIR)/ssl_seclevel.Plo
	-rm -f ./$(DEPDIR)/ssl_sess.Plo
	-rm -f ./$(DEPDIR)/ssl_sigalgs.Plo
	-rm -f ./$(DEPDIR)/ssl_srvr.Plo
	-rm -f ./$(DEPDIR)/ssl_stat.Plo
	-rm -f ./$(DEPDIR)/ssl_tlsext.Plo
	-rm -f ./$(DEPDIR)/ssl_transcript.Plo
	-rm -f ./$(DEPDIR)/ssl_txt.Plo
	-rm -f ./$(DEPDIR)/ssl_versions.Plo
	-rm -f ./$(DEPDIR)/t1_enc.Plo
	-rm -f ./$(DEPDIR)/t1_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls12_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_client.Plo
	-rm -f ./$(DEPDIR)/tls13_error.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake_msg.Plo
	-rm -f ./$(DEPDIR)/tls13_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls13_legacy.Plo
	-rm -f ./$(DEPDIR)/tls13_lib.Plo
	-rm -f ./$(DEPDIR)/tls13_quic.Plo
	-rm -f ./$(DEPDIR)/tls13_record.Plo
	-rm -f ./$(DEPDIR)/tls13_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_server.Plo
	-rm -f ./$(DEPDIR)/tls_buffer.Plo
	-rm -f ./$(DEPDIR)/tls_content.Plo
	-rm -f ./$(DEPDIR)/tls_key_share.Plo
	-rm -f ./$(DEPDIR)/tls_lib.Plo
	-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
	distclean-tags

dvi: dvi-am

dvi-am:
844
845
846
847
848
849
850

851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870

871
872
873
874
875
876

877
878
879
880
881
882
883
	-rm -f ./$(DEPDIR)/ssl_init.Plo
	-rm -f ./$(DEPDIR)/ssl_kex.Plo
	-rm -f ./$(DEPDIR)/ssl_lib.Plo
	-rm -f ./$(DEPDIR)/ssl_methods.Plo
	-rm -f ./$(DEPDIR)/ssl_packet.Plo
	-rm -f ./$(DEPDIR)/ssl_pkt.Plo
	-rm -f ./$(DEPDIR)/ssl_rsa.Plo

	-rm -f ./$(DEPDIR)/ssl_sess.Plo
	-rm -f ./$(DEPDIR)/ssl_sigalgs.Plo
	-rm -f ./$(DEPDIR)/ssl_srvr.Plo
	-rm -f ./$(DEPDIR)/ssl_stat.Plo
	-rm -f ./$(DEPDIR)/ssl_tlsext.Plo
	-rm -f ./$(DEPDIR)/ssl_transcript.Plo
	-rm -f ./$(DEPDIR)/ssl_txt.Plo
	-rm -f ./$(DEPDIR)/ssl_versions.Plo
	-rm -f ./$(DEPDIR)/t1_enc.Plo
	-rm -f ./$(DEPDIR)/t1_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls12_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_client.Plo
	-rm -f ./$(DEPDIR)/tls13_error.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake_msg.Plo
	-rm -f ./$(DEPDIR)/tls13_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls13_legacy.Plo
	-rm -f ./$(DEPDIR)/tls13_lib.Plo

	-rm -f ./$(DEPDIR)/tls13_record.Plo
	-rm -f ./$(DEPDIR)/tls13_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_server.Plo
	-rm -f ./$(DEPDIR)/tls_buffer.Plo
	-rm -f ./$(DEPDIR)/tls_content.Plo
	-rm -f ./$(DEPDIR)/tls_key_share.Plo

	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool







>




















>






>







852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
	-rm -f ./$(DEPDIR)/ssl_init.Plo
	-rm -f ./$(DEPDIR)/ssl_kex.Plo
	-rm -f ./$(DEPDIR)/ssl_lib.Plo
	-rm -f ./$(DEPDIR)/ssl_methods.Plo
	-rm -f ./$(DEPDIR)/ssl_packet.Plo
	-rm -f ./$(DEPDIR)/ssl_pkt.Plo
	-rm -f ./$(DEPDIR)/ssl_rsa.Plo
	-rm -f ./$(DEPDIR)/ssl_seclevel.Plo
	-rm -f ./$(DEPDIR)/ssl_sess.Plo
	-rm -f ./$(DEPDIR)/ssl_sigalgs.Plo
	-rm -f ./$(DEPDIR)/ssl_srvr.Plo
	-rm -f ./$(DEPDIR)/ssl_stat.Plo
	-rm -f ./$(DEPDIR)/ssl_tlsext.Plo
	-rm -f ./$(DEPDIR)/ssl_transcript.Plo
	-rm -f ./$(DEPDIR)/ssl_txt.Plo
	-rm -f ./$(DEPDIR)/ssl_versions.Plo
	-rm -f ./$(DEPDIR)/t1_enc.Plo
	-rm -f ./$(DEPDIR)/t1_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls12_lib.Plo
	-rm -f ./$(DEPDIR)/tls12_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_client.Plo
	-rm -f ./$(DEPDIR)/tls13_error.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake.Plo
	-rm -f ./$(DEPDIR)/tls13_handshake_msg.Plo
	-rm -f ./$(DEPDIR)/tls13_key_schedule.Plo
	-rm -f ./$(DEPDIR)/tls13_legacy.Plo
	-rm -f ./$(DEPDIR)/tls13_lib.Plo
	-rm -f ./$(DEPDIR)/tls13_quic.Plo
	-rm -f ./$(DEPDIR)/tls13_record.Plo
	-rm -f ./$(DEPDIR)/tls13_record_layer.Plo
	-rm -f ./$(DEPDIR)/tls13_server.Plo
	-rm -f ./$(DEPDIR)/tls_buffer.Plo
	-rm -f ./$(DEPDIR)/tls_content.Plo
	-rm -f ./$(DEPDIR)/tls_key_share.Plo
	-rm -f ./$(DEPDIR)/tls_lib.Plo
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool
Changes to jni/libressl/ssl/VERSION.
1
52:0:0
|
1
53:0:0
Changes to jni/libressl/ssl/bs_cbb.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: bs_cbb.c,v 1.27 2022/01/06 14:30:30 jsing Exp $	*/
/*
 * Copyright (c) 2014, Google Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: bs_cbb.c,v 1.28 2022/07/07 17:12:15 tb Exp $	*/
/*
 * Copyright (c) 2014, Google Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
158
159
160
161
162
163
164



165
166
167
168
169
170
171

	if (cbb->base->can_resize && (out_data == NULL || out_len == NULL))
		/*
		 * |out_data| and |out_len| can only be NULL if the CBB is
		 * fixed.
		 */
		return 0;




	if (out_data != NULL)
		*out_data = cbb->base->buf;

	if (out_len != NULL)
		*out_len = cbb->base->len;








>
>
>







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

	if (cbb->base->can_resize && (out_data == NULL || out_len == NULL))
		/*
		 * |out_data| and |out_len| can only be NULL if the CBB is
		 * fixed.
		 */
		return 0;

	if (out_data != NULL && *out_data != NULL)
		return 0;

	if (out_data != NULL)
		*out_data = cbb->base->buf;

	if (out_len != NULL)
		*out_len = cbb->base->len;

Changes to jni/libressl/ssl/s3_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: s3_lib.c,v 1.228 2022/03/17 17:24:37 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: s3_lib.c,v 1.238 2022/08/21 19:39:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
1555
1556
1557
1558
1559
1560
1561

1562
1563

1564
1565
1566
1567
1568


1569
1570
1571
1572
1573
1574
1575
1576
1577



1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596





1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607





1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620





1621
1622
1623
1624
1625
1626
1627
{
	if (s == NULL)
		return;

	tls1_cleanup_key_block(s);
	ssl3_release_read_buffer(s);
	ssl3_release_write_buffer(s);

	freezero(s->s3->hs.sigalgs, s->s3->hs.sigalgs_len);


	tls_key_share_free(s->s3->hs.key_share);

	tls13_secrets_destroy(s->s3->hs.tls13.secrets);
	freezero(s->s3->hs.tls13.cookie, s->s3->hs.tls13.cookie_len);
	tls13_clienthello_hash_clear(&s->s3->hs.tls13);



	sk_X509_NAME_pop_free(s->s3->hs.tls12.ca_names, X509_NAME_free);
	sk_X509_pop_free(s->internal->verified_chain, X509_free);

	tls1_transcript_free(s);
	tls1_transcript_hash_free(s);

	free(s->s3->alpn_selected);




	freezero(s->s3, sizeof(*s->s3));

	s->s3 = NULL;
}

void
ssl3_clear(SSL *s)
{
	unsigned char	*rp, *wp;
	size_t		 rlen, wlen;

	tls1_cleanup_key_block(s);
	sk_X509_NAME_pop_free(s->s3->hs.tls12.ca_names, X509_NAME_free);
	sk_X509_pop_free(s->internal->verified_chain, X509_free);
	s->internal->verified_chain = NULL;

	freezero(s->s3->hs.sigalgs, s->s3->hs.sigalgs_len);
	s->s3->hs.sigalgs = NULL;
	s->s3->hs.sigalgs_len = 0;






	tls_key_share_free(s->s3->hs.key_share);
	s->s3->hs.key_share = NULL;

	tls13_secrets_destroy(s->s3->hs.tls13.secrets);
	s->s3->hs.tls13.secrets = NULL;
	freezero(s->s3->hs.tls13.cookie, s->s3->hs.tls13.cookie_len);
	s->s3->hs.tls13.cookie = NULL;
	s->s3->hs.tls13.cookie_len = 0;
	tls13_clienthello_hash_clear(&s->s3->hs.tls13);






	s->s3->hs.extensions_seen = 0;

	rp = s->s3->rbuf.buf;
	wp = s->s3->wbuf.buf;
	rlen = s->s3->rbuf.len;
	wlen = s->s3->wbuf.len;

	tls1_transcript_free(s);
	tls1_transcript_hash_free(s);

	free(s->s3->alpn_selected);
	s->s3->alpn_selected = NULL;
	s->s3->alpn_selected_len = 0;






	memset(s->s3, 0, sizeof(*s->s3));

	s->s3->rbuf.buf = rp;
	s->s3->wbuf.buf = wp;
	s->s3->rbuf.len = rlen;
	s->s3->wbuf.len = wlen;







>

|
>





>
>









>
>
>








|
|









>
>
>
>
>











>
>
>
>
>













>
>
>
>
>







1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
{
	if (s == NULL)
		return;

	tls1_cleanup_key_block(s);
	ssl3_release_read_buffer(s);
	ssl3_release_write_buffer(s);

	freezero(s->s3->hs.sigalgs, s->s3->hs.sigalgs_len);
	sk_X509_pop_free(s->s3->hs.peer_certs, X509_free);
	sk_X509_pop_free(s->s3->hs.peer_certs_no_leaf, X509_free);
	tls_key_share_free(s->s3->hs.key_share);

	tls13_secrets_destroy(s->s3->hs.tls13.secrets);
	freezero(s->s3->hs.tls13.cookie, s->s3->hs.tls13.cookie_len);
	tls13_clienthello_hash_clear(&s->s3->hs.tls13);

	tls_buffer_free(s->s3->hs.tls13.quic_read_buffer);

	sk_X509_NAME_pop_free(s->s3->hs.tls12.ca_names, X509_NAME_free);
	sk_X509_pop_free(s->internal->verified_chain, X509_free);

	tls1_transcript_free(s);
	tls1_transcript_hash_free(s);

	free(s->s3->alpn_selected);

	freezero(s->s3->peer_quic_transport_params,
	    s->s3->peer_quic_transport_params_len);

	freezero(s->s3, sizeof(*s->s3));

	s->s3 = NULL;
}

void
ssl3_clear(SSL *s)
{
	unsigned char *rp, *wp;
	size_t rlen, wlen;

	tls1_cleanup_key_block(s);
	sk_X509_NAME_pop_free(s->s3->hs.tls12.ca_names, X509_NAME_free);
	sk_X509_pop_free(s->internal->verified_chain, X509_free);
	s->internal->verified_chain = NULL;

	freezero(s->s3->hs.sigalgs, s->s3->hs.sigalgs_len);
	s->s3->hs.sigalgs = NULL;
	s->s3->hs.sigalgs_len = 0;

	sk_X509_pop_free(s->s3->hs.peer_certs, X509_free);
	s->s3->hs.peer_certs = NULL;
	sk_X509_pop_free(s->s3->hs.peer_certs_no_leaf, X509_free);
	s->s3->hs.peer_certs_no_leaf = NULL;

	tls_key_share_free(s->s3->hs.key_share);
	s->s3->hs.key_share = NULL;

	tls13_secrets_destroy(s->s3->hs.tls13.secrets);
	s->s3->hs.tls13.secrets = NULL;
	freezero(s->s3->hs.tls13.cookie, s->s3->hs.tls13.cookie_len);
	s->s3->hs.tls13.cookie = NULL;
	s->s3->hs.tls13.cookie_len = 0;
	tls13_clienthello_hash_clear(&s->s3->hs.tls13);

	tls_buffer_free(s->s3->hs.tls13.quic_read_buffer);
	s->s3->hs.tls13.quic_read_buffer = NULL;
	s->s3->hs.tls13.quic_read_level = ssl_encryption_initial;
	s->s3->hs.tls13.quic_write_level = ssl_encryption_initial;

	s->s3->hs.extensions_seen = 0;

	rp = s->s3->rbuf.buf;
	wp = s->s3->wbuf.buf;
	rlen = s->s3->rbuf.len;
	wlen = s->s3->wbuf.len;

	tls1_transcript_free(s);
	tls1_transcript_hash_free(s);

	free(s->s3->alpn_selected);
	s->s3->alpn_selected = NULL;
	s->s3->alpn_selected_len = 0;

	freezero(s->s3->peer_quic_transport_params,
	    s->s3->peer_quic_transport_params_len);
	s->s3->peer_quic_transport_params = NULL;
	s->s3->peer_quic_transport_params_len = 0;

	memset(s->s3, 0, sizeof(*s->s3));

	s->s3->rbuf.buf = rp;
	s->s3->wbuf.buf = wp;
	s->s3->rbuf.len = rlen;
	s->s3->wbuf.len = wlen;
1635
1636
1637
1638
1639
1640
1641

































1642
1643
1644
1645
1646
1647
1648
	s->s3->in_read_app_data = 0;

	s->internal->packet_length = 0;
	s->version = TLS1_VERSION;

	s->s3->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT);
}


































long
_SSL_get_peer_tmp_key(SSL *s, EVP_PKEY **key)
{
	EVP_PKEY *pkey = NULL;
	int ret = 0;








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
	s->s3->in_read_app_data = 0;

	s->internal->packet_length = 0;
	s->version = TLS1_VERSION;

	s->s3->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT);
}

long
_SSL_get_shared_group(SSL *s, long n)
{
	size_t count;
	int nid;

	/* OpenSSL document that they return -1 for clients. They return 0. */
	if (!s->server)
		return 0;

	if (n == -1) {
		if (!tls1_count_shared_groups(s, &count))
			return 0;

		if (count > LONG_MAX)
			count = LONG_MAX;

		return count;
	}

	/* Undocumented special case added for Suite B profile support. */
	if (n == -2)
		n = 0;

	if (n < 0)
		return 0;

	if (!tls1_get_shared_group_by_index(s, n, &nid))
		return NID_undef;

	return nid;
}

long
_SSL_get_peer_tmp_key(SSL *s, EVP_PKEY **key)
{
	EVP_PKEY *pkey = NULL;
	int ret = 0;

1701
1702
1703
1704
1705
1706
1707





1708
1709
1710
1711
1712
1713
1714
{
	DH *dhe_params;

	if (dh == NULL) {
		SSLerror(s, ERR_R_PASSED_NULL_PARAMETER);
		return 0;
	}






	if ((dhe_params = DHparams_dup(dh)) == NULL) {
		SSLerror(s, ERR_R_DH_LIB);
		return 0;
	}

	DH_free(s->cert->dhe_params);







>
>
>
>
>







1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
{
	DH *dhe_params;

	if (dh == NULL) {
		SSLerror(s, ERR_R_PASSED_NULL_PARAMETER);
		return 0;
	}

	if (!ssl_security_dh(s, dh)) {
		SSLerror(s, SSL_R_DH_KEY_TOO_SMALL);
		return 0;
	}

	if ((dhe_params = DHparams_dup(dh)) == NULL) {
		SSLerror(s, ERR_R_DH_LIB);
		return 0;
	}

	DH_free(s->cert->dhe_params);
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899

	return 1;
}

int
SSL_set0_chain(SSL *ssl, STACK_OF(X509) *chain)
{
	return ssl_cert_set0_chain(ssl->cert, chain);
}

int
SSL_set1_chain(SSL *ssl, STACK_OF(X509) *chain)
{
	return ssl_cert_set1_chain(ssl->cert, chain);
}

int
SSL_add0_chain_cert(SSL *ssl, X509 *x509)
{
	return ssl_cert_add0_chain_cert(ssl->cert, x509);
}

int
SSL_add1_chain_cert(SSL *ssl, X509 *x509)
{
	return ssl_cert_add1_chain_cert(ssl->cert, x509);
}

int
SSL_get0_chain_certs(const SSL *ssl, STACK_OF(X509) **out_chain)
{
	*out_chain = NULL;

	if (ssl->cert->key != NULL)
		*out_chain = ssl->cert->key->chain;

	return 1;
}

int
SSL_clear_chain_certs(SSL *ssl)
{
	return ssl_cert_set0_chain(ssl->cert, NULL);
}

int
SSL_set1_groups(SSL *s, const int *groups, size_t groups_len)
{
	return tls1_set_groups(&s->internal->tlsext_supportedgroups,
	    &s->internal->tlsext_supportedgroups_length, groups, groups_len);







|





|





|





|
















|







1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959

	return 1;
}

int
SSL_set0_chain(SSL *ssl, STACK_OF(X509) *chain)
{
	return ssl_cert_set0_chain(NULL, ssl, chain);
}

int
SSL_set1_chain(SSL *ssl, STACK_OF(X509) *chain)
{
	return ssl_cert_set1_chain(NULL, ssl, chain);
}

int
SSL_add0_chain_cert(SSL *ssl, X509 *x509)
{
	return ssl_cert_add0_chain_cert(NULL, ssl, x509);
}

int
SSL_add1_chain_cert(SSL *ssl, X509 *x509)
{
	return ssl_cert_add1_chain_cert(NULL, ssl, x509);
}

int
SSL_get0_chain_certs(const SSL *ssl, STACK_OF(X509) **out_chain)
{
	*out_chain = NULL;

	if (ssl->cert->key != NULL)
		*out_chain = ssl->cert->key->chain;

	return 1;
}

int
SSL_clear_chain_certs(SSL *ssl)
{
	return ssl_cert_set0_chain(NULL, ssl, NULL);
}

int
SSL_set1_groups(SSL *s, const int *groups, size_t groups_len)
{
	return tls1_set_groups(&s->internal->tlsext_supportedgroups,
	    &s->internal->tlsext_supportedgroups_length, groups, groups_len);
2051
2052
2053
2054
2055
2056
2057



2058
2059
2060
2061
2062
2063
2064

	case SSL_CTRL_SET_GROUPS:
		return SSL_set1_groups(s, parg, larg);

	case SSL_CTRL_SET_GROUPS_LIST:
		return SSL_set1_groups_list(s, parg);




	/* XXX - rename to SSL_CTRL_GET_PEER_TMP_KEY and remove server check. */
	case SSL_CTRL_GET_SERVER_TMP_KEY:
		if (s->server != 0)
			return 0;
		return _SSL_get_peer_tmp_key(s, parg);

	case SSL_CTRL_GET_MIN_PROTO_VERSION:







>
>
>







2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127

	case SSL_CTRL_SET_GROUPS:
		return SSL_set1_groups(s, parg, larg);

	case SSL_CTRL_SET_GROUPS_LIST:
		return SSL_set1_groups_list(s, parg);

	case SSL_CTRL_GET_SHARED_GROUP:
		return _SSL_get_shared_group(s, larg);

	/* XXX - rename to SSL_CTRL_GET_PEER_TMP_KEY and remove server check. */
	case SSL_CTRL_GET_SERVER_TMP_KEY:
		if (s->server != 0)
			return 0;
		return _SSL_get_peer_tmp_key(s, parg);

	case SSL_CTRL_GET_MIN_PROTO_VERSION:
2133
2134
2135
2136
2137
2138
2139





2140
2141
2142
2143
2144
2145
2146
{
	DH *dhe_params;

	if (dh == NULL) {
		SSLerrorx(ERR_R_PASSED_NULL_PARAMETER);
		return 0;
	}






	if ((dhe_params = DHparams_dup(dh)) == NULL) {
		SSLerrorx(ERR_R_DH_LIB);
		return 0;
	}

	DH_free(ctx->internal->cert->dhe_params);







>
>
>
>
>







2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
{
	DH *dhe_params;

	if (dh == NULL) {
		SSLerrorx(ERR_R_PASSED_NULL_PARAMETER);
		return 0;
	}

	if (!ssl_ctx_security_dh(ctx, dh)) {
		SSLerrorx(SSL_R_DH_KEY_TOO_SMALL);
		return 0;
	}

	if ((dhe_params = DHparams_dup(dh)) == NULL) {
		SSLerrorx(ERR_R_DH_LIB);
		return 0;
	}

	DH_free(ctx->internal->cert->dhe_params);
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
	ctx->internal->tlsext_status_arg = arg;
	return 1;
}

int
SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *chain)
{
	return ssl_cert_set0_chain(ctx->internal->cert, chain);
}

int
SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *chain)
{
	return ssl_cert_set1_chain(ctx->internal->cert, chain);
}

int
SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509)
{
	return ssl_cert_add0_chain_cert(ctx->internal->cert, x509);
}

int
SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509)
{
	return ssl_cert_add1_chain_cert(ctx->internal->cert, x509);
}

int
SSL_CTX_get0_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain)
{
	*out_chain = NULL;

	if (ctx->internal->cert->key != NULL)
		*out_chain = ctx->internal->cert->key->chain;

	return 1;
}

int
SSL_CTX_clear_chain_certs(SSL_CTX *ctx)
{
	return ssl_cert_set0_chain(ctx->internal->cert, NULL);
}

static int
_SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *cert)
{
	if (ctx->extra_certs == NULL) {
		if ((ctx->extra_certs = sk_X509_new_null()) == NULL)







|





|





|





|
















|







2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
	ctx->internal->tlsext_status_arg = arg;
	return 1;
}

int
SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *chain)
{
	return ssl_cert_set0_chain(ctx, NULL, chain);
}

int
SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *chain)
{
	return ssl_cert_set1_chain(ctx, NULL, chain);
}

int
SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509)
{
	return ssl_cert_add0_chain_cert(ctx, NULL, x509);
}

int
SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509)
{
	return ssl_cert_add1_chain_cert(ctx, NULL, x509);
}

int
SSL_CTX_get0_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain)
{
	*out_chain = NULL;

	if (ctx->internal->cert->key != NULL)
		*out_chain = ctx->internal->cert->key->chain;

	return 1;
}

int
SSL_CTX_clear_chain_certs(SSL_CTX *ctx)
{
	return ssl_cert_set0_chain(ctx, NULL, NULL);
}

static int
_SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *cert)
{
	if (ctx->extra_certs == NULL) {
		if ((ctx->extra_certs = sk_X509_new_null()) == NULL)
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
    STACK_OF(SSL_CIPHER) *srvr)
{
	unsigned long alg_k, alg_a, mask_k, mask_a;
	STACK_OF(SSL_CIPHER) *prio, *allow;
	SSL_CIPHER *c, *ret = NULL;
	int can_use_ecc;
	int i, ii, ok;
	SSL_CERT *cert;

	/* Let's see which ciphers we can support */
	cert = s->cert;

	can_use_ecc = (tls1_get_shared_curve(s) != NID_undef);

	/*
	 * Do not set the compare functions, because this may lead to a
	 * reordering by "id". We want to keep the original ordering.
	 * We may pay a price in performance during sk_SSL_CIPHER_find(),
	 * but would have to pay with the price of sk_SSL_CIPHER_dup().
	 */







|





|







2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
    STACK_OF(SSL_CIPHER) *srvr)
{
	unsigned long alg_k, alg_a, mask_k, mask_a;
	STACK_OF(SSL_CIPHER) *prio, *allow;
	SSL_CIPHER *c, *ret = NULL;
	int can_use_ecc;
	int i, ii, nid, ok;
	SSL_CERT *cert;

	/* Let's see which ciphers we can support */
	cert = s->cert;

	can_use_ecc = tls1_get_supported_group(s, &nid);

	/*
	 * Do not set the compare functions, because this may lead to a
	 * reordering by "id". We want to keep the original ordering.
	 * We may pay a price in performance during sk_SSL_CIPHER_find(),
	 * but would have to pay with the price of sk_SSL_CIPHER_dup().
	 */
2512
2513
2514
2515
2516
2517
2518



2519
2520
2521
2522
2523
2524
2525
		    !SSL_USE_TLS1_3_CIPHERS(s))
			continue;

		/* If TLS v1.3, only allow TLS v1.3 ciphersuites. */
		if (SSL_USE_TLS1_3_CIPHERS(s) &&
		    !(c->algorithm_ssl & SSL_TLSV1_3))
			continue;




		ssl_set_cert_masks(cert, c);
		mask_k = cert->mask_k;
		mask_a = cert->mask_a;

		alg_k = c->algorithm_mkey;
		alg_a = c->algorithm_auth;







>
>
>







2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
		    !SSL_USE_TLS1_3_CIPHERS(s))
			continue;

		/* If TLS v1.3, only allow TLS v1.3 ciphersuites. */
		if (SSL_USE_TLS1_3_CIPHERS(s) &&
		    !(c->algorithm_ssl & SSL_TLSV1_3))
			continue;

		if (!ssl_security_shared_cipher(s, c))
			continue;

		ssl_set_cert_masks(cert, c);
		mask_k = cert->mask_k;
		mask_a = cert->mask_a;

		alg_k = c->algorithm_mkey;
		alg_a = c->algorithm_auth;
Changes to jni/libressl/ssl/ssl.sym.
77
78
79
80
81
82
83

84
85
86
87
88
89
90
SSL_CTX_get_info_callback
SSL_CTX_get_keylog_callback
SSL_CTX_get_max_early_data
SSL_CTX_get_max_proto_version
SSL_CTX_get_min_proto_version
SSL_CTX_get_num_tickets
SSL_CTX_get_quiet_shutdown

SSL_CTX_get_ssl_method
SSL_CTX_get_timeout
SSL_CTX_get_verify_callback
SSL_CTX_get_verify_depth
SSL_CTX_get_verify_mode
SSL_CTX_load_verify_locations
SSL_CTX_load_verify_mem







>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
SSL_CTX_get_info_callback
SSL_CTX_get_keylog_callback
SSL_CTX_get_max_early_data
SSL_CTX_get_max_proto_version
SSL_CTX_get_min_proto_version
SSL_CTX_get_num_tickets
SSL_CTX_get_quiet_shutdown
SSL_CTX_get_security_level
SSL_CTX_get_ssl_method
SSL_CTX_get_timeout
SSL_CTX_get_verify_callback
SSL_CTX_get_verify_depth
SSL_CTX_get_verify_mode
SSL_CTX_load_verify_locations
SSL_CTX_load_verify_mem
125
126
127
128
129
130
131

132

133
134
135
136
137
138
139
SSL_CTX_set_min_proto_version
SSL_CTX_set_msg_callback
SSL_CTX_set_next_proto_select_cb
SSL_CTX_set_next_protos_advertised_cb
SSL_CTX_set_num_tickets
SSL_CTX_set_post_handshake_auth
SSL_CTX_set_purpose

SSL_CTX_set_quiet_shutdown

SSL_CTX_set_session_id_context
SSL_CTX_set_ssl_version
SSL_CTX_set_timeout
SSL_CTX_set_tlsext_use_srtp
SSL_CTX_set_tmp_dh_callback
SSL_CTX_set_tmp_ecdh_callback
SSL_CTX_set_tmp_rsa_callback







>

>







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
SSL_CTX_set_min_proto_version
SSL_CTX_set_msg_callback
SSL_CTX_set_next_proto_select_cb
SSL_CTX_set_next_protos_advertised_cb
SSL_CTX_set_num_tickets
SSL_CTX_set_post_handshake_auth
SSL_CTX_set_purpose
SSL_CTX_set_quic_method
SSL_CTX_set_quiet_shutdown
SSL_CTX_set_security_level
SSL_CTX_set_session_id_context
SSL_CTX_set_ssl_version
SSL_CTX_set_timeout
SSL_CTX_set_tlsext_use_srtp
SSL_CTX_set_tmp_dh_callback
SSL_CTX_set_tmp_ecdh_callback
SSL_CTX_set_tmp_rsa_callback
231
232
233
234
235
236
237

238
239
240
241
242

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268





269
270
271
272
273
274
275
SSL_get_max_early_data
SSL_get_max_proto_version
SSL_get_min_proto_version
SSL_get_num_tickets
SSL_get_peer_cert_chain
SSL_get_peer_certificate
SSL_get_peer_finished

SSL_get_privatekey
SSL_get_quiet_shutdown
SSL_get_rbio
SSL_get_read_ahead
SSL_get_rfd

SSL_get_selected_srtp_profile
SSL_get_server_random
SSL_get_servername
SSL_get_servername_type
SSL_get_session
SSL_get_shared_ciphers
SSL_get_shutdown
SSL_get_srtp_profiles
SSL_get_ssl_method
SSL_get_verify_callback
SSL_get_verify_depth
SSL_get_verify_mode
SSL_get_verify_result
SSL_get_version
SSL_get_wbio
SSL_get_wfd
SSL_has_matching_session_id
SSL_is_dtls

SSL_is_server
SSL_library_init
SSL_load_client_CA_file
SSL_load_error_strings
SSL_new
SSL_peek
SSL_peek_ex
SSL_pending





SSL_read
SSL_read_early_data
SSL_read_ex
SSL_renegotiate
SSL_renegotiate_abbreviated
SSL_renegotiate_pending
SSL_rstate_string







>





>


















>








>
>
>
>
>







234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
SSL_get_max_early_data
SSL_get_max_proto_version
SSL_get_min_proto_version
SSL_get_num_tickets
SSL_get_peer_cert_chain
SSL_get_peer_certificate
SSL_get_peer_finished
SSL_get_peer_quic_transport_params
SSL_get_privatekey
SSL_get_quiet_shutdown
SSL_get_rbio
SSL_get_read_ahead
SSL_get_rfd
SSL_get_security_level
SSL_get_selected_srtp_profile
SSL_get_server_random
SSL_get_servername
SSL_get_servername_type
SSL_get_session
SSL_get_shared_ciphers
SSL_get_shutdown
SSL_get_srtp_profiles
SSL_get_ssl_method
SSL_get_verify_callback
SSL_get_verify_depth
SSL_get_verify_mode
SSL_get_verify_result
SSL_get_version
SSL_get_wbio
SSL_get_wfd
SSL_has_matching_session_id
SSL_is_dtls
SSL_is_quic
SSL_is_server
SSL_library_init
SSL_load_client_CA_file
SSL_load_error_strings
SSL_new
SSL_peek
SSL_peek_ex
SSL_pending
SSL_process_quic_post_handshake
SSL_provide_quic_data
SSL_quic_max_handshake_flight_len
SSL_quic_read_level
SSL_quic_write_level
SSL_read
SSL_read_early_data
SSL_read_ex
SSL_renegotiate
SSL_renegotiate_abbreviated
SSL_renegotiate_pending
SSL_rstate_string
300
301
302
303
304
305
306



307
308
309

310
311
312
313
314
315
316
SSL_set_max_proto_version
SSL_set_min_proto_version
SSL_set_msg_callback
SSL_set_num_tickets
SSL_set_post_handshake_auth
SSL_set_psk_use_session_callback
SSL_set_purpose



SSL_set_quiet_shutdown
SSL_set_read_ahead
SSL_set_rfd

SSL_set_session
SSL_set_session_id_context
SSL_set_session_secret_cb
SSL_set_session_ticket_ext
SSL_set_session_ticket_ext_cb
SSL_set_shutdown
SSL_set_ssl_method







>
>
>



>







311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
SSL_set_max_proto_version
SSL_set_min_proto_version
SSL_set_msg_callback
SSL_set_num_tickets
SSL_set_post_handshake_auth
SSL_set_psk_use_session_callback
SSL_set_purpose
SSL_set_quic_method
SSL_set_quic_transport_params
SSL_set_quic_use_legacy_codepoint
SSL_set_quiet_shutdown
SSL_set_read_ahead
SSL_set_rfd
SSL_set_security_level
SSL_set_session
SSL_set_session_id_context
SSL_set_session_secret_cb
SSL_set_session_ticket_ext
SSL_set_session_ticket_ext_cb
SSL_set_shutdown
SSL_set_ssl_method
Changes to jni/libressl/ssl/ssl_asn1.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_asn1.c,v 1.61 2022/01/11 18:39:28 jsing Exp $ */
/*
 * Copyright (c) 2016 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_asn1.c,v 1.65 2022/06/07 17:53:42 tb Exp $ */
/*
 * Copyright (c) 2016 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	if (s->ssl_version < 0)
		goto err;
	if (!CBB_add_asn1_uint64(&session, s->ssl_version))
		goto err;

	/* Cipher suite ID. */
	/* XXX - require cipher to be non-NULL or always/only use cipher_id. */
	cid = (uint16_t)(s->cipher_id & 0xffff);
	if (s->cipher != NULL)
		cid = ssl3_cipher_get_value(s->cipher);
	if (!CBB_add_asn1(&session, &cipher_suite, CBS_ASN1_OCTETSTRING))
		goto err;
	if (!CBB_add_u16(&cipher_suite, cid))
		goto err;








|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	if (s->ssl_version < 0)
		goto err;
	if (!CBB_add_asn1_uint64(&session, s->ssl_version))
		goto err;

	/* Cipher suite ID. */
	/* XXX - require cipher to be non-NULL or always/only use cipher_id. */
	cid = (uint16_t)(s->cipher_id & SSL3_CK_VALUE_MASK);
	if (s->cipher != NULL)
		cid = ssl3_cipher_get_value(s->cipher);
	if (!CBB_add_asn1(&session, &cipher_suite, CBS_ASN1_OCTETSTRING))
		goto err;
	if (!CBB_add_u16(&cipher_suite, cid))
		goto err;

291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
	s->cipher = NULL;
	s->cipher_id = SSL3_CK_ID | cipher_value;

	/* Session ID. */
	if (!CBS_get_asn1(&session, &session_id, CBS_ASN1_OCTETSTRING))
		goto err;
	if (!CBS_write_bytes(&session_id, s->session_id, sizeof(s->session_id),
	    &data_len))
		goto err;
	if (data_len > UINT_MAX)
		goto err;
	s->session_id_length = (unsigned int)data_len;

	/* Master key. */
	if (!CBS_get_asn1(&session, &master_key, CBS_ASN1_OCTETSTRING))
		goto err;
	if (!CBS_write_bytes(&master_key, s->master_key, sizeof(s->master_key),
	    &data_len))
		goto err;
	if (data_len > INT_MAX)
		goto err;
	s->master_key_length = (int)data_len;

	/* Time [1]. */
	s->time = time(NULL);
	if (!CBS_get_optional_asn1_uint64(&session, &stime, SSLASN1_TIME_TAG,
	    0))
		goto err;
	if (stime > time_max())







|

<
<
<





|

<
<
<







291
292
293
294
295
296
297
298
299



300
301
302
303
304
305
306



307
308
309
310
311
312
313
	s->cipher = NULL;
	s->cipher_id = SSL3_CK_ID | cipher_value;

	/* Session ID. */
	if (!CBS_get_asn1(&session, &session_id, CBS_ASN1_OCTETSTRING))
		goto err;
	if (!CBS_write_bytes(&session_id, s->session_id, sizeof(s->session_id),
	    &s->session_id_length))
		goto err;




	/* Master key. */
	if (!CBS_get_asn1(&session, &master_key, CBS_ASN1_OCTETSTRING))
		goto err;
	if (!CBS_write_bytes(&master_key, s->master_key, sizeof(s->master_key),
	    &s->master_key_length))
		goto err;




	/* Time [1]. */
	s->time = time(NULL);
	if (!CBS_get_optional_asn1_uint64(&session, &stime, SSLASN1_TIME_TAG,
	    0))
		goto err;
	if (stime > time_max())
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
	/* Session ID context [4]. */
	s->sid_ctx_length = 0;
	if (!CBS_get_optional_asn1_octet_string(&session, &session_id, &present,
	    SSLASN1_SESSION_ID_CTX_TAG))
		goto err;
	if (present) {
		if (!CBS_write_bytes(&session_id, (uint8_t *)&s->sid_ctx,
		    sizeof(s->sid_ctx), &data_len))
			goto err;
		if (data_len > UINT_MAX)
			goto err;
		s->sid_ctx_length = (unsigned int)data_len;
	}

	/* Verify result [5]. */
	s->verify_result = X509_V_OK;
	if (!CBS_get_optional_asn1_uint64(&session, &verify_result,
	    SSLASN1_VERIFY_RESULT_TAG, X509_V_OK))
		goto err;







|

<
<
<







344
345
346
347
348
349
350
351
352



353
354
355
356
357
358
359
	/* Session ID context [4]. */
	s->sid_ctx_length = 0;
	if (!CBS_get_optional_asn1_octet_string(&session, &session_id, &present,
	    SSLASN1_SESSION_ID_CTX_TAG))
		goto err;
	if (present) {
		if (!CBS_write_bytes(&session_id, (uint8_t *)&s->sid_ctx,
		    sizeof(s->sid_ctx), &s->sid_ctx_length))
			goto err;



	}

	/* Verify result [5]. */
	s->verify_result = X509_V_OK;
	if (!CBS_get_optional_asn1_uint64(&session, &verify_result,
	    SSLASN1_VERIFY_RESULT_TAG, X509_V_OK))
		goto err;
Changes to jni/libressl/ssl/ssl_cert.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_cert.c,v 1.95 2022/02/05 14:54:10 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_cert.c,v 1.103 2022/07/07 13:04:39 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
166
167
168
169
170
171
172



173
174
175
176
177
178
179
	ret = calloc(1, sizeof(SSL_CERT));
	if (ret == NULL) {
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		return (NULL);
	}
	ret->key = &(ret->pkeys[SSL_PKEY_RSA]);
	ret->references = 1;



	return (ret);
}

SSL_CERT *
ssl_cert_dup(SSL_CERT *cert)
{
	SSL_CERT *ret;







>
>
>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	ret = calloc(1, sizeof(SSL_CERT));
	if (ret == NULL) {
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		return (NULL);
	}
	ret->key = &(ret->pkeys[SSL_PKEY_RSA]);
	ret->references = 1;
	ret->security_cb = ssl_security_default_cb;
	ret->security_level = OPENSSL_TLS_SECURITY_LEVEL;
	ret->security_ex_data = NULL;
	return (ret);
}

SSL_CERT *
ssl_cert_dup(SSL_CERT *cert)
{
	SSL_CERT *ret;
242
243
244
245
246
247
248




249
250
251
252
253
254
255
		if (cert->pkeys[i].chain != NULL) {
			if ((ret->pkeys[i].chain =
			    X509_chain_up_ref(cert->pkeys[i].chain)) == NULL)
				goto err;
		}
	}





	/*
	 * ret->extra_certs *should* exist, but currently the own certificate
	 * chain is held inside SSL_CTX
	 */

	ret->references = 1;








>
>
>
>







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
		if (cert->pkeys[i].chain != NULL) {
			if ((ret->pkeys[i].chain =
			    X509_chain_up_ref(cert->pkeys[i].chain)) == NULL)
				goto err;
		}
	}

	ret->security_cb = cert->security_cb;
	ret->security_level = cert->security_level;
	ret->security_ex_data = cert->security_ex_data;

	/*
	 * ret->extra_certs *should* exist, but currently the own certificate
	 * chain is held inside SSL_CTX
	 */

	ret->references = 1;

286
287
288
289
290
291
292
293









294
295
296





297

298
299











300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325



326

327
328








329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353

354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376




377
378
379
380
381
382
383
384
385
386
387
388
		X509_free(c->pkeys[i].x509);
		EVP_PKEY_free(c->pkeys[i].privatekey);
		sk_X509_pop_free(c->pkeys[i].chain, X509_free);
	}

	free(c);
}










int
ssl_cert_set0_chain(SSL_CERT *c, STACK_OF(X509) *chain)
{





	if (c->key == NULL)

		return 0;












	sk_X509_pop_free(c->key->chain, X509_free);
	c->key->chain = chain;

	return 1;
}

int
ssl_cert_set1_chain(SSL_CERT *c, STACK_OF(X509) *chain)
{
	STACK_OF(X509) *new_chain = NULL;

	if (chain != NULL) {
		if ((new_chain = X509_chain_up_ref(chain)) == NULL)
			return 0;
	}
	if (!ssl_cert_set0_chain(c, new_chain)) {
		sk_X509_pop_free(new_chain, X509_free);
		return 0;
	}

	return 1;
}

int
ssl_cert_add0_chain_cert(SSL_CERT *c, X509 *cert)
{



	if (c->key == NULL)

		return 0;









	if (c->key->chain == NULL) {
		if ((c->key->chain = sk_X509_new_null()) == NULL)
			return 0;
	}
	if (!sk_X509_push(c->key->chain, cert))
		return 0;

	return 1;
}

int
ssl_cert_add1_chain_cert(SSL_CERT *c, X509 *cert)
{
	if (!ssl_cert_add0_chain_cert(c, cert))
		return 0;

	X509_up_ref(cert);

	return 1;
}

int
ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk)
{
	X509_STORE_CTX *ctx = NULL;

	X509 *x;
	int ret = 0;

	if ((sk == NULL) || (sk_X509_num(sk) == 0))
		goto err;

	if ((ctx = X509_STORE_CTX_new()) == NULL)
		goto err;

	x = sk_X509_value(sk, 0);
	if (!X509_STORE_CTX_init(ctx, s->ctx->cert_store, x, sk)) {
		SSLerror(s, ERR_R_X509_LIB);
		goto err;
	}
	X509_STORE_CTX_set_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s);

	/*
	 * We need to inherit the verify parameters. These can be
	 * determined by the context: if its a server it will verify
	 * SSL client certificates or vice versa.
	 */
	X509_STORE_CTX_set_default(ctx, s->server ? "ssl_client" : "ssl_server");





	/*
	 * Anything non-default in "param" should overwrite anything
	 * in the ctx.
	 */
	X509_VERIFY_PARAM_set1(X509_STORE_CTX_get0_param(ctx), s->param);

	if (s->internal->verify_callback)
		X509_STORE_CTX_set_verify_cb(ctx, s->internal->verify_callback);

	if (s->ctx->internal->app_verify_callback != NULL)
		ret = s->ctx->internal->app_verify_callback(ctx,
		    s->ctx->internal->app_verify_arg);








>
>
>
>
>
>
>
>
>

|

>
>
>
>
>
|
>


>
>
>
>
>
>
>
>
>
>
>
|
|





|







|








|

>
>
>
|
>


>
>
>
>
>
>
>
>
|
|


|






|

|








|


>
|


|





|
|












>
>
>
>




|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
		X509_free(c->pkeys[i].x509);
		EVP_PKEY_free(c->pkeys[i].privatekey);
		sk_X509_pop_free(c->pkeys[i].chain, X509_free);
	}

	free(c);
}

SSL_CERT *
ssl_get0_cert(SSL_CTX *ctx, SSL *ssl)
{
	if (ssl != NULL)
		return ssl->cert;

	return ctx->internal->cert;
}

int
ssl_cert_set0_chain(SSL_CTX *ctx, SSL *ssl, STACK_OF(X509) *chain)
{
	SSL_CERT *ssl_cert;
	SSL_CERT_PKEY *cpk;
	X509 *x509;
	int ssl_err;
	int i;

	if ((ssl_cert = ssl_get0_cert(ctx, ssl)) == NULL)
		return 0;

	if ((cpk = ssl_cert->key) == NULL)
		return 0;

	for (i = 0; i < sk_X509_num(chain); i++) {
		x509 = sk_X509_value(chain, i);
		if (!ssl_security_cert(ctx, ssl, x509, 0, &ssl_err)) {
			SSLerrorx(ssl_err);
			return 0;
		}
	}

	sk_X509_pop_free(cpk->chain, X509_free);
	cpk->chain = chain;

	return 1;
}

int
ssl_cert_set1_chain(SSL_CTX *ctx, SSL *ssl, STACK_OF(X509) *chain)
{
	STACK_OF(X509) *new_chain = NULL;

	if (chain != NULL) {
		if ((new_chain = X509_chain_up_ref(chain)) == NULL)
			return 0;
	}
	if (!ssl_cert_set0_chain(ctx, ssl, new_chain)) {
		sk_X509_pop_free(new_chain, X509_free);
		return 0;
	}

	return 1;
}

int
ssl_cert_add0_chain_cert(SSL_CTX *ctx, SSL *ssl, X509 *cert)
{
	SSL_CERT *ssl_cert;
	SSL_CERT_PKEY *cpk;
	int ssl_err;

	if ((ssl_cert = ssl_get0_cert(ctx, ssl)) == NULL)
		return 0;

	if ((cpk = ssl_cert->key) == NULL)
		return 0;

	if (!ssl_security_cert(ctx, ssl, cert, 0, &ssl_err)) {
		SSLerrorx(ssl_err);
		return 0;
	}

	if (cpk->chain == NULL) {
		if ((cpk->chain = sk_X509_new_null()) == NULL)
			return 0;
	}
	if (!sk_X509_push(cpk->chain, cert))
		return 0;

	return 1;
}

int
ssl_cert_add1_chain_cert(SSL_CTX *ctx, SSL *ssl, X509 *cert)
{
	if (!ssl_cert_add0_chain_cert(ctx, ssl, cert))
		return 0;

	X509_up_ref(cert);

	return 1;
}

int
ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *certs)
{
	X509_STORE_CTX *ctx = NULL;
	X509_VERIFY_PARAM *param;
	X509 *cert;
	int ret = 0;

	if (sk_X509_num(certs) < 1)
		goto err;

	if ((ctx = X509_STORE_CTX_new()) == NULL)
		goto err;

	cert = sk_X509_value(certs, 0);
	if (!X509_STORE_CTX_init(ctx, s->ctx->cert_store, cert, certs)) {
		SSLerror(s, ERR_R_X509_LIB);
		goto err;
	}
	X509_STORE_CTX_set_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s);

	/*
	 * We need to inherit the verify parameters. These can be
	 * determined by the context: if its a server it will verify
	 * SSL client certificates or vice versa.
	 */
	X509_STORE_CTX_set_default(ctx, s->server ? "ssl_client" : "ssl_server");

	param = X509_STORE_CTX_get0_param(ctx);

	X509_VERIFY_PARAM_set_auth_level(param, SSL_get_security_level(s));

	/*
	 * Anything non-default in "param" should overwrite anything
	 * in the ctx.
	 */
	X509_VERIFY_PARAM_set1(param, s->param);

	if (s->internal->verify_callback)
		X509_STORE_CTX_set_verify_cb(ctx, s->internal->verify_callback);

	if (s->ctx->internal->app_verify_callback != NULL)
		ret = s->ctx->internal->app_verify_callback(ctx,
		    s->ctx->internal->app_verify_arg);
Changes to jni/libressl/ssl/ssl_ciph.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_ciph.c,v 1.127 2022/03/05 07:13:48 bket Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_ciph.c,v 1.134 2022/09/08 15:31:12 millert Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
		    !(c->algorithm_mac & disabled_mac) &&
		    !(c->algorithm_ssl & disabled_ssl)) {
			co_list[co_list_num].cipher = c;
			co_list[co_list_num].next = NULL;
			co_list[co_list_num].prev = NULL;
			co_list[co_list_num].active = 0;
			co_list_num++;
			/*
			if (!sk_push(ca_list,(char *)c)) goto err;
			*/
		}
	}

	/*
	 * Prepare linked list from list entries
	 */
	if (co_list_num > 0) {







<
<
<







692
693
694
695
696
697
698



699
700
701
702
703
704
705
		    !(c->algorithm_mac & disabled_mac) &&
		    !(c->algorithm_ssl & disabled_ssl)) {
			co_list[co_list_num].cipher = c;
			co_list[co_list_num].next = NULL;
			co_list[co_list_num].prev = NULL;
			co_list[co_list_num].active = 0;
			co_list_num++;



		}
	}

	/*
	 * Prepare linked list from list entries
	 */
	if (co_list_num > 0) {
941
942
943
944
945
946
947
948

949
950
951
952
953
954
955

	free(number_uses);
	return (1);
}

static int
ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p,
    CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, int *tls13_seen)

{
	unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl;
	unsigned long algo_strength;
	int j, multi, found, rule, retval, ok, buflen;
	unsigned long cipher_id = 0;
	const char *l, *buf;
	char ch;







|
>







938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953

	free(number_uses);
	return (1);
}

static int
ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p,
    CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, SSL_CERT *cert,
    int *tls13_seen)
{
	unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl;
	unsigned long algo_strength;
	int j, multi, found, rule, retval, ok, buflen;
	unsigned long cipher_id = 0;
	const char *l, *buf;
	char ch;
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
			ch = *l;
			buf = l;
			buflen = 0;
			while (((ch >= 'A') && (ch <= 'Z')) ||
			    ((ch >= '0') && (ch <= '9')) ||
			    ((ch >= 'a') && (ch <= 'z')) ||
			    (ch == '-') || (ch == '.') ||
			    (ch == '_')) {
				ch = *(++l);
				buflen++;
			}

			if (buflen == 0) {
				/*
				 * We hit something we cannot deal with,
				 * it is no command or separator nor
				 * alphanumeric, so we call this an error.
				 */
				SSLerrorx(SSL_R_INVALID_COMMAND);
				retval = found = 0;
				l++;
				break;
			}

			if (rule == CIPHER_SPECIAL) {
				 /* unused -- avoid compiler warning */
				found = 0;
				/* special treatment */
				break;







|











<
<
|







994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012


1013
1014
1015
1016
1017
1018
1019
1020
			ch = *l;
			buf = l;
			buflen = 0;
			while (((ch >= 'A') && (ch <= 'Z')) ||
			    ((ch >= '0') && (ch <= '9')) ||
			    ((ch >= 'a') && (ch <= 'z')) ||
			    (ch == '-') || (ch == '.') ||
			    (ch == '_') || (ch == '=')) {
				ch = *(++l);
				buflen++;
			}

			if (buflen == 0) {
				/*
				 * We hit something we cannot deal with,
				 * it is no command or separator nor
				 * alphanumeric, so we call this an error.
				 */
				SSLerrorx(SSL_R_INVALID_COMMAND);


				return 0;
			}

			if (rule == CIPHER_SPECIAL) {
				 /* unused -- avoid compiler warning */
				found = 0;
				/* special treatment */
				break;
1152
1153
1154
1155
1156
1157
1158
1159
1160







1161
1162




1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177

		/*
		 * Ok, we have the rule, now apply it
		 */
		if (rule == CIPHER_SPECIAL) {
			/* special command */
			ok = 0;
			if ((buflen == 8) && !strncmp(buf, "STRENGTH", 8))
				ok = ssl_cipher_strength_sort(head_p, tail_p);







			else
				SSLerrorx(SSL_R_INVALID_COMMAND);




			if (ok == 0)
				retval = 0;
			/*
			 * We do not support any "multi" options
			 * together with "@", so throw away the
			 * rest of the command, if any left, until
			 * end or ':' is found.
			 */
			while ((*l != '\0') && !ITEM_SEP(*l))
				l++;
		} else if (found) {
			if (alg_ssl == SSL_TLSV1_3)
				*tls13_seen = 1;
			ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth,
			    alg_enc, alg_mac, alg_ssl, algo_strength, rule,







|

>
>
>
>
>
>
>
|
|
>
>
>
>


|
<
<
<
<
<







1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172





1173
1174
1175
1176
1177
1178
1179

		/*
		 * Ok, we have the rule, now apply it
		 */
		if (rule == CIPHER_SPECIAL) {
			/* special command */
			ok = 0;
			if (buflen == 8 && strncmp(buf, "STRENGTH", 8) == 0) {
				ok = ssl_cipher_strength_sort(head_p, tail_p);
			} else if (buflen == 10 &&
			    strncmp(buf, "SECLEVEL=", 9) == 0) {
				int level = buf[9] - '0';

				if (level >= 0 && level <= 5) {
					cert->security_level = level;
					ok = 1;
				} else {
					SSLerrorx(SSL_R_INVALID_COMMAND);
				}
			} else {
				SSLerrorx(SSL_R_INVALID_COMMAND);
			}
			if (ok == 0)
				retval = 0;






			while ((*l != '\0') && !ITEM_SEP(*l))
				l++;
		} else if (found) {
			if (alg_ssl == SSL_TLSV1_3)
				*tls13_seen = 1;
			ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth,
			    alg_enc, alg_mac, alg_ssl, algo_strength, rule,
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
#endif
}

STACK_OF(SSL_CIPHER) *
ssl_create_cipher_list(const SSL_METHOD *ssl_method,
    STACK_OF(SSL_CIPHER) **cipher_list,
    STACK_OF(SSL_CIPHER) *cipher_list_tls13,
    const char *rule_str)
{
	int ok, num_of_ciphers, num_of_alias_max, num_of_group_aliases;
	unsigned long disabled_mkey, disabled_auth, disabled_enc, disabled_mac, disabled_ssl;
	STACK_OF(SSL_CIPHER) *cipherstack;
	const char *rule_p;
	CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr;
	const SSL_CIPHER **ca_list = NULL;
	const SSL_CIPHER *cipher;
	int tls13_seen = 0;
	int any_active;
	int i;

	/*
	 * Return with error if nothing to do.
	 */
	if (rule_str == NULL || cipher_list == NULL)
		return NULL;

	/*
	 * To reduce the work to do we only want to process the compiled
	 * in algorithms, so we first get the mask of disabled ciphers.
	 */
	ssl_cipher_get_disabled(&disabled_mkey, &disabled_auth, &disabled_enc, &disabled_mac, &disabled_ssl);

	/*
	 * Now we have to collect the available ciphers from the compiled
	 * in ciphers. We cannot get more than the number compiled in, so
	 * it is used for allocation.
	 */
	num_of_ciphers = ssl3_num_ciphers();
	co_list = reallocarray(NULL, num_of_ciphers, sizeof(CIPHER_ORDER));
	if (co_list == NULL) {
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		return(NULL);	/* Failure */
	}

	ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers,
	    disabled_mkey, disabled_auth, disabled_enc, disabled_mac, disabled_ssl,
	    co_list, &head, &tail);









|



|












|
















|







1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
#endif
}

STACK_OF(SSL_CIPHER) *
ssl_create_cipher_list(const SSL_METHOD *ssl_method,
    STACK_OF(SSL_CIPHER) **cipher_list,
    STACK_OF(SSL_CIPHER) *cipher_list_tls13,
    const char *rule_str, SSL_CERT *cert)
{
	int ok, num_of_ciphers, num_of_alias_max, num_of_group_aliases;
	unsigned long disabled_mkey, disabled_auth, disabled_enc, disabled_mac, disabled_ssl;
	STACK_OF(SSL_CIPHER) *cipherstack = NULL, *ret = NULL;
	const char *rule_p;
	CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr;
	const SSL_CIPHER **ca_list = NULL;
	const SSL_CIPHER *cipher;
	int tls13_seen = 0;
	int any_active;
	int i;

	/*
	 * Return with error if nothing to do.
	 */
	if (rule_str == NULL || cipher_list == NULL)
		goto err;

	/*
	 * To reduce the work to do we only want to process the compiled
	 * in algorithms, so we first get the mask of disabled ciphers.
	 */
	ssl_cipher_get_disabled(&disabled_mkey, &disabled_auth, &disabled_enc, &disabled_mac, &disabled_ssl);

	/*
	 * Now we have to collect the available ciphers from the compiled
	 * in ciphers. We cannot get more than the number compiled in, so
	 * it is used for allocation.
	 */
	num_of_ciphers = ssl3_num_ciphers();
	co_list = reallocarray(NULL, num_of_ciphers, sizeof(CIPHER_ORDER));
	if (co_list == NULL) {
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers,
	    disabled_mkey, disabled_auth, disabled_enc, disabled_mac, disabled_ssl,
	    co_list, &head, &tail);


1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317

1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361



1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381




1382
1383
1384
1385
1386



1387

1388

1389

1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
	ssl_cipher_apply_rule(0, SSL_kRSA, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);

	/* RC4 is sort of broken - move it to the end */
	ssl_cipher_apply_rule(0, 0, 0, SSL_RC4, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);

	/* Now sort by symmetric encryption strength.  The above ordering remains
	 * in force within each class */
	if (!ssl_cipher_strength_sort(&head, &tail)) {
		free(co_list);
		return NULL;
	}

	/* Now disable everything (maintaining the ordering!) */
	ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail);

	/* TLSv1.3 first. */
	ssl_cipher_apply_rule(0, 0, 0, 0, 0, SSL_TLSV1_3, 0, CIPHER_ADD, -1, &head, &tail);
	ssl_cipher_apply_rule(0, 0, 0, 0, 0, SSL_TLSV1_3, 0, CIPHER_DEL, -1, &head, &tail);

	/*
	 * We also need cipher aliases for selecting based on the rule_str.
	 * There might be two types of entries in the rule_str: 1) names
	 * of ciphers themselves 2) aliases for groups of ciphers.
	 * For 1) we need the available ciphers and for 2) the cipher
	 * groups of cipher_aliases added together in one list (otherwise
	 * we would be happy with just the cipher_aliases table).
	 */
	num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
	num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
	ca_list = reallocarray(NULL, num_of_alias_max, sizeof(SSL_CIPHER *));
	if (ca_list == NULL) {
		free(co_list);
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		return(NULL);	/* Failure */

	}
	ssl_cipher_collect_aliases(ca_list, num_of_group_aliases, disabled_mkey,
	    disabled_auth, disabled_enc, disabled_mac, disabled_ssl, head);

	/*
	 * If the rule_string begins with DEFAULT, apply the default rule
	 * before using the (possibly available) additional rules.
	 */
	ok = 1;
	rule_p = rule_str;
	if (strncmp(rule_str, "DEFAULT", 7) == 0) {
		ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
		    &head, &tail, ca_list, &tls13_seen);
		rule_p += 7;
		if (*rule_p == ':')
			rule_p++;
	}

	if (ok && (strlen(rule_p) > 0))
		ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list,
		    &tls13_seen);

	free((void *)ca_list);	/* Not needed anymore */

	if (!ok) {
		/* Rule processing failure */
		free(co_list);
		return (NULL);
	}

	/*
	 * Allocate new "cipherstack" for the result, return with error
	 * if we cannot get one.
	 */
	if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) {
		free(co_list);
		return (NULL);
	}

	/* Prefer TLSv1.3 cipher suites. */
	if (cipher_list_tls13 != NULL) {
		for (i = 0; i < sk_SSL_CIPHER_num(cipher_list_tls13); i++) {
			cipher = sk_SSL_CIPHER_value(cipher_list_tls13, i);
			sk_SSL_CIPHER_push(cipherstack, cipher);



		}
		tls13_seen = 1;
	}

	/*
	 * The cipher selection for the list is done. The ciphers are added
	 * to the resulting precedence to the STACK_OF(SSL_CIPHER).
	 *
	 * If the rule string did not contain any references to TLSv1.3 and
	 * TLSv1.3 cipher suites have not been configured separately,
	 * include inactive TLSv1.3 cipher suites. This avoids attempts to
	 * use TLSv1.3 with an older rule string that does not include
	 * TLSv1.3 cipher suites. If the rule string resulted in no active
	 * cipher suites then we return an empty stack.
	 */
	any_active = 0;
	for (curr = head; curr != NULL; curr = curr->next) {
		if (curr->active ||
		    (!tls13_seen && curr->cipher->algorithm_ssl == SSL_TLSV1_3))
			sk_SSL_CIPHER_push(cipherstack, curr->cipher);




		any_active |= curr->active;
	}
	if (!any_active)
		sk_SSL_CIPHER_zero(cipherstack);




	free(co_list);	/* Not needed any longer */



	sk_SSL_CIPHER_free(*cipher_list);

	*cipher_list = cipherstack;

	return (cipherstack);
}

const SSL_CIPHER *
SSL_CIPHER_get_by_id(unsigned int id)
{
	return ssl3_get_cipher_by_id(id);
}







|
<
|
<




















<

<
>












|







|
<
<



|
<







|
|






|
>
>
>


















|
|
>
>
>
>





>
>
>
|
>

>
|
>
|

|







1286
1287
1288
1289
1290
1291
1292
1293

1294

1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314

1315

1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337


1338
1339
1340
1341

1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
	ssl_cipher_apply_rule(0, SSL_kRSA, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);

	/* RC4 is sort of broken - move it to the end */
	ssl_cipher_apply_rule(0, 0, 0, SSL_RC4, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);

	/* Now sort by symmetric encryption strength.  The above ordering remains
	 * in force within each class */
	if (!ssl_cipher_strength_sort(&head, &tail))

		goto err;


	/* Now disable everything (maintaining the ordering!) */
	ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail);

	/* TLSv1.3 first. */
	ssl_cipher_apply_rule(0, 0, 0, 0, 0, SSL_TLSV1_3, 0, CIPHER_ADD, -1, &head, &tail);
	ssl_cipher_apply_rule(0, 0, 0, 0, 0, SSL_TLSV1_3, 0, CIPHER_DEL, -1, &head, &tail);

	/*
	 * We also need cipher aliases for selecting based on the rule_str.
	 * There might be two types of entries in the rule_str: 1) names
	 * of ciphers themselves 2) aliases for groups of ciphers.
	 * For 1) we need the available ciphers and for 2) the cipher
	 * groups of cipher_aliases added together in one list (otherwise
	 * we would be happy with just the cipher_aliases table).
	 */
	num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
	num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
	ca_list = reallocarray(NULL, num_of_alias_max, sizeof(SSL_CIPHER *));
	if (ca_list == NULL) {

		SSLerrorx(ERR_R_MALLOC_FAILURE);

		goto err;
	}
	ssl_cipher_collect_aliases(ca_list, num_of_group_aliases, disabled_mkey,
	    disabled_auth, disabled_enc, disabled_mac, disabled_ssl, head);

	/*
	 * If the rule_string begins with DEFAULT, apply the default rule
	 * before using the (possibly available) additional rules.
	 */
	ok = 1;
	rule_p = rule_str;
	if (strncmp(rule_str, "DEFAULT", 7) == 0) {
		ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
		    &head, &tail, ca_list, cert, &tls13_seen);
		rule_p += 7;
		if (*rule_p == ':')
			rule_p++;
	}

	if (ok && (strlen(rule_p) > 0))
		ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list,
		    cert, &tls13_seen);



	if (!ok) {
		/* Rule processing failure */
		goto err;

	}

	/*
	 * Allocate new "cipherstack" for the result, return with error
	 * if we cannot get one.
	 */
	if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) {
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		goto err;
	}

	/* Prefer TLSv1.3 cipher suites. */
	if (cipher_list_tls13 != NULL) {
		for (i = 0; i < sk_SSL_CIPHER_num(cipher_list_tls13); i++) {
			cipher = sk_SSL_CIPHER_value(cipher_list_tls13, i);
			if (!sk_SSL_CIPHER_push(cipherstack, cipher)) {
				SSLerrorx(ERR_R_MALLOC_FAILURE);
				goto err;
			}
		}
		tls13_seen = 1;
	}

	/*
	 * The cipher selection for the list is done. The ciphers are added
	 * to the resulting precedence to the STACK_OF(SSL_CIPHER).
	 *
	 * If the rule string did not contain any references to TLSv1.3 and
	 * TLSv1.3 cipher suites have not been configured separately,
	 * include inactive TLSv1.3 cipher suites. This avoids attempts to
	 * use TLSv1.3 with an older rule string that does not include
	 * TLSv1.3 cipher suites. If the rule string resulted in no active
	 * cipher suites then we return an empty stack.
	 */
	any_active = 0;
	for (curr = head; curr != NULL; curr = curr->next) {
		if (curr->active ||
		    (!tls13_seen && curr->cipher->algorithm_ssl == SSL_TLSV1_3)) {
			if (!sk_SSL_CIPHER_push(cipherstack, curr->cipher)) {
				SSLerrorx(ERR_R_MALLOC_FAILURE);
				goto err;
			}
		}
		any_active |= curr->active;
	}
	if (!any_active)
		sk_SSL_CIPHER_zero(cipherstack);

	sk_SSL_CIPHER_free(*cipher_list);
	*cipher_list = cipherstack;
	cipherstack = NULL;

	ret = *cipher_list;

 err:
	sk_SSL_CIPHER_free(cipherstack);
	free((void *)ca_list);
	free(co_list);

	return ret;
}

const SSL_CIPHER *
SSL_CIPHER_get_by_id(unsigned int id)
{
	return ssl3_get_cipher_by_id(id);
}
Changes to jni/libressl/ssl/ssl_ciphers.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: ssl_ciphers.c,v 1.13 2022/02/05 18:18:18 tb Exp $ */
/*
 * Copyright (c) 2015-2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2015-2018, 2020 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2019 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: ssl_ciphers.c,v 1.15 2022/07/02 16:31:04 tb Exp $ */
/*
 * Copyright (c) 2015-2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2015-2018, 2020 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2019 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
65
66
67
68
69
70
71


72
73
74
75
76
77
78
		return 0;

	for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
		if ((cipher = sk_SSL_CIPHER_value(ciphers, i)) == NULL)
			return 0;
		if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers,
		    max_vers))


			continue;
		if (!CBB_add_u16(cbb, ssl3_cipher_get_value(cipher)))
			return 0;

		num_ciphers++;
	}








>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		return 0;

	for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
		if ((cipher = sk_SSL_CIPHER_value(ciphers, i)) == NULL)
			return 0;
		if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers,
		    max_vers))
			continue;
		if (!ssl_security_cipher_check(s, cipher))
			continue;
		if (!CBB_add_u16(cbb, ssl3_cipher_get_value(cipher)))
			return 0;

		num_ciphers++;
	}

Changes to jni/libressl/ssl/ssl_clnt.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_clnt.c,v 1.141 2022/02/05 14:54:10 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_clnt.c,v 1.153 2022/08/17 07:39:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
216
217
218
219
220
221
222







223
224
225
226
227
228
229
			if (!ssl_supported_tls_version_range(s,
			    &s->s3->hs.our_min_tls_version,
			    &s->s3->hs.our_max_tls_version)) {
				SSLerror(s, SSL_R_NO_PROTOCOLS_AVAILABLE);
				ret = -1;
				goto end;
			}








			if (!ssl3_setup_init_buffer(s)) {
				ret = -1;
				goto end;
			}
			if (!ssl3_setup_buffers(s)) {
				ret = -1;







>
>
>
>
>
>
>







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
			if (!ssl_supported_tls_version_range(s,
			    &s->s3->hs.our_min_tls_version,
			    &s->s3->hs.our_max_tls_version)) {
				SSLerror(s, SSL_R_NO_PROTOCOLS_AVAILABLE);
				ret = -1;
				goto end;
			}

			if (!ssl_security_version(s,
			    s->s3->hs.our_min_tls_version)) {
				SSLerror(s, SSL_R_VERSION_TOO_LOW);
				ret = -1;
				goto end;
			}

			if (!ssl3_setup_init_buffer(s)) {
				ret = -1;
				goto end;
			}
			if (!ssl3_setup_buffers(s)) {
				ret = -1;
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664

		if (!ssl_max_supported_version(s, &max_version)) {
			SSLerror(s, SSL_R_NO_PROTOCOLS_AVAILABLE);
			return (-1);
		}
		s->version = max_version;

		if (sess == NULL ||
		    sess->ssl_version != s->version ||
		    (!sess->session_id_length && !sess->tlsext_tick) ||
		    sess->not_resumable) {
			if (!ssl_get_new_session(s, 0))
				goto err;
		}
		/* else use the pre-loaded session */

		/*







|
<
|







655
656
657
658
659
660
661
662

663
664
665
666
667
668
669
670

		if (!ssl_max_supported_version(s, &max_version)) {
			SSLerror(s, SSL_R_NO_PROTOCOLS_AVAILABLE);
			return (-1);
		}
		s->version = max_version;

		if (sess == NULL || sess->ssl_version != s->version ||

		    (sess->session_id_length == 0 && sess->tlsext_tick == NULL) ||
		    sess->not_resumable) {
			if (!ssl_get_new_session(s, 0))
				goto err;
		}
		/* else use the pre-loaded session */

		/*
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
{
	CBS cbs, server_random, session_id;
	uint16_t server_version, cipher_suite;
	uint8_t compression_method;
	const SSL_CIPHER *cipher;
	const SSL_METHOD *method;
	unsigned long alg_k;
	size_t outlen;
	int al, ret;

	s->internal->first_packet = 1;
	if ((ret = ssl3_get_message(s, SSL3_ST_CR_SRVR_HELLO_A,
	    SSL3_ST_CR_SRVR_HELLO_B, -1, 20000 /* ?? */)) <= 0)
		return ret;
	s->internal->first_packet = 0;







<







818
819
820
821
822
823
824

825
826
827
828
829
830
831
{
	CBS cbs, server_random, session_id;
	uint16_t server_version, cipher_suite;
	uint8_t compression_method;
	const SSL_CIPHER *cipher;
	const SSL_METHOD *method;
	unsigned long alg_k;

	int al, ret;

	s->internal->first_packet = 1;
	if ((ret = ssl3_get_message(s, SSL3_ST_CR_SRVR_HELLO_A,
	    SSL3_ST_CR_SRVR_HELLO_B, -1, 20000 /* ?? */)) <= 0)
		return ret;
	s->internal->first_packet = 0;
919
920
921
922
923
924
925
926
927
928

929
930
931










932
933
934
935
936
937
938
939
940
941
942
	if (!CBS_get_u16(&cbs, &cipher_suite))
		goto decode_err;

	/*
	 * Check if we want to resume the session based on external
	 * pre-shared secret.
	 */
	if (s->internal->tls_session_secret_cb) {
		SSL_CIPHER *pref_cipher = NULL;
		s->session->master_key_length = sizeof(s->session->master_key);

		if (s->internal->tls_session_secret_cb(s, s->session->master_key,
		    &s->session->master_key_length, NULL, &pref_cipher,
		    s->internal->tls_session_secret_cb_arg)) {










			s->session->cipher = pref_cipher ? pref_cipher :
			    ssl3_get_cipher_by_value(cipher_suite);
			s->s3->flags |= SSL3_FLAGS_CCS_OK;
		}
	}

	if (s->session->session_id_length != 0 &&
	    CBS_mem_equal(&session_id, s->session->session_id,
		s->session->session_id_length)) {
		if (s->sid_ctx_length != s->session->sid_ctx_length ||
		    timingsafe_memcmp(s->session->sid_ctx,







|

|
>
|
|
|
>
>
>
>
>
>
>
>
>
>
|

|
<







924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950

951
952
953
954
955
956
957
	if (!CBS_get_u16(&cbs, &cipher_suite))
		goto decode_err;

	/*
	 * Check if we want to resume the session based on external
	 * pre-shared secret.
	 */
	if (s->internal->tls_session_secret_cb != NULL) {
		SSL_CIPHER *pref_cipher = NULL;
		int master_key_length = sizeof(s->session->master_key);

		if (!s->internal->tls_session_secret_cb(s,
		    s->session->master_key, &master_key_length, NULL,
		    &pref_cipher, s->internal->tls_session_secret_cb_arg)) {
			SSLerror(s, ERR_R_INTERNAL_ERROR);
			goto err;
		}
		if (master_key_length <= 0) {
			SSLerror(s, ERR_R_INTERNAL_ERROR);
			goto err;
		}
		s->session->master_key_length = master_key_length;

		if ((s->session->cipher = pref_cipher) == NULL)
			s->session->cipher =
			    ssl3_get_cipher_by_value(cipher_suite);
		s->s3->flags |= SSL3_FLAGS_CCS_OK;

	}

	if (s->session->session_id_length != 0 &&
	    CBS_mem_equal(&session_id, s->session->session_id,
		s->session->session_id_length)) {
		if (s->sid_ctx_length != s->session->sid_ctx_length ||
		    timingsafe_memcmp(s->session->sid_ctx,
962
963
964
965
966
967
968
969

970
971
972
973
974
975
976
977
978
		}

		/*
		 * XXX - improve the handling for the case where there is a
		 * zero length session identifier.
		 */
		if (!CBS_write_bytes(&session_id, s->session->session_id,
		    sizeof(s->session->session_id), &outlen))

			goto err;
		s->session->session_id_length = outlen;

		s->session->ssl_version = s->version;
	}

	if ((cipher = ssl3_get_cipher_by_value(cipher_suite)) == NULL) {
		al = SSL_AD_ILLEGAL_PARAMETER;
		SSLerror(s, SSL_R_UNKNOWN_CIPHER_RETURNED);







|
>

<







977
978
979
980
981
982
983
984
985
986

987
988
989
990
991
992
993
		}

		/*
		 * XXX - improve the handling for the case where there is a
		 * zero length session identifier.
		 */
		if (!CBS_write_bytes(&session_id, s->session->session_id,
		    sizeof(s->session->session_id),
		    &s->session->session_id_length))
			goto err;


		s->session->ssl_version = s->version;
	}

	if ((cipher = ssl3_get_cipher_by_value(cipher_suite)) == NULL) {
		al = SSL_AD_ILLEGAL_PARAMETER;
		SSLerror(s, SSL_R_UNKNOWN_CIPHER_RETURNED);
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111

1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147






1148
1149
1150
1151
1152
1153

1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198

1199
1200
1201
1202
1203
1204
1205
1206
1207
 err:
	return (-1);
}

int
ssl3_get_server_certificate(SSL *s)
{
	CBS cbs, cert_list;
	X509 *x = NULL;
	const unsigned char *q;
	STACK_OF(X509) *sk = NULL;
	EVP_PKEY *pkey;
	int cert_type;
	int al, ret;

	if ((ret = ssl3_get_message(s, SSL3_ST_CR_CERT_A,
	    SSL3_ST_CR_CERT_B, -1, s->internal->max_cert_list)) <= 0)
		return ret;

	ret = -1;

	if (s->s3->hs.tls12.message_type == SSL3_MT_SERVER_KEY_EXCHANGE) {
		s->s3->hs.tls12.reuse_message = 1;
		return (1);
	}

	if (s->s3->hs.tls12.message_type != SSL3_MT_CERTIFICATE) {
		al = SSL_AD_UNEXPECTED_MESSAGE;
		SSLerror(s, SSL_R_BAD_MESSAGE_TYPE);
		goto fatal_err;
	}

	if ((sk = sk_X509_new_null()) == NULL) {
		SSLerror(s, ERR_R_MALLOC_FAILURE);
		goto err;
	}

	if (s->internal->init_num < 0)
		goto decode_err;

	CBS_init(&cbs, s->internal->init_msg, s->internal->init_num);
	if (CBS_len(&cbs) < 3)
		goto decode_err;

	if (!CBS_get_u24_length_prefixed(&cbs, &cert_list) ||

	    CBS_len(&cbs) != 0) {
		al = SSL_AD_DECODE_ERROR;
		SSLerror(s, SSL_R_LENGTH_MISMATCH);
		goto fatal_err;
	}

	while (CBS_len(&cert_list) > 0) {
		CBS cert;

		if (CBS_len(&cert_list) < 3)
			goto decode_err;
		if (!CBS_get_u24_length_prefixed(&cert_list, &cert)) {
			al = SSL_AD_DECODE_ERROR;
			SSLerror(s, SSL_R_CERT_LENGTH_MISMATCH);
			goto fatal_err;
		}

		q = CBS_data(&cert);
		x = d2i_X509(NULL, &q, CBS_len(&cert));
		if (x == NULL) {
			al = SSL_AD_BAD_CERTIFICATE;
			SSLerror(s, ERR_R_ASN1_LIB);
			goto fatal_err;
		}
		if (q != CBS_data(&cert) + CBS_len(&cert)) {
			al = SSL_AD_DECODE_ERROR;
			SSLerror(s, SSL_R_CERT_LENGTH_MISMATCH);
			goto fatal_err;
		}
		if (!sk_X509_push(sk, x)) {
			SSLerror(s, ERR_R_MALLOC_FAILURE);
			goto err;
		}
		x = NULL;
	}







	if (ssl_verify_cert_chain(s, sk) <= 0 &&
	    s->verify_mode != SSL_VERIFY_NONE) {
		al = ssl_verify_alarm_type(s->verify_result);
		SSLerror(s, SSL_R_CERTIFICATE_VERIFY_FAILED);
		goto fatal_err;
	}

	ERR_clear_error(); /* but we keep s->verify_result */

	/*
	 * Inconsistency alert: cert_chain does include the peer's
	 * certificate, which we don't include in s3_srvr.c
	 */
	x = sk_X509_value(sk, 0);

	if ((pkey = X509_get0_pubkey(x)) == NULL ||
	    EVP_PKEY_missing_parameters(pkey)) {
		x = NULL;
		al = SSL3_AL_FATAL;
		SSLerror(s, SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS);
		goto fatal_err;
	}
	if ((cert_type = ssl_cert_type(pkey)) < 0) {
		x = NULL;
		al = SSL3_AL_FATAL;
		SSLerror(s, SSL_R_UNKNOWN_CERTIFICATE_TYPE);
		goto fatal_err;
	}

	X509_up_ref(x);
	X509_free(s->session->peer_cert);
	s->session->peer_cert = x;
	s->session->peer_cert_type = cert_type;

	s->session->verify_result = s->verify_result;

	sk_X509_pop_free(s->session->cert_chain, X509_free);
	s->session->cert_chain = sk;
	sk = NULL;

	x = NULL;
	ret = 1;

	if (0) {
 decode_err:
		/* wrong packet length */
		al = SSL_AD_DECODE_ERROR;
		SSLerror(s, SSL_R_BAD_PACKET_LENGTH);
 fatal_err:
		ssl3_send_alert(s, SSL3_AL_FATAL, al);
	}
 err:

	X509_free(x);
	sk_X509_pop_free(sk, X509_free);

	return (ret);
}

static int
ssl3_get_server_kex_dhe(SSL *s, CBS *cbs)
{







|
<
<
|
|
|



















|








<
<

|
>
|
<
<
|
|
<

<
|
<

<
<
<
<
<
<
|
|
<




|
<
<
|
<
|



|


>
>
>
>
>
>
|





>
|

<
<
<
<
<
|
<
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<











>
|
<







1082
1083
1084
1085
1086
1087
1088
1089


1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120


1121
1122
1123
1124


1125
1126

1127

1128

1129






1130
1131

1132
1133
1134
1135
1136


1137

1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159





1160





1161
1162



















1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175

1176
1177
1178
1179
1180
1181
1182
 err:
	return (-1);
}

int
ssl3_get_server_certificate(SSL *s)
{
	CBS cbs, cert_list, cert_data;


	STACK_OF(X509) *certs = NULL;
	X509 *cert = NULL;
	const uint8_t *p;
	int al, ret;

	if ((ret = ssl3_get_message(s, SSL3_ST_CR_CERT_A,
	    SSL3_ST_CR_CERT_B, -1, s->internal->max_cert_list)) <= 0)
		return ret;

	ret = -1;

	if (s->s3->hs.tls12.message_type == SSL3_MT_SERVER_KEY_EXCHANGE) {
		s->s3->hs.tls12.reuse_message = 1;
		return (1);
	}

	if (s->s3->hs.tls12.message_type != SSL3_MT_CERTIFICATE) {
		al = SSL_AD_UNEXPECTED_MESSAGE;
		SSLerror(s, SSL_R_BAD_MESSAGE_TYPE);
		goto fatal_err;
	}

	if ((certs = sk_X509_new_null()) == NULL) {
		SSLerror(s, ERR_R_MALLOC_FAILURE);
		goto err;
	}

	if (s->internal->init_num < 0)
		goto decode_err;

	CBS_init(&cbs, s->internal->init_msg, s->internal->init_num);



	if (!CBS_get_u24_length_prefixed(&cbs, &cert_list))
		goto decode_err;
	if (CBS_len(&cbs) != 0)


		goto decode_err;


	while (CBS_len(&cert_list) > 0) {

		if (!CBS_get_u24_length_prefixed(&cert_list, &cert_data))

			goto decode_err;






		p = CBS_data(&cert_data);
		if ((cert = d2i_X509(NULL, &p, CBS_len(&cert_data))) == NULL) {

			al = SSL_AD_BAD_CERTIFICATE;
			SSLerror(s, ERR_R_ASN1_LIB);
			goto fatal_err;
		}
		if (p != CBS_data(&cert_data) + CBS_len(&cert_data))


			goto decode_err;

		if (!sk_X509_push(certs, cert)) {
			SSLerror(s, ERR_R_MALLOC_FAILURE);
			goto err;
		}
		cert = NULL;
	}

	/* A server must always provide a non-empty certificate list. */
	if (sk_X509_num(certs) < 1) {
		SSLerror(s, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);
		goto decode_err;
	}

	if (ssl_verify_cert_chain(s, certs) <= 0 &&
	    s->verify_mode != SSL_VERIFY_NONE) {
		al = ssl_verify_alarm_type(s->verify_result);
		SSLerror(s, SSL_R_CERTIFICATE_VERIFY_FAILED);
		goto fatal_err;
	}
	s->session->verify_result = s->verify_result;
	ERR_clear_error();






	if (!tls_process_peer_certs(s, certs))





		goto err;




















	ret = 1;

	if (0) {
 decode_err:
		/* wrong packet length */
		al = SSL_AD_DECODE_ERROR;
		SSLerror(s, SSL_R_BAD_PACKET_LENGTH);
 fatal_err:
		ssl3_send_alert(s, SSL3_AL_FATAL, al);
	}
 err:
	sk_X509_pop_free(certs, X509_free);
	X509_free(cert);


	return (ret);
}

static int
ssl3_get_server_kex_dhe(SSL *s, CBS *cbs)
{
1235
1236
1237
1238
1239
1240
1241






1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
		goto err;
	}
	if (invalid_key) {
		SSLerror(s, SSL_R_BAD_DH_PUB_KEY_LENGTH);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
		goto err;
	}







	return 1;

 err:
	return 0;
}

static int
ssl3_get_server_kex_ecdhe(SSL *s, CBS *cbs)
{
	uint8_t curve_type;
	uint16_t curve_id;
	int decode_error;
	CBS public;

	if (!CBS_get_u8(cbs, &curve_type))
		goto decode_err;
	if (!CBS_get_u16(cbs, &curve_id))
		goto decode_err;

	/* Only named curves are supported. */
	if (curve_type != NAMED_CURVE_TYPE) {
		SSLerror(s, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
		goto err;
	}

	if (!CBS_get_u8_length_prefixed(cbs, &public))
		goto decode_err;

	/*
	 * Check that the curve is one of our preferences - if it is not,
	 * the server has sent us an invalid curve.
	 */
	if (!tls1_check_curve(s, curve_id)) {
		SSLerror(s, SSL_R_WRONG_CURVE);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
		goto err;
	}

	tls_key_share_free(s->s3->hs.key_share);
	if ((s->s3->hs.key_share = tls_key_share_new(curve_id)) == NULL)
		goto err;

	if (!tls_key_share_peer_public(s->s3->hs.key_share, &public,
	    &decode_error, NULL)) {
		if (decode_error)
			goto decode_err;
		goto err;







>
>
>
>
>
>











|





|













|
|

|






|







1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
		goto err;
	}
	if (invalid_key) {
		SSLerror(s, SSL_R_BAD_DH_PUB_KEY_LENGTH);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
		goto err;
	}

	if (!tls_key_share_peer_security(s, s->s3->hs.key_share)) {
		SSLerror(s, SSL_R_DH_KEY_TOO_SMALL);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
		return 0;
	}

	return 1;

 err:
	return 0;
}

static int
ssl3_get_server_kex_ecdhe(SSL *s, CBS *cbs)
{
	uint8_t curve_type;
	uint16_t group_id;
	int decode_error;
	CBS public;

	if (!CBS_get_u8(cbs, &curve_type))
		goto decode_err;
	if (!CBS_get_u16(cbs, &group_id))
		goto decode_err;

	/* Only named curves are supported. */
	if (curve_type != NAMED_CURVE_TYPE) {
		SSLerror(s, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
		goto err;
	}

	if (!CBS_get_u8_length_prefixed(cbs, &public))
		goto decode_err;

	/*
	 * Check that the group is one of our preferences - if it is not,
	 * the server has sent us an invalid group.
	 */
	if (!tls1_check_group(s, group_id)) {
		SSLerror(s, SSL_R_WRONG_CURVE);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
		goto err;
	}

	tls_key_share_free(s->s3->hs.key_share);
	if ((s->s3->hs.key_share = tls_key_share_new(group_id)) == NULL)
		goto err;

	if (!tls_key_share_peer_public(s->s3->hs.key_share, &public,
	    &decode_error, NULL)) {
		if (decode_error)
			goto decode_err;
		goto err;
1592
1593
1594
1595
1596
1597
1598

1599
1600
1601
1602
1603
1604
1605
}

int
ssl3_get_new_session_ticket(SSL *s)
{
	uint32_t lifetime_hint;
	CBS cbs, session_ticket;

	int al, ret;

	if ((ret = ssl3_get_message(s, SSL3_ST_CR_SESSION_TICKET_A,
	    SSL3_ST_CR_SESSION_TICKET_B, -1, 16384)) <= 0)
		return ret;

	if (s->s3->hs.tls12.message_type == SSL3_MT_FINISHED) {







>







1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
}

int
ssl3_get_new_session_ticket(SSL *s)
{
	uint32_t lifetime_hint;
	CBS cbs, session_ticket;
	unsigned int session_id_length = 0;
	int al, ret;

	if ((ret = ssl3_get_message(s, SSL3_ST_CR_SESSION_TICKET_A,
	    SSL3_ST_CR_SESSION_TICKET_B, -1, 16384)) <= 0)
		return ret;

	if (s->s3->hs.tls12.message_type == SSL3_MT_FINISHED) {
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654

1655



1656
1657
1658
1659
1660
1661
1662
	 *
	 * The other way is to set zero length session ID when the
	 * ticket is presented and rely on the handshake to determine
	 * session resumption.
	 *
	 * We choose the former approach because this fits in with
	 * assumptions elsewhere in OpenSSL. The session ID is set
	 * to the SHA256 (or SHA1 is SHA256 is disabled) hash of the
	 * ticket.
	 */
	EVP_Digest(CBS_data(&session_ticket), CBS_len(&session_ticket),
	    s->session->session_id, &s->session->session_id_length,

	    EVP_sha256(), NULL);




	return (1);

 fatal_err:
	ssl3_send_alert(s, SSL3_AL_FATAL, al);
 err:
	return (-1);







|
<

|
|
>
|
>
>
>







1625
1626
1627
1628
1629
1630
1631
1632

1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
	 *
	 * The other way is to set zero length session ID when the
	 * ticket is presented and rely on the handshake to determine
	 * session resumption.
	 *
	 * We choose the former approach because this fits in with
	 * assumptions elsewhere in OpenSSL. The session ID is set
	 * to the SHA256 hash of the ticket.

	 */
	if (!EVP_Digest(CBS_data(&session_ticket), CBS_len(&session_ticket),
	    s->session->session_id, &session_id_length, EVP_sha256(), NULL)) {
		al = SSL_AD_INTERNAL_ERROR;
		SSLerror(s, ERR_R_EVP_LIB);
		goto fatal_err;
	}
	s->session->session_id_length = session_id_length;

	return (1);

 fatal_err:
	ssl3_send_alert(s, SSL3_AL_FATAL, al);
 err:
	return (-1);
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
	    &s->internal->tlsext_ocsp_resp_len)) {
		al = SSL_AD_INTERNAL_ERROR;
		SSLerror(s, ERR_R_MALLOC_FAILURE);
		goto fatal_err;
	}

	if (s->ctx->internal->tlsext_status_cb) {
		int ret;
		ret = s->ctx->internal->tlsext_status_cb(s,
		    s->ctx->internal->tlsext_status_arg);
		if (ret == 0) {
			al = SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE;
			SSLerror(s, SSL_R_INVALID_STATUS_RESPONSE);
			goto fatal_err;
		}







<







1725
1726
1727
1728
1729
1730
1731

1732
1733
1734
1735
1736
1737
1738
	    &s->internal->tlsext_ocsp_resp_len)) {
		al = SSL_AD_INTERNAL_ERROR;
		SSLerror(s, ERR_R_MALLOC_FAILURE);
		goto fatal_err;
	}

	if (s->ctx->internal->tlsext_status_cb) {

		ret = s->ctx->internal->tlsext_status_cb(s,
		    s->ctx->internal->tlsext_status_arg);
		if (ret == 0) {
			al = SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE;
			SSLerror(s, SSL_R_INVALID_STATUS_RESPONSE);
			goto fatal_err;
		}
1866
1867
1868
1869
1870
1871
1872






1873
1874
1875
1876
1877
1878
1879

	if (!tls_key_share_generate(s->s3->hs.key_share))
		goto err;
	if (!tls_key_share_public(s->s3->hs.key_share, cbb))
		goto err;
	if (!tls_key_share_derive(s->s3->hs.key_share, &key, &key_len))
		goto err;







	if (!tls12_derive_master_secret(s, key, key_len))
		goto err;

	ret = 1;

 err:







>
>
>
>
>
>







1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869

	if (!tls_key_share_generate(s->s3->hs.key_share))
		goto err;
	if (!tls_key_share_public(s->s3->hs.key_share, cbb))
		goto err;
	if (!tls_key_share_derive(s->s3->hs.key_share, &key, &key_len))
		goto err;

	if (!tls_key_share_peer_security(s, s->s3->hs.key_share)) {
		SSLerror(s, SSL_R_DH_KEY_TOO_SMALL);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
		return 0;
	}

	if (!tls12_derive_master_secret(s, key, key_len))
		goto err;

	ret = 1;

 err:
Changes to jni/libressl/ssl/ssl_err.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_err.c,v 1.40 2022/02/05 14:54:10 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_err.c,v 1.44 2022/08/21 19:18:57 jsing Exp $ */
/* ====================================================================
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

/* NOTE: this file was auto generated by the mkerr.pl script: any changes
 * made to it will be overwritten when the script next updates this file,
 * only reason strings will be preserved.
 */

#include <stdio.h>

#include <openssl/err.h>
#include <openssl/opensslconf.h>
#include <openssl/ssl.h>

#include "ssl_locl.h"

/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_SSL,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_SSL,0,reason)

/* See SSL_state_func_code below */
static ERR_STRING_DATA SSL_str_functs[]= {







<
<
<
<
<








<







49
50
51
52
53
54
55





56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */






#include <stdio.h>

#include <openssl/err.h>
#include <openssl/opensslconf.h>
#include <openssl/ssl.h>

#include "ssl_locl.h"


#ifndef OPENSSL_NO_ERR

#define ERR_FUNC(func) ERR_PACK(ERR_LIB_SSL,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_SSL,0,reason)

/* See SSL_state_func_code below */
static ERR_STRING_DATA SSL_str_functs[]= {
204
205
206
207
208
209
210


211
212
213
214
215
216
217
	{ERR_REASON(SSL_R_BAD_STATE)             , "bad state"},
	{ERR_REASON(SSL_R_BAD_WRITE_RETRY)       , "bad write retry"},
	{ERR_REASON(SSL_R_BIO_NOT_SET)           , "bio not set"},
	{ERR_REASON(SSL_R_BLOCK_CIPHER_PAD_IS_WRONG), "block cipher pad is wrong"},
	{ERR_REASON(SSL_R_BN_LIB)                , "bn lib"},
	{ERR_REASON(SSL_R_CA_DN_LENGTH_MISMATCH) , "ca dn length mismatch"},
	{ERR_REASON(SSL_R_CA_DN_TOO_LONG)        , "ca dn too long"},


	{ERR_REASON(SSL_R_CCS_RECEIVED_EARLY)    , "ccs received early"},
	{ERR_REASON(SSL_R_CERTIFICATE_VERIFY_FAILED), "certificate verify failed"},
	{ERR_REASON(SSL_R_CERT_LENGTH_MISMATCH)  , "cert length mismatch"},
	{ERR_REASON(SSL_R_CHALLENGE_IS_DIFFERENT), "challenge is different"},
	{ERR_REASON(SSL_R_CIPHER_CODE_WRONG_LENGTH), "cipher code wrong length"},
	{ERR_REASON(SSL_R_CIPHER_COMPRESSION_UNAVAILABLE), "cipher compression unavailable"},
	{ERR_REASON(SSL_R_CIPHER_OR_HASH_UNAVAILABLE), "cipher or hash unavailable"},







>
>







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	{ERR_REASON(SSL_R_BAD_STATE)             , "bad state"},
	{ERR_REASON(SSL_R_BAD_WRITE_RETRY)       , "bad write retry"},
	{ERR_REASON(SSL_R_BIO_NOT_SET)           , "bio not set"},
	{ERR_REASON(SSL_R_BLOCK_CIPHER_PAD_IS_WRONG), "block cipher pad is wrong"},
	{ERR_REASON(SSL_R_BN_LIB)                , "bn lib"},
	{ERR_REASON(SSL_R_CA_DN_LENGTH_MISMATCH) , "ca dn length mismatch"},
	{ERR_REASON(SSL_R_CA_DN_TOO_LONG)        , "ca dn too long"},
	{ERR_REASON(SSL_R_CA_KEY_TOO_SMALL)      , "ca key too small"},
	{ERR_REASON(SSL_R_CA_MD_TOO_WEAK)        , "ca md too weak"},
	{ERR_REASON(SSL_R_CCS_RECEIVED_EARLY)    , "ccs received early"},
	{ERR_REASON(SSL_R_CERTIFICATE_VERIFY_FAILED), "certificate verify failed"},
	{ERR_REASON(SSL_R_CERT_LENGTH_MISMATCH)  , "cert length mismatch"},
	{ERR_REASON(SSL_R_CHALLENGE_IS_DIFFERENT), "challenge is different"},
	{ERR_REASON(SSL_R_CIPHER_CODE_WRONG_LENGTH), "cipher code wrong length"},
	{ERR_REASON(SSL_R_CIPHER_COMPRESSION_UNAVAILABLE), "cipher compression unavailable"},
	{ERR_REASON(SSL_R_CIPHER_OR_HASH_UNAVAILABLE), "cipher or hash unavailable"},
225
226
227
228
229
230
231

232
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
	{ERR_REASON(SSL_R_CONNECTION_ID_IS_DIFFERENT), "connection id is different"},
	{ERR_REASON(SSL_R_CONNECTION_TYPE_NOT_SET), "connection type not set"},
	{ERR_REASON(SSL_R_COOKIE_MISMATCH)       , "cookie mismatch"},
	{ERR_REASON(SSL_R_DATA_BETWEEN_CCS_AND_FINISHED), "data between ccs and finished"},
	{ERR_REASON(SSL_R_DATA_LENGTH_TOO_LONG)  , "data length too long"},
	{ERR_REASON(SSL_R_DECRYPTION_FAILED)     , "decryption failed"},
	{ERR_REASON(SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC), "decryption failed or bad record mac"},

	{ERR_REASON(SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG), "dh public value length is wrong"},
	{ERR_REASON(SSL_R_DIGEST_CHECK_FAILED)   , "digest check failed"},
	{ERR_REASON(SSL_R_DTLS_MESSAGE_TOO_BIG)  , "dtls message too big"},
	{ERR_REASON(SSL_R_DUPLICATE_COMPRESSION_ID), "duplicate compression id"},
	{ERR_REASON(SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT), "ecc cert not for key agreement"},
	{ERR_REASON(SSL_R_ECC_CERT_NOT_FOR_SIGNING), "ecc cert not for signing"},
	{ERR_REASON(SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE), "ecc cert should have rsa signature"},
	{ERR_REASON(SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE), "ecc cert should have sha1 signature"},
	{ERR_REASON(SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER), "ecgroup too large for cipher"},

	{ERR_REASON(SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST), "empty srtp protection profile list"},
	{ERR_REASON(SSL_R_ENCRYPTED_LENGTH_TOO_LONG), "encrypted length too long"},
	{ERR_REASON(SSL_R_ERROR_GENERATING_TMP_RSA_KEY), "error generating tmp rsa key"},
	{ERR_REASON(SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST), "error in received cipher list"},
	{ERR_REASON(SSL_R_EXCESSIVE_MESSAGE_SIZE), "excessive message size"},
	{ERR_REASON(SSL_R_EXTRA_DATA_IN_MESSAGE) , "extra data in message"},
	{ERR_REASON(SSL_R_GOT_A_FIN_BEFORE_A_CCS), "got a fin before a ccs"},







>









>







221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
	{ERR_REASON(SSL_R_CONNECTION_ID_IS_DIFFERENT), "connection id is different"},
	{ERR_REASON(SSL_R_CONNECTION_TYPE_NOT_SET), "connection type not set"},
	{ERR_REASON(SSL_R_COOKIE_MISMATCH)       , "cookie mismatch"},
	{ERR_REASON(SSL_R_DATA_BETWEEN_CCS_AND_FINISHED), "data between ccs and finished"},
	{ERR_REASON(SSL_R_DATA_LENGTH_TOO_LONG)  , "data length too long"},
	{ERR_REASON(SSL_R_DECRYPTION_FAILED)     , "decryption failed"},
	{ERR_REASON(SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC), "decryption failed or bad record mac"},
	{ERR_REASON(SSL_R_DH_KEY_TOO_SMALL)      , "dh key too small"},
	{ERR_REASON(SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG), "dh public value length is wrong"},
	{ERR_REASON(SSL_R_DIGEST_CHECK_FAILED)   , "digest check failed"},
	{ERR_REASON(SSL_R_DTLS_MESSAGE_TOO_BIG)  , "dtls message too big"},
	{ERR_REASON(SSL_R_DUPLICATE_COMPRESSION_ID), "duplicate compression id"},
	{ERR_REASON(SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT), "ecc cert not for key agreement"},
	{ERR_REASON(SSL_R_ECC_CERT_NOT_FOR_SIGNING), "ecc cert not for signing"},
	{ERR_REASON(SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE), "ecc cert should have rsa signature"},
	{ERR_REASON(SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE), "ecc cert should have sha1 signature"},
	{ERR_REASON(SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER), "ecgroup too large for cipher"},
	{ERR_REASON(SSL_R_EE_KEY_TOO_SMALL)      , "ee key too small"},
	{ERR_REASON(SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST), "empty srtp protection profile list"},
	{ERR_REASON(SSL_R_ENCRYPTED_LENGTH_TOO_LONG), "encrypted length too long"},
	{ERR_REASON(SSL_R_ERROR_GENERATING_TMP_RSA_KEY), "error generating tmp rsa key"},
	{ERR_REASON(SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST), "error in received cipher list"},
	{ERR_REASON(SSL_R_EXCESSIVE_MESSAGE_SIZE), "excessive message size"},
	{ERR_REASON(SSL_R_EXTRA_DATA_IN_MESSAGE) , "extra data in message"},
	{ERR_REASON(SSL_R_GOT_A_FIN_BEFORE_A_CCS), "got a fin before a ccs"},
323
324
325
326
327
328
329

330
331
332
333
334
335
336
337
338
339
340
341
342
343
344

345
346
347
348
349
350
351
	{ERR_REASON(SSL_R_NULL_SSL_METHOD_PASSED), "null ssl method passed"},
	{ERR_REASON(SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED), "old session cipher not returned"},
	{ERR_REASON(SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED), "old session compression algorithm not returned"},
	{ERR_REASON(SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE), "only tls allowed in fips mode"},
	{ERR_REASON(SSL_R_PACKET_LENGTH_TOO_LONG), "packet length too long"},
	{ERR_REASON(SSL_R_PARSE_TLSEXT)          , "parse tlsext"},
	{ERR_REASON(SSL_R_PATH_TOO_LONG)         , "path too long"},

	{ERR_REASON(SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE), "peer did not return a certificate"},
	{ERR_REASON(SSL_R_PEER_ERROR)            , "peer error"},
	{ERR_REASON(SSL_R_PEER_ERROR_CERTIFICATE), "peer error certificate"},
	{ERR_REASON(SSL_R_PEER_ERROR_NO_CERTIFICATE), "peer error no certificate"},
	{ERR_REASON(SSL_R_PEER_ERROR_NO_CIPHER)  , "peer error no cipher"},
	{ERR_REASON(SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE), "peer error unsupported certificate type"},
	{ERR_REASON(SSL_R_PRE_MAC_LENGTH_TOO_LONG), "pre mac length too long"},
	{ERR_REASON(SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS), "problems mapping cipher functions"},
	{ERR_REASON(SSL_R_PROTOCOL_IS_SHUTDOWN)  , "protocol is shutdown"},
	{ERR_REASON(SSL_R_PSK_IDENTITY_NOT_FOUND), "psk identity not found"},
	{ERR_REASON(SSL_R_PSK_NO_CLIENT_CB)      , "psk no client cb"},
	{ERR_REASON(SSL_R_PSK_NO_SERVER_CB)      , "psk no server cb"},
	{ERR_REASON(SSL_R_PUBLIC_KEY_ENCRYPT_ERROR), "public key encrypt error"},
	{ERR_REASON(SSL_R_PUBLIC_KEY_IS_NOT_RSA) , "public key is not rsa"},
	{ERR_REASON(SSL_R_PUBLIC_KEY_NOT_RSA)    , "public key not rsa"},

	{ERR_REASON(SSL_R_READ_BIO_NOT_SET)      , "read bio not set"},
	{ERR_REASON(SSL_R_READ_TIMEOUT_EXPIRED)  , "read timeout expired"},
	{ERR_REASON(SSL_R_READ_WRONG_PACKET_TYPE), "read wrong packet type"},
	{ERR_REASON(SSL_R_RECORD_LENGTH_MISMATCH), "record length mismatch"},
	{ERR_REASON(SSL_R_RECORD_TOO_LARGE)      , "record too large"},
	{ERR_REASON(SSL_R_RECORD_TOO_SMALL)      , "record too small"},
	{ERR_REASON(SSL_R_RENEGOTIATE_EXT_TOO_LONG), "renegotiate ext too long"},







>















>







321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
	{ERR_REASON(SSL_R_NULL_SSL_METHOD_PASSED), "null ssl method passed"},
	{ERR_REASON(SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED), "old session cipher not returned"},
	{ERR_REASON(SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED), "old session compression algorithm not returned"},
	{ERR_REASON(SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE), "only tls allowed in fips mode"},
	{ERR_REASON(SSL_R_PACKET_LENGTH_TOO_LONG), "packet length too long"},
	{ERR_REASON(SSL_R_PARSE_TLSEXT)          , "parse tlsext"},
	{ERR_REASON(SSL_R_PATH_TOO_LONG)         , "path too long"},
	{ERR_REASON(SSL_R_PEER_BEHAVING_BADLY)   , "peer is doing strange or hostile things"},
	{ERR_REASON(SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE), "peer did not return a certificate"},
	{ERR_REASON(SSL_R_PEER_ERROR)            , "peer error"},
	{ERR_REASON(SSL_R_PEER_ERROR_CERTIFICATE), "peer error certificate"},
	{ERR_REASON(SSL_R_PEER_ERROR_NO_CERTIFICATE), "peer error no certificate"},
	{ERR_REASON(SSL_R_PEER_ERROR_NO_CIPHER)  , "peer error no cipher"},
	{ERR_REASON(SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE), "peer error unsupported certificate type"},
	{ERR_REASON(SSL_R_PRE_MAC_LENGTH_TOO_LONG), "pre mac length too long"},
	{ERR_REASON(SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS), "problems mapping cipher functions"},
	{ERR_REASON(SSL_R_PROTOCOL_IS_SHUTDOWN)  , "protocol is shutdown"},
	{ERR_REASON(SSL_R_PSK_IDENTITY_NOT_FOUND), "psk identity not found"},
	{ERR_REASON(SSL_R_PSK_NO_CLIENT_CB)      , "psk no client cb"},
	{ERR_REASON(SSL_R_PSK_NO_SERVER_CB)      , "psk no server cb"},
	{ERR_REASON(SSL_R_PUBLIC_KEY_ENCRYPT_ERROR), "public key encrypt error"},
	{ERR_REASON(SSL_R_PUBLIC_KEY_IS_NOT_RSA) , "public key is not rsa"},
	{ERR_REASON(SSL_R_PUBLIC_KEY_NOT_RSA)    , "public key not rsa"},
	{ERR_REASON(SSL_R_QUIC_INTERNAL_ERROR)   , "QUIC: internal error"},
	{ERR_REASON(SSL_R_READ_BIO_NOT_SET)      , "read bio not set"},
	{ERR_REASON(SSL_R_READ_TIMEOUT_EXPIRED)  , "read timeout expired"},
	{ERR_REASON(SSL_R_READ_WRONG_PACKET_TYPE), "read wrong packet type"},
	{ERR_REASON(SSL_R_RECORD_LENGTH_MISMATCH), "record length mismatch"},
	{ERR_REASON(SSL_R_RECORD_TOO_LARGE)      , "record too large"},
	{ERR_REASON(SSL_R_RECORD_TOO_SMALL)      , "record too small"},
	{ERR_REASON(SSL_R_RENEGOTIATE_EXT_TOO_LONG), "renegotiate ext too long"},
428
429
430
431
432
433
434

435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454

455
456
457

458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
	{ERR_REASON(SSL_R_UNABLE_TO_FIND_SSL_METHOD), "unable to find ssl method"},
	{ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES), "unable to load ssl2 md5 routines"},
	{ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES), "unable to load ssl3 md5 routines"},
	{ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES), "unable to load ssl3 sha1 routines"},
	{ERR_REASON(SSL_R_UNEXPECTED_MESSAGE)    , "unexpected message"},
	{ERR_REASON(SSL_R_UNEXPECTED_RECORD)     , "unexpected record"},
	{ERR_REASON(SSL_R_UNINITIALIZED)         , "uninitialized"},

	{ERR_REASON(SSL_R_UNKNOWN_ALERT_TYPE)    , "unknown alert type"},
	{ERR_REASON(SSL_R_UNKNOWN_CERTIFICATE_TYPE), "unknown certificate type"},
	{ERR_REASON(SSL_R_UNKNOWN_CIPHER_RETURNED), "unknown cipher returned"},
	{ERR_REASON(SSL_R_UNKNOWN_CIPHER_TYPE)   , "unknown cipher type"},
	{ERR_REASON(SSL_R_UNKNOWN_DIGEST)        , "unknown digest"},
	{ERR_REASON(SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE), "unknown key exchange type"},
	{ERR_REASON(SSL_R_UNKNOWN_PKEY_TYPE)     , "unknown pkey type"},
	{ERR_REASON(SSL_R_UNKNOWN_PROTOCOL)      , "unknown protocol"},
	{ERR_REASON(SSL_R_UNKNOWN_REMOTE_ERROR_TYPE), "unknown remote error type"},
	{ERR_REASON(SSL_R_UNKNOWN_SSL_VERSION)   , "unknown ssl version"},
	{ERR_REASON(SSL_R_UNKNOWN_STATE)         , "unknown state"},
	{ERR_REASON(SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED), "unsafe legacy renegotiation disabled"},
	{ERR_REASON(SSL_R_UNSUPPORTED_CIPHER)    , "unsupported cipher"},
	{ERR_REASON(SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM), "unsupported compression algorithm"},
	{ERR_REASON(SSL_R_UNSUPPORTED_DIGEST_TYPE), "unsupported digest type"},
	{ERR_REASON(SSL_R_UNSUPPORTED_ELLIPTIC_CURVE), "unsupported elliptic curve"},
	{ERR_REASON(SSL_R_UNSUPPORTED_PROTOCOL)  , "unsupported protocol"},
	{ERR_REASON(SSL_R_UNSUPPORTED_SSL_VERSION), "unsupported ssl version"},
	{ERR_REASON(SSL_R_UNSUPPORTED_STATUS_TYPE), "unsupported status type"},
	{ERR_REASON(SSL_R_USE_SRTP_NOT_NEGOTIATED), "use srtp not negotiated"},

	{ERR_REASON(SSL_R_WRITE_BIO_NOT_SET)     , "write bio not set"},
	{ERR_REASON(SSL_R_WRONG_CIPHER_RETURNED) , "wrong cipher returned"},
	{ERR_REASON(SSL_R_WRONG_CURVE)           , "wrong curve"},

	{ERR_REASON(SSL_R_WRONG_MESSAGE_TYPE)    , "wrong message type"},
	{ERR_REASON(SSL_R_WRONG_NUMBER_OF_KEY_BITS), "wrong number of key bits"},
	{ERR_REASON(SSL_R_WRONG_SIGNATURE_LENGTH), "wrong signature length"},
	{ERR_REASON(SSL_R_WRONG_SIGNATURE_SIZE)  , "wrong signature size"},
	{ERR_REASON(SSL_R_WRONG_SIGNATURE_TYPE)  , "wrong signature type"},
	{ERR_REASON(SSL_R_WRONG_SSL_VERSION)     , "wrong ssl version"},
	{ERR_REASON(SSL_R_WRONG_VERSION_NUMBER)  , "wrong version number"},
	{ERR_REASON(SSL_R_X509_LIB)              , "x509 lib"},
	{ERR_REASON(SSL_R_X509_VERIFICATION_SETUP_PROBLEMS), "x509 verification setup problems"},
	{ERR_REASON(SSL_R_PEER_BEHAVING_BADLY), "peer is doing strange or hostile things"},
	{ERR_REASON(SSL_R_UNKNOWN), "unknown failure occurred"},
	{0, NULL}
};

#endif

void
ERR_load_SSL_strings(void)







>




















>



>









<
<







428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469


470
471
472
473
474
475
476
	{ERR_REASON(SSL_R_UNABLE_TO_FIND_SSL_METHOD), "unable to find ssl method"},
	{ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES), "unable to load ssl2 md5 routines"},
	{ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES), "unable to load ssl3 md5 routines"},
	{ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES), "unable to load ssl3 sha1 routines"},
	{ERR_REASON(SSL_R_UNEXPECTED_MESSAGE)    , "unexpected message"},
	{ERR_REASON(SSL_R_UNEXPECTED_RECORD)     , "unexpected record"},
	{ERR_REASON(SSL_R_UNINITIALIZED)         , "uninitialized"},
	{ERR_REASON(SSL_R_UNKNOWN), "unknown failure occurred"},
	{ERR_REASON(SSL_R_UNKNOWN_ALERT_TYPE)    , "unknown alert type"},
	{ERR_REASON(SSL_R_UNKNOWN_CERTIFICATE_TYPE), "unknown certificate type"},
	{ERR_REASON(SSL_R_UNKNOWN_CIPHER_RETURNED), "unknown cipher returned"},
	{ERR_REASON(SSL_R_UNKNOWN_CIPHER_TYPE)   , "unknown cipher type"},
	{ERR_REASON(SSL_R_UNKNOWN_DIGEST)        , "unknown digest"},
	{ERR_REASON(SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE), "unknown key exchange type"},
	{ERR_REASON(SSL_R_UNKNOWN_PKEY_TYPE)     , "unknown pkey type"},
	{ERR_REASON(SSL_R_UNKNOWN_PROTOCOL)      , "unknown protocol"},
	{ERR_REASON(SSL_R_UNKNOWN_REMOTE_ERROR_TYPE), "unknown remote error type"},
	{ERR_REASON(SSL_R_UNKNOWN_SSL_VERSION)   , "unknown ssl version"},
	{ERR_REASON(SSL_R_UNKNOWN_STATE)         , "unknown state"},
	{ERR_REASON(SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED), "unsafe legacy renegotiation disabled"},
	{ERR_REASON(SSL_R_UNSUPPORTED_CIPHER)    , "unsupported cipher"},
	{ERR_REASON(SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM), "unsupported compression algorithm"},
	{ERR_REASON(SSL_R_UNSUPPORTED_DIGEST_TYPE), "unsupported digest type"},
	{ERR_REASON(SSL_R_UNSUPPORTED_ELLIPTIC_CURVE), "unsupported elliptic curve"},
	{ERR_REASON(SSL_R_UNSUPPORTED_PROTOCOL)  , "unsupported protocol"},
	{ERR_REASON(SSL_R_UNSUPPORTED_SSL_VERSION), "unsupported ssl version"},
	{ERR_REASON(SSL_R_UNSUPPORTED_STATUS_TYPE), "unsupported status type"},
	{ERR_REASON(SSL_R_USE_SRTP_NOT_NEGOTIATED), "use srtp not negotiated"},
	{ERR_REASON(SSL_R_VERSION_TOO_LOW)       , "version too low"},
	{ERR_REASON(SSL_R_WRITE_BIO_NOT_SET)     , "write bio not set"},
	{ERR_REASON(SSL_R_WRONG_CIPHER_RETURNED) , "wrong cipher returned"},
	{ERR_REASON(SSL_R_WRONG_CURVE)           , "wrong curve"},
	{ERR_REASON(SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED), "QUIC: wrong encryption level received"},
	{ERR_REASON(SSL_R_WRONG_MESSAGE_TYPE)    , "wrong message type"},
	{ERR_REASON(SSL_R_WRONG_NUMBER_OF_KEY_BITS), "wrong number of key bits"},
	{ERR_REASON(SSL_R_WRONG_SIGNATURE_LENGTH), "wrong signature length"},
	{ERR_REASON(SSL_R_WRONG_SIGNATURE_SIZE)  , "wrong signature size"},
	{ERR_REASON(SSL_R_WRONG_SIGNATURE_TYPE)  , "wrong signature type"},
	{ERR_REASON(SSL_R_WRONG_SSL_VERSION)     , "wrong ssl version"},
	{ERR_REASON(SSL_R_WRONG_VERSION_NUMBER)  , "wrong version number"},
	{ERR_REASON(SSL_R_X509_LIB)              , "x509 lib"},
	{ERR_REASON(SSL_R_X509_VERIFICATION_SETUP_PROBLEMS), "x509 verification setup problems"},


	{0, NULL}
};

#endif

void
ERR_load_SSL_strings(void)
Changes to jni/libressl/ssl/ssl_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_lib.c,v 1.290 2022/03/18 18:01:17 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_lib.c,v 1.305 2022/09/10 15:29:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
158
159
160
161
162
163
164

165
166
167
168
169
170
171
#include <openssl/engine.h>
#endif

#include "bytestring.h"
#include "dtls_locl.h"
#include "ssl_locl.h"
#include "ssl_sigalgs.h"


const char *SSL_version_str = OPENSSL_VERSION_TEXT;

int
SSL_clear(SSL *s)
{
	if (s->method == NULL) {







>







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#include <openssl/engine.h>
#endif

#include "bytestring.h"
#include "dtls_locl.h"
#include "ssl_locl.h"
#include "ssl_sigalgs.h"
#include "ssl_tlsext.h"

const char *SSL_version_str = OPENSSL_VERSION_TEXT;

int
SSL_clear(SSL *s)
{
	if (s->method == NULL) {
222
223
224
225
226
227
228
229

230
231
232
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth)
{
	STACK_OF(SSL_CIPHER) *ciphers;

	ctx->method = meth;

	ciphers = ssl_create_cipher_list(ctx->method, &ctx->cipher_list,
	    ctx->internal->cipher_list_tls13, SSL_DEFAULT_CIPHER_LIST);

	if (ciphers == NULL || sk_SSL_CIPHER_num(ciphers) <= 0) {
		SSLerrorx(SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS);
		return (0);
	}
	return (1);
}

SSL *
SSL_new(SSL_CTX *ctx)
{
	SSL *s;


	if (ctx == NULL) {
		SSLerrorx(SSL_R_NULL_SSL_CTX);
		return (NULL);
	}
	if (ctx->method == NULL) {
		SSLerrorx(SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);







|
>











>







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth)
{
	STACK_OF(SSL_CIPHER) *ciphers;

	ctx->method = meth;

	ciphers = ssl_create_cipher_list(ctx->method, &ctx->cipher_list,
	    ctx->internal->cipher_list_tls13, SSL_DEFAULT_CIPHER_LIST,
	    ctx->internal->cert);
	if (ciphers == NULL || sk_SSL_CIPHER_num(ciphers) <= 0) {
		SSLerrorx(SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS);
		return (0);
	}
	return (1);
}

SSL *
SSL_new(SSL_CTX *ctx)
{
	SSL *s;
	CBS cbs;

	if (ctx == NULL) {
		SSLerrorx(SSL_R_NULL_SSL_CTX);
		return (NULL);
	}
	if (ctx->method == NULL) {
		SSLerrorx(SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344

345
346
347
348
349
350
351
		    ctx->internal->tlsext_supportedgroups,
		    ctx->internal->tlsext_supportedgroups_length *
		    sizeof(ctx->internal->tlsext_supportedgroups[0]));
		s->internal->tlsext_supportedgroups_length =
		    ctx->internal->tlsext_supportedgroups_length;
	}

	if (s->ctx->internal->alpn_client_proto_list != NULL) {
		s->internal->alpn_client_proto_list =
		    malloc(s->ctx->internal->alpn_client_proto_list_len);
		if (s->internal->alpn_client_proto_list == NULL)
			goto err;
		memcpy(s->internal->alpn_client_proto_list,
		    s->ctx->internal->alpn_client_proto_list,
		    s->ctx->internal->alpn_client_proto_list_len);
		s->internal->alpn_client_proto_list_len =
		    s->ctx->internal->alpn_client_proto_list_len;
	}

	s->verify_result = X509_V_OK;

	s->method = ctx->method;


	if (!s->method->ssl_new(s))
		goto err;

	s->references = 1;
	s->server = ctx->method->server;








|
|
|
|
|
<
<
<
<
<
<




>







326
327
328
329
330
331
332
333
334
335
336
337






338
339
340
341
342
343
344
345
346
347
348
349
		    ctx->internal->tlsext_supportedgroups,
		    ctx->internal->tlsext_supportedgroups_length *
		    sizeof(ctx->internal->tlsext_supportedgroups[0]));
		s->internal->tlsext_supportedgroups_length =
		    ctx->internal->tlsext_supportedgroups_length;
	}

	CBS_init(&cbs, ctx->internal->alpn_client_proto_list,
	    ctx->internal->alpn_client_proto_list_len);
	if (!CBS_stow(&cbs, &s->internal->alpn_client_proto_list,
	    &s->internal->alpn_client_proto_list_len))
		goto err;







	s->verify_result = X509_V_OK;

	s->method = ctx->method;
	s->quic_method = ctx->quic_method;

	if (!s->method->ssl_new(s))
		goto err;

	s->references = 1;
	s->server = ctx->method->server;

572
573
574
575
576
577
578


579
580
581
582
583
584
585

	if (s->method != NULL)
		s->method->ssl_free(s);

	SSL_CTX_free(s->ctx);

	free(s->internal->alpn_client_proto_list);



#ifndef OPENSSL_NO_SRTP
	sk_SRTP_PROTECTION_PROFILE_free(s->internal->srtp_profiles);
#endif

	tls12_record_layer_free(s->internal->rl);








>
>







570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585

	if (s->method != NULL)
		s->method->ssl_free(s);

	SSL_CTX_free(s->ctx);

	free(s->internal->alpn_client_proto_list);

	free(s->internal->quic_transport_params);

#ifndef OPENSSL_NO_SRTP
	sk_SRTP_PROTECTION_PROFILE_free(s->internal->srtp_profiles);
#endif

	tls12_record_layer_free(s->internal->rl);

881
882
883
884
885
886
887
888
889
890
891
892
893
894

895


896
897
898
899
900
901
902

	return cert;
}

STACK_OF(X509) *
SSL_get_peer_cert_chain(const SSL *s)
{
	if (s == NULL || s->session == NULL)
		return NULL;

	/*
	 * If we are a client, cert_chain includes the peer's own
	 * certificate; if we are a server, it does not.
	 */

	return s->session->cert_chain;


}

STACK_OF(X509) *
SSL_get0_verified_chain(const SSL *s)
{
	return s->internal->verified_chain;
}







|



|
|

>
|
>
>







881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905

	return cert;
}

STACK_OF(X509) *
SSL_get_peer_cert_chain(const SSL *s)
{
	if (s == NULL)
		return NULL;

	/*
	 * Achtung! Due to API inconsistency, a client includes the peer's leaf
	 * certificate in the peer certificate chain, while a server does not.
	 */
	if (!s->server)
		return s->s3->hs.peer_certs;

	return s->s3->hs.peer_certs_no_leaf;
}

STACK_OF(X509) *
SSL_get0_verified_chain(const SSL *s)
{
	return s->internal->verified_chain;
}
1026
1027
1028
1029
1030
1031
1032





1033
1034
1035
1036
1037
1038
1039
int
SSL_read(SSL *s, void *buf, int num)
{
	if (num < 0) {
		SSLerror(s, SSL_R_BAD_LENGTH);
		return -1;
	}






	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_UNINITIALIZED);
		return (-1);
	}

	if (s->internal->shutdown & SSL_RECEIVED_SHUTDOWN) {







>
>
>
>
>







1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
int
SSL_read(SSL *s, void *buf, int num)
{
	if (num < 0) {
		SSLerror(s, SSL_R_BAD_LENGTH);
		return -1;
	}

	if (SSL_is_quic(s)) {
		SSLerror(s, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
		return (-1);
	}

	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_UNINITIALIZED);
		return (-1);
	}

	if (s->internal->shutdown & SSL_RECEIVED_SHUTDOWN) {
1065
1066
1067
1068
1069
1070
1071





1072
1073
1074
1075
1076
1077
1078
int
SSL_peek(SSL *s, void *buf, int num)
{
	if (num < 0) {
		SSLerror(s, SSL_R_BAD_LENGTH);
		return -1;
	}






	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_UNINITIALIZED);
		return (-1);
	}

	if (s->internal->shutdown & SSL_RECEIVED_SHUTDOWN) {







>
>
>
>
>







1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
int
SSL_peek(SSL *s, void *buf, int num)
{
	if (num < 0) {
		SSLerror(s, SSL_R_BAD_LENGTH);
		return -1;
	}

	if (SSL_is_quic(s)) {
		SSLerror(s, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
		return (-1);
	}

	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_UNINITIALIZED);
		return (-1);
	}

	if (s->internal->shutdown & SSL_RECEIVED_SHUTDOWN) {
1103
1104
1105
1106
1107
1108
1109





1110
1111
1112
1113
1114
1115
1116
int
SSL_write(SSL *s, const void *buf, int num)
{
	if (num < 0) {
		SSLerror(s, SSL_R_BAD_LENGTH);
		return -1;
	}






	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_UNINITIALIZED);
		return (-1);
	}

	if (s->internal->shutdown & SSL_SENT_SHUTDOWN) {







>
>
>
>
>







1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
int
SSL_write(SSL *s, const void *buf, int num)
{
	if (num < 0) {
		SSLerror(s, SSL_R_BAD_LENGTH);
		return -1;
	}

	if (SSL_is_quic(s)) {
		SSLerror(s, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
		return (-1);
	}

	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_UNINITIALIZED);
		return (-1);
	}

	if (s->internal->shutdown & SSL_SENT_SHUTDOWN) {
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473


1474
1475
1476
1477
1478
1479
1480
	return s->session->ciphers;
}

STACK_OF(SSL_CIPHER) *
SSL_get1_supported_ciphers(SSL *s)
{
	STACK_OF(SSL_CIPHER) *supported_ciphers = NULL, *ciphers;
	const SSL_CIPHER *cipher;
	uint16_t min_vers, max_vers;
	int i;

	if (s == NULL)
		return NULL;
	if (!ssl_supported_tls_version_range(s, &min_vers, &max_vers))
		return NULL;
	if ((ciphers = SSL_get_ciphers(s)) == NULL)
		return NULL;
	if ((supported_ciphers = sk_SSL_CIPHER_new_null()) == NULL)
		return NULL;

	for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
		if ((cipher = sk_SSL_CIPHER_value(ciphers, i)) == NULL)
			goto err;
		if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers,
		    max_vers))


			continue;
		if (!sk_SSL_CIPHER_push(supported_ciphers, cipher))
			goto err;
	}

	if (sk_SSL_CIPHER_num(supported_ciphers) > 0)
		return supported_ciphers;







|

















>
>







1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
	return s->session->ciphers;
}

STACK_OF(SSL_CIPHER) *
SSL_get1_supported_ciphers(SSL *s)
{
	STACK_OF(SSL_CIPHER) *supported_ciphers = NULL, *ciphers;
	SSL_CIPHER *cipher;
	uint16_t min_vers, max_vers;
	int i;

	if (s == NULL)
		return NULL;
	if (!ssl_supported_tls_version_range(s, &min_vers, &max_vers))
		return NULL;
	if ((ciphers = SSL_get_ciphers(s)) == NULL)
		return NULL;
	if ((supported_ciphers = sk_SSL_CIPHER_new_null()) == NULL)
		return NULL;

	for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
		if ((cipher = sk_SSL_CIPHER_value(ciphers, i)) == NULL)
			goto err;
		if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers,
		    max_vers))
			continue;
		if (!ssl_security_supported_cipher(s, cipher))
			continue;
		if (!sk_SSL_CIPHER_push(supported_ciphers, cipher))
			goto err;
	}

	if (sk_SSL_CIPHER_num(supported_ciphers) > 0)
		return supported_ciphers;
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
	 * ssl_create_cipher_list may return an empty stack if it was unable to
	 * find a cipher matching the given rule string (for example if the
	 * rule string specifies a cipher which has been disabled). This is not
	 * an error as far as ssl_create_cipher_list is concerned, and hence
	 * ctx->cipher_list has been updated.
	 */
	ciphers = ssl_create_cipher_list(ctx->method, &ctx->cipher_list,
	    ctx->internal->cipher_list_tls13, str);
	if (ciphers == NULL) {
		return (0);
	} else if (sk_SSL_CIPHER_num(ciphers) == 0) {
		SSLerrorx(SSL_R_NO_CIPHER_MATCH);
		return (0);
	}
	return (1);







|







1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
	 * ssl_create_cipher_list may return an empty stack if it was unable to
	 * find a cipher matching the given rule string (for example if the
	 * rule string specifies a cipher which has been disabled). This is not
	 * an error as far as ssl_create_cipher_list is concerned, and hence
	 * ctx->cipher_list has been updated.
	 */
	ciphers = ssl_create_cipher_list(ctx->method, &ctx->cipher_list,
	    ctx->internal->cipher_list_tls13, str, ctx->internal->cert);
	if (ciphers == NULL) {
		return (0);
	} else if (sk_SSL_CIPHER_num(ciphers) == 0) {
		SSLerrorx(SSL_R_NO_CIPHER_MATCH);
		return (0);
	}
	return (1);
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
	STACK_OF(SSL_CIPHER) *ciphers, *ciphers_tls13;

	if ((ciphers_tls13 = s->internal->cipher_list_tls13) == NULL)
		ciphers_tls13 = s->ctx->internal->cipher_list_tls13;

	/* See comment in SSL_CTX_set_cipher_list. */
	ciphers = ssl_create_cipher_list(s->ctx->method, &s->cipher_list,
	    ciphers_tls13, str);
	if (ciphers == NULL) {
		return (0);
	} else if (sk_SSL_CIPHER_num(ciphers) == 0) {
		SSLerror(s, SSL_R_NO_CIPHER_MATCH);
		return (0);
	}
	return (1);







|







1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
	STACK_OF(SSL_CIPHER) *ciphers, *ciphers_tls13;

	if ((ciphers_tls13 = s->internal->cipher_list_tls13) == NULL)
		ciphers_tls13 = s->ctx->internal->cipher_list_tls13;

	/* See comment in SSL_CTX_set_cipher_list. */
	ciphers = ssl_create_cipher_list(s->ctx->method, &s->cipher_list,
	    ciphers_tls13, str, s->cert);
	if (ciphers == NULL) {
		return (0);
	} else if (sk_SSL_CIPHER_num(ciphers) == 0) {
		SSLerror(s, SSL_R_NO_CIPHER_MATCH);
		return (0);
	}
	return (1);
1758
1759
1760
1761
1762
1763
1764

1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775

1776
1777
1778


1779

1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796

1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807

1808
1809
1810


1811

1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
 * protocols, which must be in wire-format (i.e. a series of non-empty,
 * 8-bit length-prefixed strings). Returns 0 on success.
 */
int
SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos,
    unsigned int protos_len)
{

	int failed = 1;

	if (protos == NULL || protos_len == 0)
		goto err;

	free(ctx->internal->alpn_client_proto_list);
	ctx->internal->alpn_client_proto_list = NULL;
	ctx->internal->alpn_client_proto_list_len = 0;

	if ((ctx->internal->alpn_client_proto_list = malloc(protos_len))
	    == NULL)

		goto err;
	ctx->internal->alpn_client_proto_list_len = protos_len;



	memcpy(ctx->internal->alpn_client_proto_list, protos, protos_len);


	failed = 0;

 err:
	/* NOTE: Return values are the reverse of what you expect. */
	return (failed);
}

/*
 * SSL_set_alpn_protos sets the ALPN protocol list to the specified
 * protocols, which must be in wire-format (i.e. a series of non-empty,
 * 8-bit length-prefixed strings). Returns 0 on success.
 */
int
SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,
    unsigned int protos_len)
{

	int failed = 1;

	if (protos == NULL || protos_len == 0)
		goto err;

	free(ssl->internal->alpn_client_proto_list);
	ssl->internal->alpn_client_proto_list = NULL;
	ssl->internal->alpn_client_proto_list_len = 0;

	if ((ssl->internal->alpn_client_proto_list = malloc(protos_len))
	    == NULL)

		goto err;
	ssl->internal->alpn_client_proto_list_len = protos_len;



	memcpy(ssl->internal->alpn_client_proto_list, protos, protos_len);


	failed = 0;

 err:
	/* NOTE: Return values are the reverse of what you expect. */
	return (failed);
}

/*
 * SSL_CTX_set_alpn_select_cb sets a callback function that is called during
 * ClientHello processing in order to select an ALPN protocol from the
 * client's list of offered protocols.
 */







>


|
|

|
<
<

|
<
>
|
<
|
>
>
|
>





|











>


|
|

|
<
<

|
<
>
|
<
|
>
>
|
>





|







1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791


1792
1793

1794
1795

1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824


1825
1826

1827
1828

1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
 * protocols, which must be in wire-format (i.e. a series of non-empty,
 * 8-bit length-prefixed strings). Returns 0 on success.
 */
int
SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos,
    unsigned int protos_len)
{
	CBS cbs;
	int failed = 1;

	if (protos == NULL)
		protos_len = 0;

	CBS_init(&cbs, protos, protos_len);



	if (protos_len > 0) {

		if (!tlsext_alpn_check_format(&cbs))
			goto err;

	}

	if (!CBS_stow(&cbs, &ctx->internal->alpn_client_proto_list,
	    &ctx->internal->alpn_client_proto_list_len))
		goto err;

	failed = 0;

 err:
	/* NOTE: Return values are the reverse of what you expect. */
	return failed;
}

/*
 * SSL_set_alpn_protos sets the ALPN protocol list to the specified
 * protocols, which must be in wire-format (i.e. a series of non-empty,
 * 8-bit length-prefixed strings). Returns 0 on success.
 */
int
SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,
    unsigned int protos_len)
{
	CBS cbs;
	int failed = 1;

	if (protos == NULL)
		protos_len = 0;

	CBS_init(&cbs, protos, protos_len);



	if (protos_len > 0) {

		if (!tlsext_alpn_check_format(&cbs))
			goto err;

	}

	if (!CBS_stow(&cbs, &ssl->internal->alpn_client_proto_list,
	    &ssl->internal->alpn_client_proto_list_len))
		goto err;

	failed = 0;

 err:
	/* NOTE: Return values are the reverse of what you expect. */
	return failed;
}

/*
 * SSL_CTX_set_alpn_select_cb sets a callback function that is called during
 * ClientHello processing in order to select an ALPN protocol from the
 * client's list of offered protocols.
 */
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
	if (ret->internal->sessions == NULL)
		goto err;
	ret->cert_store = X509_STORE_new();
	if (ret->cert_store == NULL)
		goto err;

	ssl_create_cipher_list(ret->method, &ret->cipher_list,
	    NULL, SSL_DEFAULT_CIPHER_LIST);
	if (ret->cipher_list == NULL ||
	    sk_SSL_CIPHER_num(ret->cipher_list) <= 0) {
		SSLerrorx(SSL_R_LIBRARY_HAS_NO_CIPHERS);
		goto err2;
	}

	ret->param = X509_VERIFY_PARAM_new();







|







2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
	if (ret->internal->sessions == NULL)
		goto err;
	ret->cert_store = X509_STORE_new();
	if (ret->cert_store == NULL)
		goto err;

	ssl_create_cipher_list(ret->method, &ret->cipher_list,
	    NULL, SSL_DEFAULT_CIPHER_LIST, ret->internal->cert);
	if (ret->cipher_list == NULL ||
	    sk_SSL_CIPHER_num(ret->cipher_list) <= 0) {
		SSLerrorx(SSL_R_LIBRARY_HAS_NO_CIPHERS);
		goto err2;
	}

	ret->param = X509_VERIFY_PARAM_new();
2562
2563
2564
2565
2566
2567
2568

























































































































2569
2570
2571
2572
2573
2574
2575

	if ((s->internal->shutdown & SSL_RECEIVED_SHUTDOWN) &&
	    (s->s3->warn_alert == SSL_AD_CLOSE_NOTIFY))
		return (SSL_ERROR_ZERO_RETURN);

	return (SSL_ERROR_SYSCALL);
}


























































































































int
SSL_do_handshake(SSL *s)
{
	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_CONNECTION_TYPE_NOT_SET);
		return (-1);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718

	if ((s->internal->shutdown & SSL_RECEIVED_SHUTDOWN) &&
	    (s->s3->warn_alert == SSL_AD_CLOSE_NOTIFY))
		return (SSL_ERROR_ZERO_RETURN);

	return (SSL_ERROR_SYSCALL);
}

int
SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method)
{
	if (ctx->method->dtls)
		return 0;

	ctx->quic_method = quic_method;

	return 1;
}

int
SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method)
{
	if (ssl->method->dtls)
		return 0;

	ssl->quic_method = quic_method;

	return 1;
}

size_t
SSL_quic_max_handshake_flight_len(const SSL *ssl,
    enum ssl_encryption_level_t level)
{
	size_t flight_len;

	/* Limit flights to 16K when there are no large certificate messages. */
	flight_len = 16384;

	switch (level) {
	case ssl_encryption_initial:
		return flight_len;

	case ssl_encryption_early_data:
		/* QUIC does not send EndOfEarlyData. */
		return 0;

	case ssl_encryption_handshake:
		if (ssl->server) {
			/*
			 * Servers may receive Certificate message if configured
			 * to request client certificates.
			 */
			if ((SSL_get_verify_mode(ssl) & SSL_VERIFY_PEER) != 0 &&
			    ssl->internal->max_cert_list > flight_len)
				flight_len = ssl->internal->max_cert_list;
		} else {
			/*
			 * Clients may receive both Certificate message and a
			 * CertificateRequest message.
			 */
			if (ssl->internal->max_cert_list * 2 > flight_len)
				flight_len = ssl->internal->max_cert_list * 2;
		}
		return flight_len;
	case ssl_encryption_application:
		/*
		 * Note there is not actually a bound on the number of
		 * NewSessionTickets one may send in a row. This level may need
		 * more involved flow control.
		 */
		return flight_len;
	}

	return 0;
}

enum ssl_encryption_level_t
SSL_quic_read_level(const SSL *ssl)
{
	return ssl->s3->hs.tls13.quic_read_level;
}

enum ssl_encryption_level_t
SSL_quic_write_level(const SSL *ssl)
{
	return ssl->s3->hs.tls13.quic_write_level;
}

int
SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level,
    const uint8_t *data, size_t len)
{
	if (!SSL_is_quic(ssl)) {
		SSLerror(ssl, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
		return 0;
	}

	if (level != SSL_quic_read_level(ssl)) {
		SSLerror(ssl, SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED);
		return 0;
	}

	if (ssl->s3->hs.tls13.quic_read_buffer == NULL) {
		ssl->s3->hs.tls13.quic_read_buffer = tls_buffer_new(0);
		if (ssl->s3->hs.tls13.quic_read_buffer == NULL) {
			SSLerror(ssl, ERR_R_MALLOC_FAILURE);
			return 0;
		}
	}

	/* XXX - note that this does not currently downsize. */
	tls_buffer_set_capacity_limit(ssl->s3->hs.tls13.quic_read_buffer,
	    SSL_quic_max_handshake_flight_len(ssl, level));

	/*
	 * XXX - an append that fails due to exceeding capacity should set
	 * SSL_R_EXCESSIVE_MESSAGE_SIZE.
	 */
	return tls_buffer_append(ssl->s3->hs.tls13.quic_read_buffer, data, len);
}

int
SSL_process_quic_post_handshake(SSL *ssl)
{
	/* XXX - this needs to run PHH received. */
	return 1;
}

int
SSL_do_handshake(SSL *s)
{
	if (s->internal->handshake_func == NULL) {
		SSLerror(s, SSL_R_CONNECTION_TYPE_NOT_SET);
		return (-1);
2796
2797
2798
2799
2800
2801
2802
2803


2804
2805






2806
2807
2808
2809
2810
2811
2812
		cb(s, type, value);
}

void
ssl_msg_callback(SSL *s, int is_write, int content_type,
    const void *msg_buf, size_t msg_len)
{
	if (s->internal->msg_callback != NULL)


		s->internal->msg_callback(is_write, s->version, content_type,
		    msg_buf, msg_len, s, s->internal->msg_callback_arg);






}

/* Fix this function so that it takes an optional type parameter */
X509 *
SSL_get_certificate(const SSL *s)
{
	return (s->cert->key->x509);







|
>
>
|
|
>
>
>
>
>
>







2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
		cb(s, type, value);
}

void
ssl_msg_callback(SSL *s, int is_write, int content_type,
    const void *msg_buf, size_t msg_len)
{
	if (s->internal->msg_callback == NULL)
		return;

	s->internal->msg_callback(is_write, s->version, content_type,
	    msg_buf, msg_len, s, s->internal->msg_callback_arg);
}

void
ssl_msg_callback_cbs(SSL *s, int is_write, int content_type, CBS *cbs)
{
	ssl_msg_callback(s, is_write, content_type, CBS_data(cbs), CBS_len(cbs));
}

/* Fix this function so that it takes an optional type parameter */
X509 *
SSL_get_certificate(const SSL *s)
{
	return (s->cert->key->x509);
3270
3271
3272
3273
3274
3275
3276






























































3277
3278
3279
3280
3281
3282
3283
}

const SSL_METHOD *
SSL_CTX_get_ssl_method(const SSL_CTX *ctx)
{
	return ctx->method;
}































































static int
ssl_cipher_id_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
{
	SSL_CIPHER const *a = a_;
	SSL_CIPHER const *b = b_;
	return ssl_cipher_id_cmp(a, b);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
}

const SSL_METHOD *
SSL_CTX_get_ssl_method(const SSL_CTX *ctx)
{
	return ctx->method;
}

int
SSL_CTX_get_security_level(const SSL_CTX *ctx)
{
	return ctx->internal->cert->security_level;
}

void
SSL_CTX_set_security_level(SSL_CTX *ctx, int level)
{
	ctx->internal->cert->security_level = level;
}

int
SSL_get_security_level(const SSL *ssl)
{
	return ssl->cert->security_level;
}

void
SSL_set_security_level(SSL *ssl, int level)
{
	ssl->cert->security_level = level;
}

int
SSL_is_quic(const SSL *ssl)
{
	return ssl->quic_method != NULL;
}

int
SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params,
    size_t params_len)
{
	freezero(ssl->internal->quic_transport_params,
	    ssl->internal->quic_transport_params_len);
	ssl->internal->quic_transport_params = NULL;
	ssl->internal->quic_transport_params_len = 0;

	if ((ssl->internal->quic_transport_params = malloc(params_len)) == NULL)
		return 0;

	memcpy(ssl->internal->quic_transport_params, params, params_len);
	ssl->internal->quic_transport_params_len = params_len;

	return 1;
}

void
SSL_get_peer_quic_transport_params(const SSL *ssl, const uint8_t **out_params,
    size_t *out_params_len)
{
	*out_params = ssl->s3->peer_quic_transport_params;
	*out_params_len = ssl->s3->peer_quic_transport_params_len;
}

void
SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy)
{
	/* Not supported. */
}

static int
ssl_cipher_id_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
{
	SSL_CIPHER const *a = a_;
	SSL_CIPHER const *b = b_;
	return ssl_cipher_id_cmp(a, b);
Changes to jni/libressl/ssl/ssl_locl.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_locl.h,v 1.388 2022/03/17 17:22:16 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_locl.h,v 1.425 2022/09/10 15:29:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#define SSL_kDHE		0x00000008L /* tmp DH key no DH cert */
#define SSL_kECDHE		0x00000080L /* ephemeral ECDH */
#define SSL_kGOST		0x00000200L /* GOST key exchange */
#define SSL_kTLS1_3		0x00000400L /* TLSv1.3 key exchange */

/* Bits for algorithm_auth (server authentication) */
#define SSL_aRSA		0x00000001L /* RSA auth */
#define SSL_aDSS 		0x00000002L /* DSS auth */
#define SSL_aNULL 		0x00000004L /* no auth (i.e. use ADH or AECDH) */
#define SSL_aECDSA              0x00000040L /* ECDSA auth*/
#define SSL_aGOST01 		0x00000200L /* GOST R 34.10-2001 signature auth */
#define SSL_aTLS1_3		0x00000400L /* TLSv1.3 authentication */

/* Bits for algorithm_enc (symmetric encryption) */
#define SSL_DES			0x00000001L
#define SSL_3DES		0x00000002L
#define SSL_RC4			0x00000004L
#define SSL_IDEA		0x00000008L
#define SSL_eNULL		0x00000010L
#define SSL_AES128		0x00000020L
#define SSL_AES256		0x00000040L
#define SSL_CAMELLIA128		0x00000080L
#define SSL_CAMELLIA256		0x00000100L
#define SSL_eGOST2814789CNT	0x00000200L
#define SSL_AES128GCM		0x00000400L
#define SSL_AES256GCM		0x00000800L
#define SSL_CHACHA20POLY1305	0x00001000L

#define SSL_AES        		(SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GCM)
#define SSL_CAMELLIA		(SSL_CAMELLIA128|SSL_CAMELLIA256)


/* Bits for algorithm_mac (symmetric authentication) */

#define SSL_MD5			0x00000001L
#define SSL_SHA1		0x00000002L







|
|

|

















|







209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#define SSL_kDHE		0x00000008L /* tmp DH key no DH cert */
#define SSL_kECDHE		0x00000080L /* ephemeral ECDH */
#define SSL_kGOST		0x00000200L /* GOST key exchange */
#define SSL_kTLS1_3		0x00000400L /* TLSv1.3 key exchange */

/* Bits for algorithm_auth (server authentication) */
#define SSL_aRSA		0x00000001L /* RSA auth */
#define SSL_aDSS		0x00000002L /* DSS auth */
#define SSL_aNULL		0x00000004L /* no auth (i.e. use ADH or AECDH) */
#define SSL_aECDSA              0x00000040L /* ECDSA auth*/
#define SSL_aGOST01		0x00000200L /* GOST R 34.10-2001 signature auth */
#define SSL_aTLS1_3		0x00000400L /* TLSv1.3 authentication */

/* Bits for algorithm_enc (symmetric encryption) */
#define SSL_DES			0x00000001L
#define SSL_3DES		0x00000002L
#define SSL_RC4			0x00000004L
#define SSL_IDEA		0x00000008L
#define SSL_eNULL		0x00000010L
#define SSL_AES128		0x00000020L
#define SSL_AES256		0x00000040L
#define SSL_CAMELLIA128		0x00000080L
#define SSL_CAMELLIA256		0x00000100L
#define SSL_eGOST2814789CNT	0x00000200L
#define SSL_AES128GCM		0x00000400L
#define SSL_AES256GCM		0x00000800L
#define SSL_CHACHA20POLY1305	0x00001000L

#define SSL_AES			(SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GCM)
#define SSL_CAMELLIA		(SSL_CAMELLIA128|SSL_CAMELLIA256)


/* Bits for algorithm_mac (symmetric authentication) */

#define SSL_MD5			0x00000001L
#define SSL_SHA1		0x00000002L
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#define SSL_PKEY_ECC		1
#define SSL_PKEY_GOST01		2
#define SSL_PKEY_NUM		3

#define SSL_MAX_EMPTY_RECORDS	32

/* SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) |
 * 	    <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN)
 * SSL_kDH  <- DH_ENC & (RSA_ENC | RSA_SIGN | DSA_SIGN)
 * SSL_kDHE <- RSA_ENC | RSA_SIGN | DSA_SIGN
 * SSL_aRSA <- RSA_ENC | RSA_SIGN
 * SSL_aDSS <- DSA_SIGN
 */

/* From ECC-TLS draft, used in encoding the curve type in







|







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#define SSL_PKEY_ECC		1
#define SSL_PKEY_GOST01		2
#define SSL_PKEY_NUM		3

#define SSL_MAX_EMPTY_RECORDS	32

/* SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) |
 *	    <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN)
 * SSL_kDH  <- DH_ENC & (RSA_ENC | RSA_SIGN | DSA_SIGN)
 * SSL_kDHE <- RSA_ENC | RSA_SIGN | DSA_SIGN
 * SSL_aRSA <- RSA_ENC | RSA_SIGN
 * SSL_aDSS <- DSA_SIGN
 */

/* From ECC-TLS draft, used in encoding the curve type in
375
376
377
378
379
380
381





382
383
384
385
386
387
388
	int valid;
	unsigned long mask_k;
	unsigned long mask_a;

	DH *dhe_params;
	DH *(*dhe_params_cb)(SSL *ssl, int is_export, int keysize);
	int dhe_params_auto;






	int references; /* >1 only if SSL_copy_session_id is used */
} SSL_CERT;

struct ssl_comp_st {
	int id;
	const char *name;







>
>
>
>
>







375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
	int valid;
	unsigned long mask_k;
	unsigned long mask_a;

	DH *dhe_params;
	DH *(*dhe_params_cb)(SSL *ssl, int is_export, int keysize);
	int dhe_params_auto;

	int (*security_cb)(const SSL *s, const SSL_CTX *ctx, int op, int bits,
	    int nid, void *other, void *ex_data); /* Not exposed in API. */
	int security_level;
	void *security_ex_data; /* Not exposed in API. */

	int references; /* >1 only if SSL_copy_session_id is used */
} SSL_CERT;

struct ssl_comp_st {
	int id;
	const char *name;
430
431
432
433
434
435
436

437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
	int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);

	const SSL_CIPHER *(*get_cipher)(unsigned int ncipher);

	unsigned int enc_flags;		/* SSL_ENC_FLAG_* */
};


/* Lets make this into an ASN.1 type structure as follows
 * SSL_SESSION_ID ::= SEQUENCE {
 *	version 		INTEGER,	-- structure version number
 *	SSLversion 		INTEGER,	-- SSL version number
 *	Cipher 			OCTET STRING,	-- the 3 byte cipher ID
 *	Session_ID 		OCTET STRING,	-- the Session ID
 *	Master_key 		OCTET STRING,	-- the master key
 *	KRB5_principal		OCTET STRING	-- optional Kerberos principal
 *	Time [ 1 ] EXPLICIT	INTEGER,	-- optional Start Time
 *	Timeout [ 2 ] EXPLICIT	INTEGER,	-- optional Timeout ins seconds
 *	Peer [ 3 ] EXPLICIT	X509,		-- optional Peer Certificate
 *	Session_ID_context [ 4 ] EXPLICIT OCTET STRING,   -- the Session ID context
 *	Verify_result [ 5 ] EXPLICIT INTEGER,   -- X509_V_... code for `Peer'
 *	HostName [ 6 ] EXPLICIT OCTET STRING,   -- optional HostName from servername TLS extension
 *	PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint
 *	PSK_identity [ 8 ] EXPLICIT OCTET STRING,  -- optional PSK identity
 *	Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket
 *	Ticket [10]             EXPLICIT OCTET STRING, -- session ticket (clients only)
 *	Compression_meth [11]   EXPLICIT OCTET STRING, -- optional compression method
 *	SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username
 *	}
 * Look in ssl/ssl_asn1.c for more details
 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
 */
struct ssl_session_st {
	int ssl_version;	/* what ssl version session info is
				 * being kept in here? */

	int master_key_length;
	unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];

	/* session_id - valid? */
	unsigned int session_id_length;
	unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];

	/* this is used to determine whether the session is being reused in
	 * the appropriate context. It is up to the application to set this,
	 * via SSL_new */
	unsigned int sid_ctx_length;
	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];

	/* Peer provided leaf (end-entity) certificate. */
	X509 *peer_cert;
	int peer_cert_type;

	/* when app_verify_callback accepts a session where the peer's certificate







>
|

|
|
|
|
|













|







|



|





|







435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
	int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);

	const SSL_CIPHER *(*get_cipher)(unsigned int ncipher);

	unsigned int enc_flags;		/* SSL_ENC_FLAG_* */
};

/*
 * Let's make this into an ASN.1 type structure as follows
 * SSL_SESSION_ID ::= SEQUENCE {
 *	version			INTEGER,	-- structure version number
 *	SSLversion		INTEGER,	-- SSL version number
 *	Cipher			OCTET STRING,	-- the 2 byte cipher ID
 *	Session_ID		OCTET STRING,	-- the Session ID
 *	Master_key		OCTET STRING,	-- the master key
 *	KRB5_principal		OCTET STRING	-- optional Kerberos principal
 *	Time [ 1 ] EXPLICIT	INTEGER,	-- optional Start Time
 *	Timeout [ 2 ] EXPLICIT	INTEGER,	-- optional Timeout ins seconds
 *	Peer [ 3 ] EXPLICIT	X509,		-- optional Peer Certificate
 *	Session_ID_context [ 4 ] EXPLICIT OCTET STRING,   -- the Session ID context
 *	Verify_result [ 5 ] EXPLICIT INTEGER,   -- X509_V_... code for `Peer'
 *	HostName [ 6 ] EXPLICIT OCTET STRING,   -- optional HostName from servername TLS extension
 *	PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint
 *	PSK_identity [ 8 ] EXPLICIT OCTET STRING,  -- optional PSK identity
 *	Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket
 *	Ticket [10]             EXPLICIT OCTET STRING, -- session ticket (clients only)
 *	Compression_meth [11]   EXPLICIT OCTET STRING, -- optional compression method
 *	SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username
 * }
 * Look in ssl/ssl_asn1.c for more details
 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
 */
struct ssl_session_st {
	int ssl_version;	/* what ssl version session info is
				 * being kept in here? */

	size_t master_key_length;
	unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];

	/* session_id - valid? */
	size_t session_id_length;
	unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];

	/* this is used to determine whether the session is being reused in
	 * the appropriate context. It is up to the application to set this,
	 * via SSL_new */
	size_t sid_ctx_length;
	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];

	/* Peer provided leaf (end-entity) certificate. */
	X509 *peer_cert;
	int peer_cert_type;

	/* when app_verify_callback accepts a session where the peer's certificate
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
	struct ssl_session_st *prev, *next;

	/* Used to indicate that session resumption is not allowed.
	 * Applications can also set this bit for a new session via
	 * not_resumable_session_cb to disable session caching and tickets. */
	int not_resumable;

	STACK_OF(X509) *cert_chain; /* as received from peer */

	size_t tlsext_ecpointformatlist_length;
	uint8_t *tlsext_ecpointformatlist; /* peer's list */
	size_t tlsext_supportedgroups_length;
	uint16_t *tlsext_supportedgroups; /* peer's list */
};

struct ssl_sigalg;







<
<







514
515
516
517
518
519
520


521
522
523
524
525
526
527
	struct ssl_session_st *prev, *next;

	/* Used to indicate that session resumption is not allowed.
	 * Applications can also set this bit for a new session via
	 * not_resumable_session_cb to disable session caching and tickets. */
	int not_resumable;



	size_t tlsext_ecpointformatlist_length;
	uint8_t *tlsext_ecpointformatlist; /* peer's list */
	size_t tlsext_supportedgroups_length;
	uint16_t *tlsext_supportedgroups; /* peer's list */
};

struct ssl_sigalg;
543
544
545
546
547
548
549



550
551
552
553
554
555
556
	/* Transcript hash prior to sending certificate verify message. */
	uint8_t cert_verify[EVP_MAX_MD_SIZE];
} SSL_HANDSHAKE_TLS12;

typedef struct ssl_handshake_tls13_st {
	int use_legacy;
	int hrr;




	/* Certificate selected for use (static pointer). */
	const SSL_CERT_PKEY *cpk;

	/* Version proposed by peer server. */
	uint16_t server_version;








>
>
>







547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
	/* Transcript hash prior to sending certificate verify message. */
	uint8_t cert_verify[EVP_MAX_MD_SIZE];
} SSL_HANDSHAKE_TLS12;

typedef struct ssl_handshake_tls13_st {
	int use_legacy;
	int hrr;

	/* Client indicates psk_dhe_ke support in PskKeyExchangeMode. */
	int use_psk_dhe_ke;

	/* Certificate selected for use (static pointer). */
	const SSL_CERT_PKEY *cpk;

	/* Version proposed by peer server. */
	uint16_t server_version;

568
569
570
571
572
573
574





575
576
577
578
579
580
581
	uint8_t legacy_session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
	size_t legacy_session_id_len;

	/* ClientHello hash, used to validate following HelloRetryRequest */
	EVP_MD_CTX *clienthello_md_ctx;
	unsigned char *clienthello_hash;
	unsigned int clienthello_hash_len;





} SSL_HANDSHAKE_TLS13;

typedef struct ssl_handshake_st {
	/*
	 * Minimum and maximum versions supported for this handshake. These are
	 * initialised at the start of a handshake based on the method in use
	 * and the current protocol version configuration.







>
>
>
>
>







575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
	uint8_t legacy_session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
	size_t legacy_session_id_len;

	/* ClientHello hash, used to validate following HelloRetryRequest */
	EVP_MD_CTX *clienthello_md_ctx;
	unsigned char *clienthello_hash;
	unsigned int clienthello_hash_len;

	/* QUIC read buffer and read/write encryption levels. */
	struct tls_buffer *quic_read_buffer;
	enum ssl_encryption_level_t quic_read_level;
	enum ssl_encryption_level_t quic_write_level;
} SSL_HANDSHAKE_TLS13;

typedef struct ssl_handshake_st {
	/*
	 * Minimum and maximum versions supported for this handshake. These are
	 * initialised at the start of a handshake based on the method in use
	 * and the current protocol version configuration.
627
628
629
630
631
632
633




634
635
636
637
638
639
640
	 * Copies of the verify data sent in our finished message and the
	 * verify data received in the finished message sent by our peer.
	 */
	uint8_t finished[EVP_MAX_MD_SIZE];
	size_t finished_len;
	uint8_t peer_finished[EVP_MAX_MD_SIZE];
	size_t peer_finished_len;





	SSL_HANDSHAKE_TLS12 tls12;
	SSL_HANDSHAKE_TLS13 tls13;
} SSL_HANDSHAKE;

typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;








>
>
>
>







639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
	 * Copies of the verify data sent in our finished message and the
	 * verify data received in the finished message sent by our peer.
	 */
	uint8_t finished[EVP_MAX_MD_SIZE];
	size_t finished_len;
	uint8_t peer_finished[EVP_MAX_MD_SIZE];
	size_t peer_finished_len;

	/* List of certificates received from our peer. */
	STACK_OF(X509) *peer_certs;
	STACK_OF(X509) *peer_certs_no_leaf;

	SSL_HANDSHAKE_TLS12 tls12;
	SSL_HANDSHAKE_TLS13 tls13;
} SSL_HANDSHAKE;

typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;

850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869

870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
	 */
	int (*alpn_select_cb)(SSL *s, const unsigned char **out,
	    unsigned char *outlen, const unsigned char *in, unsigned int inlen,
	    void *arg);
	void *alpn_select_cb_arg;

	/* Client list of supported protocols in wire format. */
	unsigned char *alpn_client_proto_list;
	unsigned int alpn_client_proto_list_len;

	size_t tlsext_ecpointformatlist_length;
	uint8_t *tlsext_ecpointformatlist; /* our list */
	size_t tlsext_supportedgroups_length;
	uint16_t *tlsext_supportedgroups; /* our list */
	SSL_CTX_keylog_cb_func keylog_callback; /* Unused. For OpenSSL compatibility. */
	size_t num_tickets; /* Unused, for OpenSSL compatibility */
} SSL_CTX_INTERNAL;

struct ssl_ctx_st {
	const SSL_METHOD *method;


	STACK_OF(SSL_CIPHER) *cipher_list;

	struct x509_store_st /* X509_STORE */ *cert_store;

	/* If timeout is not 0, it is the default timeout value set
	 * when SSL_new() is called.  This has been put in to make
	 * life easier to set things up */
	long session_timeout;

	int references;

	/* Default values to use in SSL structures follow (these are copied by SSL_new) */

	STACK_OF(X509) *extra_certs;

	int verify_mode;
	unsigned int sid_ctx_length;
	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];

	X509_VERIFY_PARAM *param;

	/*
	 * XXX
	 * default_passwd_cb used by python and openvpn, need to keep it until we







|
|











>

















|







866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
	 */
	int (*alpn_select_cb)(SSL *s, const unsigned char **out,
	    unsigned char *outlen, const unsigned char *in, unsigned int inlen,
	    void *arg);
	void *alpn_select_cb_arg;

	/* Client list of supported protocols in wire format. */
	uint8_t *alpn_client_proto_list;
	size_t alpn_client_proto_list_len;

	size_t tlsext_ecpointformatlist_length;
	uint8_t *tlsext_ecpointformatlist; /* our list */
	size_t tlsext_supportedgroups_length;
	uint16_t *tlsext_supportedgroups; /* our list */
	SSL_CTX_keylog_cb_func keylog_callback; /* Unused. For OpenSSL compatibility. */
	size_t num_tickets; /* Unused, for OpenSSL compatibility */
} SSL_CTX_INTERNAL;

struct ssl_ctx_st {
	const SSL_METHOD *method;
	const SSL_QUIC_METHOD *quic_method;

	STACK_OF(SSL_CIPHER) *cipher_list;

	struct x509_store_st /* X509_STORE */ *cert_store;

	/* If timeout is not 0, it is the default timeout value set
	 * when SSL_new() is called.  This has been put in to make
	 * life easier to set things up */
	long session_timeout;

	int references;

	/* Default values to use in SSL structures follow (these are copied by SSL_new) */

	STACK_OF(X509) *extra_certs;

	int verify_mode;
	size_t sid_ctx_length;
	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];

	X509_VERIFY_PARAM *param;

	/*
	 * XXX
	 * default_passwd_cb used by python and openvpn, need to keep it until we
916
917
918
919
920
921
922
923
924




925
926
927
928
929
930
931
	uint16_t min_proto_version;
	uint16_t max_proto_version;

	unsigned long options; /* protocol behaviour */
	unsigned long mode; /* API behaviour */

	/* Client list of supported protocols in wire format. */
	unsigned char *alpn_client_proto_list;
	unsigned int alpn_client_proto_list_len;





	/* XXX Callbacks */

	/* true when we are actually in SSL_accept() or SSL_connect() */
	int in_handshake;
	int (*handshake_func)(SSL *);








|
|
>
>
>
>







933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
	uint16_t min_proto_version;
	uint16_t max_proto_version;

	unsigned long options; /* protocol behaviour */
	unsigned long mode; /* API behaviour */

	/* Client list of supported protocols in wire format. */
	uint8_t *alpn_client_proto_list;
	size_t alpn_client_proto_list_len;

	/* QUIC transport params we will send */
	uint8_t *quic_transport_params;
	size_t quic_transport_params_len;

	/* XXX Callbacks */

	/* true when we are actually in SSL_accept() or SSL_connect() */
	int in_handshake;
	int (*handshake_func)(SSL *);

1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056

1057
1058
1059
1060
1061
1062
1063
	/* TLS Session Ticket extension override */
	TLS_SESSION_TICKET_EXT *tlsext_session_ticket;

	STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;	/* What we'll do */
	const SRTP_PROTECTION_PROFILE *srtp_profile;		/* What's been chosen */

	int renegotiate;/* 1 if we are renegotiating.
		 	 * 2 if we are a server and are inside a handshake
	                 * (i.e. not just sending a HelloRequest) */

	int rstate;	/* where we are when reading */

	int mac_packet;

	int empty_record_count;

	size_t num_tickets; /* Unused, for OpenSSL compatibility */
	STACK_OF(X509) *verified_chain;
} SSL_INTERNAL;

struct ssl_st {
	/* protocol version
	 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
	 */
	int version;

	const SSL_METHOD *method; /* SSLv3 */


	/* There are 2 BIO's even though they are normally both the
	 * same.  This is so data can be read and written to different
	 * handlers */

	BIO *rbio; /* used by SSL_read */
	BIO *wbio; /* used by SSL_write */







|


















|
>







1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
	/* TLS Session Ticket extension override */
	TLS_SESSION_TICKET_EXT *tlsext_session_ticket;

	STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;	/* What we'll do */
	const SRTP_PROTECTION_PROFILE *srtp_profile;		/* What's been chosen */

	int renegotiate;/* 1 if we are renegotiating.
			 * 2 if we are a server and are inside a handshake
	                 * (i.e. not just sending a HelloRequest) */

	int rstate;	/* where we are when reading */

	int mac_packet;

	int empty_record_count;

	size_t num_tickets; /* Unused, for OpenSSL compatibility */
	STACK_OF(X509) *verified_chain;
} SSL_INTERNAL;

struct ssl_st {
	/* protocol version
	 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
	 */
	int version;

	const SSL_METHOD *method;
	const SSL_QUIC_METHOD *quic_method;

	/* There are 2 BIO's even though they are normally both the
	 * same.  This is so data can be read and written to different
	 * handlers */

	BIO *rbio; /* used by SSL_read */
	BIO *wbio; /* used by SSL_write */
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
	STACK_OF(SSL_CIPHER) *cipher_list;

	/* This is used to hold the server certificate used */
	SSL_CERT *cert;

	/* the session_id_context is used to ensure sessions are only reused
	 * in the appropriate context */
	unsigned int sid_ctx_length;
	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];

	/* This can also be in the session once a session is established */
	SSL_SESSION *session;

	/* Used in SSL2 and SSL3 */
	int verify_mode;	/* 0 don't care about verify failure.







|







1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
	STACK_OF(SSL_CIPHER) *cipher_list;

	/* This is used to hold the server certificate used */
	SSL_CERT *cert;

	/* the session_id_context is used to ensure sessions are only reused
	 * in the appropriate context */
	size_t sid_ctx_length;
	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];

	/* This can also be in the session once a session is established */
	SSL_SESSION *session;

	/* Used in SSL2 and SSL3 */
	int verify_mode;	/* 0 don't care about verify failure.
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
	unsigned int wnum;	/* number of bytes sent so far */
	int wpend_tot;		/* number bytes written */
	int wpend_type;
	int wpend_ret;		/* number of bytes submitted */
	const unsigned char *wpend_buf;

	/* Transcript of handshake messages that have been sent and received. */
	BUF_MEM *handshake_transcript;

	/* Rolling hash of handshake messages. */
	EVP_MD_CTX *handshake_hash;

	/* this is set whenerver we see a change_cipher_spec message
	 * come in when we are not looking for one */
	int change_cipher_spec;







|







1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
	unsigned int wnum;	/* number of bytes sent so far */
	int wpend_tot;		/* number bytes written */
	int wpend_type;
	int wpend_ret;		/* number of bytes submitted */
	const unsigned char *wpend_buf;

	/* Transcript of handshake messages that have been sent and received. */
	struct tls_buffer *handshake_transcript;

	/* Rolling hash of handshake messages. */
	EVP_MD_CTX *handshake_hash;

	/* this is set whenerver we see a change_cipher_spec message
	 * come in when we are not looking for one */
	int change_cipher_spec;
1203
1204
1205
1206
1207
1208
1209
1210
1211




1212
1213
1214
1215
1216
1217
1218
	 * ALPN information.
	 *
	 * In a server these point to the selected ALPN protocol after the
	 * ClientHello has been processed. In a client these contain the
	 * protocol that the server selected once the ServerHello has been
	 * processed.
	 */
	unsigned char *alpn_selected;
	size_t alpn_selected_len;




} SSL3_STATE;

/*
 * Flag values for enc_flags.
 */

/* Uses signature algorithms extension. */







|

>
>
>
>







1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
	 * ALPN information.
	 *
	 * In a server these point to the selected ALPN protocol after the
	 * ClientHello has been processed. In a client these contain the
	 * protocol that the server selected once the ServerHello has been
	 * processed.
	 */
	uint8_t *alpn_selected;
	size_t alpn_selected_len;

	/* Contains the QUIC transport params received from our peer. */
	uint8_t *peer_quic_transport_params;
	size_t peer_quic_transport_params_len;
} SSL3_STATE;

/*
 * Flag values for enc_flags.
 */

/* Uses signature algorithms extension. */
1260
1261
1262
1263
1264
1265
1266

1267
1268
1269
1270

1271
1272
1273
1274


















1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293

void ssl_clear_cipher_state(SSL *s);
int ssl_clear_bad_session(SSL *s);

void ssl_info_callback(const SSL *s, int type, int value);
void ssl_msg_callback(SSL *s, int is_write, int content_type,
    const void *msg_buf, size_t msg_len);


SSL_CERT *ssl_cert_new(void);
SSL_CERT *ssl_cert_dup(SSL_CERT *cert);
void ssl_cert_free(SSL_CERT *c);

int ssl_cert_set0_chain(SSL_CERT *c, STACK_OF(X509) *chain);
int ssl_cert_set1_chain(SSL_CERT *c, STACK_OF(X509) *chain);
int ssl_cert_add0_chain_cert(SSL_CERT *c, X509 *cert);
int ssl_cert_add1_chain_cert(SSL_CERT *c, X509 *cert);



















int ssl_get_new_session(SSL *s, int session);
int ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block,
    int *alert);
int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
SSL_CIPHER *OBJ_bsearch_ssl_cipher_id(SSL_CIPHER *key, SSL_CIPHER const *base,
    int num);
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *ciphers, CBB *cbb);
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, CBS *cbs);
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
    STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) *tls13,
    const char *rule_str);
int ssl_parse_ciphersuites(STACK_OF(SSL_CIPHER) **out_ciphers, const char *str);
int ssl_merge_cipherlists(STACK_OF(SSL_CIPHER) *cipherlist,
    STACK_OF(SSL_CIPHER) *cipherlist_tls13,
    STACK_OF(SSL_CIPHER) **out_cipherlist);
void ssl_update_cache(SSL *s, int mode);
int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
    const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size);







>




>
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











|







1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339

void ssl_clear_cipher_state(SSL *s);
int ssl_clear_bad_session(SSL *s);

void ssl_info_callback(const SSL *s, int type, int value);
void ssl_msg_callback(SSL *s, int is_write, int content_type,
    const void *msg_buf, size_t msg_len);
void ssl_msg_callback_cbs(SSL *s, int is_write, int content_type, CBS *cbs);

SSL_CERT *ssl_cert_new(void);
SSL_CERT *ssl_cert_dup(SSL_CERT *cert);
void ssl_cert_free(SSL_CERT *c);
SSL_CERT *ssl_get0_cert(SSL_CTX *ctx, SSL *ssl);
int ssl_cert_set0_chain(SSL_CTX *ctx, SSL *ssl, STACK_OF(X509) *chain);
int ssl_cert_set1_chain(SSL_CTX *ctx, SSL *ssl, STACK_OF(X509) *chain);
int ssl_cert_add0_chain_cert(SSL_CTX *ctx, SSL *ssl, X509 *cert);
int ssl_cert_add1_chain_cert(SSL_CTX *ctx, SSL *ssl, X509 *cert);

int ssl_security_default_cb(const SSL *ssl, const SSL_CTX *ctx, int op,
    int bits, int nid, void *other, void *ex_data);

int ssl_security_cipher_check(const SSL *ssl, SSL_CIPHER *cipher);
int ssl_security_shared_cipher(const SSL *ssl, SSL_CIPHER *cipher);
int ssl_security_supported_cipher(const SSL *ssl, SSL_CIPHER *cipher);
int ssl_ctx_security_dh(const SSL_CTX *ctx, DH *dh);
int ssl_security_dh(const SSL *ssl, DH *dh);
int ssl_security_sigalg_check(const SSL *ssl, const EVP_PKEY *pkey);
int ssl_security_tickets(const SSL *ssl);
int ssl_security_version(const SSL *ssl, int version);
int ssl_security_cert(const SSL_CTX *ctx, const SSL *ssl, X509 *x509,
    int is_peer, int *out_error);
int ssl_security_cert_chain(const SSL *ssl, STACK_OF(X509) *sk,
    X509 *x509, int *out_error);
int ssl_security_shared_group(const SSL *ssl, uint16_t group_id);
int ssl_security_supported_group(const SSL *ssl, uint16_t group_id);

int ssl_get_new_session(SSL *s, int session);
int ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block,
    int *alert);
int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
SSL_CIPHER *OBJ_bsearch_ssl_cipher_id(SSL_CIPHER *key, SSL_CIPHER const *base,
    int num);
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *ciphers, CBB *cbb);
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, CBS *cbs);
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
    STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) *tls13,
    const char *rule_str, SSL_CERT *cert);
int ssl_parse_ciphersuites(STACK_OF(SSL_CIPHER) **out_ciphers, const char *str);
int ssl_merge_cipherlists(STACK_OF(SSL_CIPHER) *cipherlist,
    STACK_OF(SSL_CIPHER) *cipherlist_tls13,
    STACK_OF(SSL_CIPHER) **out_cipherlist);
void ssl_update_cache(SSL *s, int mode);
int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
    const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size);
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483

1484
1485

1486

1487
1488
1489
1490
1491
1492
1493
int tls12_derive_peer_finished(SSL *s);
int tls12_derive_master_secret(SSL *s, uint8_t *premaster_secret,
    size_t premaster_secret_len);

int ssl_using_ecc_cipher(SSL *s);
int ssl_check_srvr_ecc_cert_and_alg(SSL *s, X509 *x);

void tls1_get_formatlist(SSL *s, int client_formats, const uint8_t **pformats,
    size_t *pformatslen);
void tls1_get_group_list(SSL *s, int client_groups, const uint16_t **pgroups,
    size_t *pgroupslen);

int tls1_set_groups(uint16_t **out_group_ids, size_t *out_group_ids_len,
    const int *groups, size_t ngroups);
int tls1_set_group_list(uint16_t **out_group_ids, size_t *out_group_ids_len,
    const char *groups);

int tls1_ec_curve_id2nid(const uint16_t curve_id);

uint16_t tls1_ec_nid2curve_id(const int nid);
int tls1_check_curve(SSL *s, const uint16_t group_id);

int tls1_get_shared_curve(SSL *s);


int ssl_check_clienthello_tlsext_early(SSL *s);
int ssl_check_clienthello_tlsext_late(SSL *s);
int ssl_check_serverhello_tlsext(SSL *s);

#define TLS1_TICKET_FATAL_ERROR		-1
#define TLS1_TICKET_NONE		 0







|
|
|
|






|
>
|
|
>
|
>







1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
int tls12_derive_peer_finished(SSL *s);
int tls12_derive_master_secret(SSL *s, uint8_t *premaster_secret,
    size_t premaster_secret_len);

int ssl_using_ecc_cipher(SSL *s);
int ssl_check_srvr_ecc_cert_and_alg(SSL *s, X509 *x);

void tls1_get_formatlist(const SSL *s, int client_formats,
    const uint8_t **pformats, size_t *pformatslen);
void tls1_get_group_list(const SSL *s, int client_groups,
    const uint16_t **pgroups, size_t *pgroupslen);

int tls1_set_groups(uint16_t **out_group_ids, size_t *out_group_ids_len,
    const int *groups, size_t ngroups);
int tls1_set_group_list(uint16_t **out_group_ids, size_t *out_group_ids_len,
    const char *groups);

int tls1_ec_group_id2nid(uint16_t group_id, int *out_nid);
int tls1_ec_group_id2bits(uint16_t group_id, int *out_bits);
int tls1_ec_nid2group_id(int nid, uint16_t *out_group_id);
int tls1_check_group(SSL *s, uint16_t group_id);
int tls1_count_shared_groups(const SSL *ssl, size_t *out_count);
int tls1_get_shared_group_by_index(const SSL *ssl, size_t index, int *out_nid);
int tls1_get_supported_group(const SSL *s, int *out_nid);

int ssl_check_clienthello_tlsext_early(SSL *s);
int ssl_check_clienthello_tlsext_late(SSL *s);
int ssl_check_serverhello_tlsext(SSL *s);

#define TLS1_TICKET_FATAL_ERROR		-1
#define TLS1_TICKET_NONE		 0
1520
1521
1522
1523
1524
1525
1526


1527
1528
1529
1530

int srtp_find_profile_by_name(const char *profile_name,
    const SRTP_PROTECTION_PROFILE **pptr, unsigned int len);
int srtp_find_profile_by_num(unsigned int profile_num,
    const SRTP_PROTECTION_PROFILE **pptr);

#endif /* OPENSSL_NO_SRTP */



__END_HIDDEN_DECLS

#endif







>
>




1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581

int srtp_find_profile_by_name(const char *profile_name,
    const SRTP_PROTECTION_PROFILE **pptr, unsigned int len);
int srtp_find_profile_by_num(unsigned int profile_num,
    const SRTP_PROTECTION_PROFILE **pptr);

#endif /* OPENSSL_NO_SRTP */

int tls_process_peer_certs(SSL *s, STACK_OF(X509) *peer_certs);

__END_HIDDEN_DECLS

#endif
Changes to jni/libressl/ssl/ssl_pkt.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_pkt.c,v 1.58 2022/03/26 15:05:53 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_pkt.c,v 1.60 2022/09/11 13:51:25 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
686
687
688
689
690
691
692

693
694
695
696
697
698
699
}

int
ssl3_read_alert(SSL *s)
{
	SSL3_RECORD_INTERNAL *rr = &s->s3->rrec;
	uint8_t alert_level, alert_descr;


	/*
	 * TLSv1.2 permits an alert to be fragmented across multiple records or
	 * for multiple alerts to be be coalesced into a single alert record.
	 * In the case of DTLS, there is no way to reassemble an alert
	 * fragmented across multiple records, hence a full alert must be
	 * available in the record.







>







686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
}

int
ssl3_read_alert(SSL *s)
{
	SSL3_RECORD_INTERNAL *rr = &s->s3->rrec;
	uint8_t alert_level, alert_descr;
	CBS cbs;

	/*
	 * TLSv1.2 permits an alert to be fragmented across multiple records or
	 * for multiple alerts to be be coalesced into a single alert record.
	 * In the case of DTLS, there is no way to reassemble an alert
	 * fragmented across multiple records, hence a full alert must be
	 * available in the record.
709
710
711
712
713
714
715
716
717

718




719
720
721
722
723
724
725
726
			SSLerror(s, SSL_R_BAD_LENGTH);
			ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
			return -1;
		}
		return 1;
	}

	ssl_msg_callback(s, 0, SSL3_RT_ALERT, s->s3->alert_fragment, 2);


	alert_level = s->s3->alert_fragment[0];




	alert_descr = s->s3->alert_fragment[1];
	s->s3->alert_fragment_len = 0;

	ssl_info_callback(s, SSL_CB_READ_ALERT,
	    (alert_level << 8) | alert_descr);

	if (alert_level == SSL3_AL_WARNING) {
		s->s3->warn_alert = alert_descr;







|

>
|
>
>
>
>
|







710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
			SSLerror(s, SSL_R_BAD_LENGTH);
			ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
			return -1;
		}
		return 1;
	}

	CBS_init(&cbs, s->s3->alert_fragment, sizeof(s->s3->alert_fragment));

	ssl_msg_callback_cbs(s, 0, SSL3_RT_ALERT, &cbs);

	if (!CBS_get_u8(&cbs, &alert_level))
		return -1;
	if (!CBS_get_u8(&cbs, &alert_descr))
		return -1;

	s->s3->alert_fragment_len = 0;

	ssl_info_callback(s, SSL_CB_READ_ALERT,
	    (alert_level << 8) | alert_descr);

	if (alert_level == SSL3_AL_WARNING) {
		s->s3->warn_alert = alert_descr;
752
753
754
755
756
757
758


759
760
761
762
763

764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
	return 1;
}

int
ssl3_read_change_cipher_spec(SSL *s)
{
	SSL3_RECORD_INTERNAL *rr = &s->s3->rrec;



	/*
	 * 'Change Cipher Spec' is just a single byte, so we know exactly what
	 * the record payload has to look like.
	 */

	if (rr->length != 1 || rr->off != 0) {
		SSLerror(s, SSL_R_BAD_CHANGE_CIPHER_SPEC);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
		return -1;
	}
	if (rr->data[0] != SSL3_MT_CCS) {
		SSLerror(s, SSL_R_BAD_CHANGE_CIPHER_SPEC);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
		return -1;
	}

	/* XDTLS: check that epoch is consistent */

	ssl_msg_callback(s, 0, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1);

	/* Check that we have a cipher to change to. */
	if (s->s3->hs.cipher == NULL) {
		SSLerror(s, SSL_R_CCS_RECEIVED_EARLY);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
		return -1;
	}







>
>





>
|




|







|







758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
	return 1;
}

int
ssl3_read_change_cipher_spec(SSL *s)
{
	SSL3_RECORD_INTERNAL *rr = &s->s3->rrec;
	const uint8_t ccs[] = { SSL3_MT_CCS };
	CBS cbs;

	/*
	 * 'Change Cipher Spec' is just a single byte, so we know exactly what
	 * the record payload has to look like.
	 */
	CBS_init(&cbs, rr->data, rr->length);
	if (rr->off != 0 || CBS_len(&cbs) != sizeof(ccs)) {
		SSLerror(s, SSL_R_BAD_CHANGE_CIPHER_SPEC);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
		return -1;
	}
	if (!CBS_mem_equal(&cbs, ccs, sizeof(ccs))) {
		SSLerror(s, SSL_R_BAD_CHANGE_CIPHER_SPEC);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
		return -1;
	}

	/* XDTLS: check that epoch is consistent */

	ssl_msg_callback_cbs(s, 0, SSL3_RT_CHANGE_CIPHER_SPEC, &cbs);

	/* Check that we have a cipher to change to. */
	if (s->s3->hs.cipher == NULL) {
		SSLerror(s, SSL_R_CCS_RECEIVED_EARLY);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
		return -1;
	}
Changes to jni/libressl/ssl/ssl_rsa.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_rsa.c,v 1.39 2022/02/03 16:33:12 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_rsa.c,v 1.48 2022/08/31 20:49:37 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
62
63
64
65
66
67
68


69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/pem.h>
#include <openssl/x509.h>

#include "ssl_locl.h"



static int ssl_set_cert(SSL_CERT *c, X509 *x509);
static int ssl_set_pkey(SSL_CERT *c, EVP_PKEY *pkey);
static int use_certificate_chain_bio(BIO *in, SSL_CERT *cert,
    pem_password_cb *passwd_cb, void *passwd_arg);
static int use_certificate_chain_file(const char *file, SSL_CERT *cert,
    pem_password_cb *passwd_cb, void *passwd_arg);


int
SSL_use_certificate(SSL *ssl, X509 *x)
{
	if (x == NULL) {
		SSLerror(ssl, ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	return (ssl_set_cert(ssl->cert, x));
}

int
SSL_use_certificate_file(SSL *ssl, const char *file, int type)
{
	int j;
	BIO *in;







>
>
|
|
|
<
|
<
>








|







62
63
64
65
66
67
68
69
70
71
72
73

74

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/pem.h>
#include <openssl/x509.h>

#include "ssl_locl.h"

static int ssl_get_password_cb_and_arg(SSL_CTX *ctx, SSL *ssl,
    pem_password_cb **passwd_cb, void **passwd_arg);
static int ssl_set_cert(SSL_CTX *ctx, SSL *ssl, X509 *x509);
static int ssl_set_pkey(SSL_CTX *ctx, SSL *ssl, EVP_PKEY *pkey);
static int ssl_use_certificate_chain_bio(SSL_CTX *ctx, SSL *ssl, BIO *in);

static int ssl_use_certificate_chain_file(SSL_CTX *ctx, SSL *ssl,

    const char *file);

int
SSL_use_certificate(SSL *ssl, X509 *x)
{
	if (x == NULL) {
		SSLerror(ssl, ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	return ssl_set_cert(NULL, ssl, x);
}

int
SSL_use_certificate_file(SSL *ssl, const char *file, int type)
{
	int j;
	BIO *in;
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

172
173
174
175
176
177
178



179
180
181

182







183
184
185
186
187
188
189
190
191
		SSLerror(ssl, ERR_R_EVP_LIB);
		return (0);
	}

	RSA_up_ref(rsa);
	EVP_PKEY_assign_RSA(pkey, rsa);

	ret = ssl_set_pkey(ssl->cert, pkey);
	EVP_PKEY_free(pkey);
	return (ret);
}

static int
ssl_set_pkey(SSL_CERT *c, EVP_PKEY *pkey)
{

	int i;

	i = ssl_cert_type(pkey);
	if (i < 0) {
		SSLerrorx(SSL_R_UNKNOWN_CERTIFICATE_TYPE);
		return (0);
	}




	if (c->pkeys[i].x509 != NULL) {
		EVP_PKEY *pktmp;

		pktmp = X509_get_pubkey(c->pkeys[i].x509);







		EVP_PKEY_copy_parameters(pktmp, pkey);
		EVP_PKEY_free(pktmp);
		ERR_clear_error();

		/*
		 * Don't check the public/private key, this is mostly
		 * for smart cards.
		 */
		if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA ||







|





|

>







>
>
>



>
|
>
>
>
>
>
>
>

|







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
		SSLerror(ssl, ERR_R_EVP_LIB);
		return (0);
	}

	RSA_up_ref(rsa);
	EVP_PKEY_assign_RSA(pkey, rsa);

	ret = ssl_set_pkey(NULL, ssl, pkey);
	EVP_PKEY_free(pkey);
	return (ret);
}

static int
ssl_set_pkey(SSL_CTX *ctx, SSL *ssl, EVP_PKEY *pkey)
{
	SSL_CERT *c;
	int i;

	i = ssl_cert_type(pkey);
	if (i < 0) {
		SSLerrorx(SSL_R_UNKNOWN_CERTIFICATE_TYPE);
		return (0);
	}

	if ((c = ssl_get0_cert(ctx, ssl)) == NULL)
		return (0);

	if (c->pkeys[i].x509 != NULL) {
		EVP_PKEY *pktmp;

		if ((pktmp = X509_get0_pubkey(c->pkeys[i].x509)) == NULL)
			return 0;

		/*
		 * Callers of EVP_PKEY_copy_parameters() can't distinguish
		 * errors from the absence of a param_copy() method. So
		 * pretend it can never fail.
		 */
		EVP_PKEY_copy_parameters(pktmp, pkey);

		ERR_clear_error();

		/*
		 * Don't check the public/private key, this is mostly
		 * for smart cards.
		 */
		if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA ||
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214

	EVP_PKEY_free(c->pkeys[i].privatekey);
	EVP_PKEY_up_ref(pkey);
	c->pkeys[i].privatekey = pkey;
	c->key = &(c->pkeys[i]);

	c->valid = 0;
	return (1);
}

int
SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type)
{
	int j, ret = 0;
	BIO *in;







|







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

	EVP_PKEY_free(c->pkeys[i].privatekey);
	EVP_PKEY_up_ref(pkey);
	c->pkeys[i].privatekey = pkey;
	c->key = &(c->pkeys[i]);

	c->valid = 0;
	return 1;
}

int
SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type)
{
	int j, ret = 0;
	BIO *in;
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
{
	int ret;

	if (pkey == NULL) {
		SSLerror(ssl, ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	ret = ssl_set_pkey(ssl->cert, pkey);
	return (ret);
}

int
SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type)
{
	int j, ret = 0;







|







281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
{
	int ret;

	if (pkey == NULL) {
		SSLerror(ssl, ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	ret = ssl_set_pkey(NULL, ssl, pkey);
	return (ret);
}

int
SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type)
{
	int j, ret = 0;
335
336
337
338
339
340
341
342













343
344
345
346
347

348

349








350
351
352
353
354
355
356
int
SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x)
{
	if (x == NULL) {
		SSLerrorx(ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	return (ssl_set_cert(ctx->internal->cert, x));













}

static int
ssl_set_cert(SSL_CERT *c, X509 *x)
{

	EVP_PKEY *pkey;

	int i;









	pkey = X509_get_pubkey(x);
	if (pkey == NULL) {
		SSLerrorx(SSL_R_X509_LIB);
		return (0);
	}








|
>
>
>
>
>
>
>
>
>
>
>
>
>



|

>

>

>
>
>
>
>
>
>
>







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
int
SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x)
{
	if (x == NULL) {
		SSLerrorx(ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	return ssl_set_cert(ctx, NULL, x);
}

static int
ssl_get_password_cb_and_arg(SSL_CTX *ctx, SSL *ssl,
    pem_password_cb **passwd_cb, void **passwd_arg)
{
	if (ssl != NULL)
		ctx = ssl->ctx;

	*passwd_cb = ctx->default_passwd_callback;
	*passwd_arg = ctx->default_passwd_callback_userdata;

	return 1;
}

static int
ssl_set_cert(SSL_CTX *ctx, SSL *ssl, X509 *x)
{
	SSL_CERT *c;
	EVP_PKEY *pkey;
	int ssl_err;
	int i;

	if (!ssl_security_cert(ctx, ssl, x, 1, &ssl_err)) {
		SSLerrorx(ssl_err);
		return (0);
	}

	if ((c = ssl_get0_cert(ctx, ssl)) == NULL)
		return (0);

	pkey = X509_get_pubkey(x);
	if (pkey == NULL) {
		SSLerrorx(SSL_R_X509_LIB);
		return (0);
	}

471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
		SSLerrorx(ERR_R_EVP_LIB);
		return (0);
	}

	RSA_up_ref(rsa);
	EVP_PKEY_assign_RSA(pkey, rsa);

	ret = ssl_set_pkey(ctx->internal->cert, pkey);
	EVP_PKEY_free(pkey);
	return (ret);
}

int
SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type)
{







|







507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
		SSLerrorx(ERR_R_EVP_LIB);
		return (0);
	}

	RSA_up_ref(rsa);
	EVP_PKEY_assign_RSA(pkey, rsa);

	ret = ssl_set_pkey(ctx, NULL, pkey);
	EVP_PKEY_free(pkey);
	return (ret);
}

int
SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type)
{
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
int
SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
{
	if (pkey == NULL) {
		SSLerrorx(ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	return (ssl_set_pkey(ctx->internal->cert, pkey));
}

int
SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
{
	int j, ret = 0;
	BIO *in;







|







575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
int
SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
{
	if (pkey == NULL) {
		SSLerrorx(ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	return ssl_set_pkey(ctx, NULL, pkey);
}

int
SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
{
	int j, ret = 0;
	BIO *in;
606
607
608
609
610
611
612


613
614
615
616
617
618



619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715

/*
 * Read a bio that contains our certificate in "PEM" format,
 * possibly followed by a sequence of CA certificates that should be
 * sent to the peer in the Certificate message.
 */
static int


use_certificate_chain_bio(BIO *in, SSL_CERT *cert, pem_password_cb *passwd_cb,
    void *passwd_arg)
{
	X509 *ca, *x = NULL;
	unsigned long err;
	int ret = 0;




	if ((x = PEM_read_bio_X509_AUX(in, NULL, passwd_cb, passwd_arg)) ==
	    NULL) {
		SSLerrorx(ERR_R_PEM_LIB);
		goto err;
	}

	if (!ssl_set_cert(cert, x))
		goto err;

	if (!ssl_cert_set0_chain(cert, NULL))
		goto err;

	/* Process any additional CA certificates. */
	while ((ca = PEM_read_bio_X509(in, NULL, passwd_cb, passwd_arg)) !=
	    NULL) {
		if (!ssl_cert_add0_chain_cert(cert, ca)) {
			X509_free(ca);
			goto err;
		}
	}

	/* When the while loop ends, it's usually just EOF. */
	err = ERR_peek_last_error();
	if (ERR_GET_LIB(err) == ERR_LIB_PEM &&
	    ERR_GET_REASON(err) == PEM_R_NO_START_LINE) {
		ERR_clear_error();
		ret = 1;
	}

 err:
	X509_free(x);

	return (ret);
}

int
use_certificate_chain_file(const char *file, SSL_CERT *cert,
    pem_password_cb *passwd_cb, void *passwd_arg)
{
	BIO *in;
	int ret = 0;

	in = BIO_new(BIO_s_file());
	if (in == NULL) {
		SSLerrorx(ERR_R_BUF_LIB);
		goto end;
	}

	if (BIO_read_filename(in, file) <= 0) {
		SSLerrorx(ERR_R_SYS_LIB);
		goto end;
	}

	ret = use_certificate_chain_bio(in, cert, passwd_cb, passwd_arg);

 end:
	BIO_free(in);
	return (ret);
}

int
SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file)
{
	return use_certificate_chain_file(file, ctx->internal->cert,
	    ctx->default_passwd_callback,
	    ctx->default_passwd_callback_userdata);
}

int
SSL_use_certificate_chain_file(SSL *ssl, const char *file)
{
	return use_certificate_chain_file(file, ssl->cert,
	    ssl->ctx->default_passwd_callback,
	    ssl->ctx->default_passwd_callback_userdata);
}

int
SSL_CTX_use_certificate_chain_mem(SSL_CTX *ctx, void *buf, int len)
{
	BIO *in;
	int ret = 0;

	in = BIO_new_mem_buf(buf, len);
	if (in == NULL) {
		SSLerrorx(ERR_R_BUF_LIB);
		goto end;
	}

	ret = use_certificate_chain_bio(in, ctx->internal->cert,
	    ctx->default_passwd_callback,
	    ctx->default_passwd_callback_userdata);

 end:
	BIO_free(in);
	return (ret);
}







>
>
|
|
<



>
>
>







|


|





|




















|
<















|









|
<
<





|
<
<














|
<
<





642
643
644
645
646
647
648
649
650
651
652

653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696

697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722


723
724
725
726
727
728


729
730
731
732
733
734
735
736
737
738
739
740
741
742
743


744
745
746
747
748

/*
 * Read a bio that contains our certificate in "PEM" format,
 * possibly followed by a sequence of CA certificates that should be
 * sent to the peer in the Certificate message.
 */
static int
ssl_use_certificate_chain_bio(SSL_CTX *ctx, SSL *ssl, BIO *in)
{
	pem_password_cb *passwd_cb;
	void *passwd_arg;

	X509 *ca, *x = NULL;
	unsigned long err;
	int ret = 0;

	if (!ssl_get_password_cb_and_arg(ctx, ssl, &passwd_cb, &passwd_arg))
		goto err;

	if ((x = PEM_read_bio_X509_AUX(in, NULL, passwd_cb, passwd_arg)) ==
	    NULL) {
		SSLerrorx(ERR_R_PEM_LIB);
		goto err;
	}

	if (!ssl_set_cert(ctx, ssl, x))
		goto err;

	if (!ssl_cert_set0_chain(ctx, ssl, NULL))
		goto err;

	/* Process any additional CA certificates. */
	while ((ca = PEM_read_bio_X509(in, NULL, passwd_cb, passwd_arg)) !=
	    NULL) {
		if (!ssl_cert_add0_chain_cert(ctx, ssl, ca)) {
			X509_free(ca);
			goto err;
		}
	}

	/* When the while loop ends, it's usually just EOF. */
	err = ERR_peek_last_error();
	if (ERR_GET_LIB(err) == ERR_LIB_PEM &&
	    ERR_GET_REASON(err) == PEM_R_NO_START_LINE) {
		ERR_clear_error();
		ret = 1;
	}

 err:
	X509_free(x);

	return (ret);
}

int
ssl_use_certificate_chain_file(SSL_CTX *ctx, SSL *ssl, const char *file)

{
	BIO *in;
	int ret = 0;

	in = BIO_new(BIO_s_file());
	if (in == NULL) {
		SSLerrorx(ERR_R_BUF_LIB);
		goto end;
	}

	if (BIO_read_filename(in, file) <= 0) {
		SSLerrorx(ERR_R_SYS_LIB);
		goto end;
	}

	ret = ssl_use_certificate_chain_bio(ctx, ssl, in);

 end:
	BIO_free(in);
	return (ret);
}

int
SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file)
{
	return ssl_use_certificate_chain_file(ctx, NULL, file);


}

int
SSL_use_certificate_chain_file(SSL *ssl, const char *file)
{
	return ssl_use_certificate_chain_file(NULL, ssl, file);


}

int
SSL_CTX_use_certificate_chain_mem(SSL_CTX *ctx, void *buf, int len)
{
	BIO *in;
	int ret = 0;

	in = BIO_new_mem_buf(buf, len);
	if (in == NULL) {
		SSLerrorx(ERR_R_BUF_LIB);
		goto end;
	}

	ret = ssl_use_certificate_chain_bio(ctx, NULL, in);



 end:
	BIO_free(in);
	return (ret);
}
Added jni/libressl/ssl/ssl_seclevel.c.


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
/*	$OpenBSD: ssl_seclevel.c,v 1.25 2022/08/17 18:41:17 tb Exp $ */
/*
 * Copyright (c) 2020-2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <stddef.h>

#include <openssl/asn1.h>
#include <openssl/dh.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/ossl_typ.h>
#include <openssl/ssl.h>
#include <openssl/tls1.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>

#include "bytestring.h"
#include "ssl_locl.h"

static int
ssl_security_normalize_level(const SSL_CTX *ctx, const SSL *ssl, int *out_level)
{
	int security_level;

	if (ctx != NULL)
		security_level = SSL_CTX_get_security_level(ctx);
	else
		security_level = SSL_get_security_level(ssl);

	if (security_level < 0)
		security_level = 0;
	if (security_level > 5)
		security_level = 5;

	*out_level = security_level;

	return 1;
}

static int
ssl_security_level_to_minimum_bits(int security_level, int *out_minimum_bits)
{
	if (security_level < 0)
		return 0;

	if (security_level == 0)
		*out_minimum_bits = 0;
	else if (security_level == 1)
		*out_minimum_bits = 80;
	else if (security_level == 2)
		*out_minimum_bits = 112;
	else if (security_level == 3)
		*out_minimum_bits = 128;
	else if (security_level == 4)
		*out_minimum_bits = 192;
	else if (security_level >= 5)
		*out_minimum_bits = 256;

	return 1;
}

static int
ssl_security_level_and_minimum_bits(const SSL_CTX *ctx, const SSL *ssl,
    int *out_level, int *out_minimum_bits)
{
	int security_level = 0, minimum_bits = 0;

	if (!ssl_security_normalize_level(ctx, ssl, &security_level))
		return 0;
	if (!ssl_security_level_to_minimum_bits(security_level, &minimum_bits))
		return 0;

	if (out_level != NULL)
		*out_level = security_level;
	if (out_minimum_bits != NULL)
		*out_minimum_bits = minimum_bits;

	return 1;
}

static int
ssl_security_secop_cipher(const SSL_CTX *ctx, const SSL *ssl, int bits,
    void *arg)
{
	const SSL_CIPHER *cipher = arg;
	int security_level, minimum_bits;

	if (!ssl_security_level_and_minimum_bits(ctx, ssl, &security_level,
	    &minimum_bits))
		return 0;

	if (security_level <= 0)
		return 1;

	if (bits < minimum_bits)
		return 0;

	/* No unauthenticated ciphersuites. */
	if (cipher->algorithm_auth & SSL_aNULL)
		return 0;

	if (cipher->algorithm_mac & SSL_MD5)
		return 0;

	if (security_level <= 1)
		return 1;

	if (cipher->algorithm_enc & SSL_RC4)
		return 0;

	if (security_level <= 2)
		return 1;

	/* Security level >= 3 requires a cipher with forward secrecy. */
	if ((cipher->algorithm_mkey & (SSL_kDHE | SSL_kECDHE)) == 0 &&
	    cipher->algorithm_ssl != SSL_TLSV1_3)
		return 0;

	if (security_level <= 3)
		return 1;

	if (cipher->algorithm_mac & SSL_SHA1)
		return 0;

	return 1;
}

static int
ssl_security_secop_version(const SSL_CTX *ctx, const SSL *ssl, int version)
{
	int min_version = TLS1_2_VERSION;
	int security_level;

	if (!ssl_security_level_and_minimum_bits(ctx, ssl, &security_level, NULL))
		return 0;

	if (security_level < 4)
		min_version = TLS1_1_VERSION;
	if (security_level < 3)
		min_version = TLS1_VERSION;

	return ssl_tls_version(version) >= min_version;
}

static int
ssl_security_secop_compression(const SSL_CTX *ctx, const SSL *ssl)
{
	return 0;
}

static int
ssl_security_secop_tickets(const SSL_CTX *ctx, const SSL *ssl)
{
	int security_level;

	if (!ssl_security_level_and_minimum_bits(ctx, ssl, &security_level, NULL))
		return 0;

	return security_level < 3;
}

static int
ssl_security_secop_tmp_dh(const SSL_CTX *ctx, const SSL *ssl, int bits)
{
	int security_level, minimum_bits;

	if (!ssl_security_level_and_minimum_bits(ctx, ssl, &security_level,
	    &minimum_bits))
		return 0;

	/* Disallow DHE keys weaker than 1024 bits even at security level 0. */
	if (security_level <= 0 && bits < 80)
		return 0;

	return bits >= minimum_bits;
}

static int
ssl_security_secop_default(const SSL_CTX *ctx, const SSL *ssl, int bits)
{
	int minimum_bits;

	if (!ssl_security_level_and_minimum_bits(ctx, ssl, NULL, &minimum_bits))
		return 0;

	return bits >= minimum_bits;
}

int
ssl_security_default_cb(const SSL *ssl, const SSL_CTX *ctx, int secop, int bits,
    int version, void *cipher, void *ex_data)
{
	switch (secop) {
	case SSL_SECOP_CIPHER_SUPPORTED:
	case SSL_SECOP_CIPHER_SHARED:
	case SSL_SECOP_CIPHER_CHECK:
		return ssl_security_secop_cipher(ctx, ssl, bits, cipher);
	case SSL_SECOP_VERSION:
		return ssl_security_secop_version(ctx, ssl, version);
	case SSL_SECOP_COMPRESSION:
		return ssl_security_secop_compression(ctx, ssl);
	case SSL_SECOP_TICKET:
		return ssl_security_secop_tickets(ctx, ssl);
	case SSL_SECOP_TMP_DH:
		return ssl_security_secop_tmp_dh(ctx, ssl, bits);
	default:
		return ssl_security_secop_default(ctx, ssl, bits);
	}
}

static int
ssl_ctx_security(const SSL_CTX *ctx, int secop, int bits, int nid, void *other)
{
	return ctx->internal->cert->security_cb(NULL, ctx, secop, bits, nid,
	    other, ctx->internal->cert->security_ex_data);
}

static int
ssl_security(const SSL *ssl, int secop, int bits, int nid, void *other)
{
	return ssl->cert->security_cb(ssl, NULL, secop, bits, nid, other,
	    ssl->cert->security_ex_data);
}

int
ssl_security_sigalg_check(const SSL *ssl, const EVP_PKEY *pkey)
{
	int bits;

	bits = EVP_PKEY_security_bits(pkey);

	return ssl_security(ssl, SSL_SECOP_SIGALG_CHECK, bits, 0, NULL);
}

int
ssl_security_tickets(const SSL *ssl)
{
	return ssl_security(ssl, SSL_SECOP_TICKET, 0, 0, NULL);
}

int
ssl_security_version(const SSL *ssl, int version)
{
	return ssl_security(ssl, SSL_SECOP_VERSION, 0, version, NULL);
}

static int
ssl_security_cipher(const SSL *ssl, SSL_CIPHER *cipher, int secop)
{
	return ssl_security(ssl, secop, cipher->strength_bits, 0, cipher);
}

int
ssl_security_cipher_check(const SSL *ssl, SSL_CIPHER *cipher)
{
	return ssl_security_cipher(ssl, cipher, SSL_SECOP_CIPHER_CHECK);
}

int
ssl_security_shared_cipher(const SSL *ssl, SSL_CIPHER *cipher)
{
	return ssl_security_cipher(ssl, cipher, SSL_SECOP_CIPHER_SHARED);
}

int
ssl_security_supported_cipher(const SSL *ssl, SSL_CIPHER *cipher)
{
	return ssl_security_cipher(ssl, cipher, SSL_SECOP_CIPHER_SUPPORTED);
}

int
ssl_ctx_security_dh(const SSL_CTX *ctx, DH *dh)
{
	int bits;

	bits = DH_security_bits(dh);

	return ssl_ctx_security(ctx, SSL_SECOP_TMP_DH, bits, 0, dh);
}

int
ssl_security_dh(const SSL *ssl, DH *dh)
{
	int bits;

	bits = DH_security_bits(dh);

	return ssl_security(ssl, SSL_SECOP_TMP_DH, bits, 0, dh);
}

static int
ssl_cert_pubkey_security_bits(const X509 *x509)
{
	EVP_PKEY *pkey;

	if ((pkey = X509_get0_pubkey(x509)) == NULL)
		return -1;

	/*
	 * XXX: DSA_security_bits() returns -1 on keys without parameters and
	 * makes the default security callback fail.
	 */

	return EVP_PKEY_security_bits(pkey);
}

static int
ssl_security_cert_key(const SSL_CTX *ctx, const SSL *ssl, X509 *x509, int secop)
{
	int security_bits;

	security_bits = ssl_cert_pubkey_security_bits(x509);

	if (ssl != NULL)
		return ssl_security(ssl, secop, security_bits, 0, x509);

	return ssl_ctx_security(ctx, secop, security_bits, 0, x509);
}

static int
ssl_cert_signature_md_nid(X509 *x509)
{
	int md_nid, signature_nid;

	if ((signature_nid = X509_get_signature_nid(x509)) == NID_undef)
		return NID_undef;

	if (!OBJ_find_sigid_algs(signature_nid, &md_nid, NULL))
		return NID_undef;

	return md_nid;
}

static int
ssl_cert_md_nid_security_bits(int md_nid)
{
	const EVP_MD *md;

	if (md_nid == NID_undef)
		return -1;

	if ((md = EVP_get_digestbynid(md_nid)) == NULL)
		return -1;

	/* Assume 4 bits of collision resistance for each hash octet. */
	return EVP_MD_size(md) * 4;
}

static int
ssl_security_cert_sig(const SSL_CTX *ctx, const SSL *ssl, X509 *x509, int secop)
{
	int md_nid, security_bits;

	/* Don't check signature if self signed. */
	if ((X509_get_extension_flags(x509) & EXFLAG_SS) != 0)
		return 1;

	md_nid = ssl_cert_signature_md_nid(x509);
	security_bits = ssl_cert_md_nid_security_bits(md_nid);

	if (ssl != NULL)
		return ssl_security(ssl, secop, security_bits, md_nid, x509);

	return ssl_ctx_security(ctx, secop, security_bits, md_nid, x509);
}

int
ssl_security_cert(const SSL_CTX *ctx, const SSL *ssl, X509 *x509,
    int is_ee, int *out_error)
{
	int key_error, operation;

	*out_error = 0;

	if (is_ee) {
		operation = SSL_SECOP_EE_KEY;
		key_error = SSL_R_EE_KEY_TOO_SMALL;
	} else {
		operation = SSL_SECOP_CA_KEY;
		key_error = SSL_R_CA_KEY_TOO_SMALL;
	}

	if (!ssl_security_cert_key(ctx, ssl, x509, operation)) {
		*out_error = key_error;
		return 0;
	}

	if (!ssl_security_cert_sig(ctx, ssl, x509, SSL_SECOP_CA_MD)) {
		*out_error = SSL_R_CA_MD_TOO_WEAK;
		return 0;
	}

	return 1;
}

/*
 * Check security of a chain. If |sk| includes the end entity certificate
 * then |x509| must be NULL.
 */
int
ssl_security_cert_chain(const SSL *ssl, STACK_OF(X509) *sk, X509 *x509,
    int *out_error)
{
	int start_idx = 0;
	int is_ee;
	int i;

	if (x509 == NULL) {
		x509 = sk_X509_value(sk, 0);
		start_idx = 1;
	}

	is_ee = 1;
	if (!ssl_security_cert(NULL, ssl, x509, is_ee, out_error))
		return 0;

	is_ee = 0;
	for (i = start_idx; i < sk_X509_num(sk); i++) {
		x509 = sk_X509_value(sk, i);

		if (!ssl_security_cert(NULL, ssl, x509, is_ee, out_error))
			return 0;
	}

	return 1;
}

static int
ssl_security_group(const SSL *ssl, uint16_t group_id, int secop)
{
	CBB cbb;
	int bits, nid;
	uint8_t group[2];

	if (!tls1_ec_group_id2bits(group_id, &bits))
		return 0;
	if (!tls1_ec_group_id2nid(group_id, &nid))
		return 0;

	if (!CBB_init_fixed(&cbb, group, sizeof(group)))
		return 0;
	if (!CBB_add_u16(&cbb, group_id))
		return 0;
	if (!CBB_finish(&cbb, NULL, NULL))
		return 0;

	return ssl_security(ssl, secop, bits, nid, group);
}

int
ssl_security_shared_group(const SSL *ssl, uint16_t group_id)
{
	return ssl_security_group(ssl, group_id, SSL_SECOP_CURVE_SHARED);
}

int
ssl_security_supported_group(const SSL *ssl, uint16_t group_id)
{
	return ssl_security_group(ssl, group_id, SSL_SECOP_CURVE_SUPPORTED);
}
Changes to jni/libressl/ssl/ssl_sess.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_sess.c,v 1.109 2022/01/11 19:03:15 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_sess.c,v 1.117 2022/08/17 07:39:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
220
221
222
223
224
225
226
227
228
229
230
231


232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
	if ((ss = calloc(1, sizeof(*ss))) == NULL) {
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		return (NULL);
	}

	ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */
	ss->references = 1;
	ss->timeout=60*5+4; /* 5 minute timeout by default */
	ss->time = time(NULL);
	ss->prev = NULL;
	ss->next = NULL;
	ss->tlsext_hostname = NULL;



	ss->tlsext_ecpointformatlist_length = 0;
	ss->tlsext_ecpointformatlist = NULL;
	ss->tlsext_supportedgroups_length = 0;
	ss->tlsext_supportedgroups = NULL;

	CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);

	return (ss);
}

const unsigned char *
SSL_SESSION_get_id(const SSL_SESSION *ss, unsigned int *len)
{
	if (len != NULL)
		*len = ss->session_id_length;
	return ss->session_id;
}

const unsigned char *
SSL_SESSION_get0_id_context(const SSL_SESSION *ss, unsigned int *len)
{
	if (len != NULL)







|




>
>















|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
	if ((ss = calloc(1, sizeof(*ss))) == NULL) {
		SSLerrorx(ERR_R_MALLOC_FAILURE);
		return (NULL);
	}

	ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */
	ss->references = 1;
	ss->timeout = 60 * 5 + 4; /* 5 minutes 4 seconds timeout by default */
	ss->time = time(NULL);
	ss->prev = NULL;
	ss->next = NULL;
	ss->tlsext_hostname = NULL;

	ss->peer_cert_type = -1;

	ss->tlsext_ecpointformatlist_length = 0;
	ss->tlsext_ecpointformatlist = NULL;
	ss->tlsext_supportedgroups_length = 0;
	ss->tlsext_supportedgroups = NULL;

	CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);

	return (ss);
}

const unsigned char *
SSL_SESSION_get_id(const SSL_SESSION *ss, unsigned int *len)
{
	if (len != NULL)
		*len = (unsigned int)ss->session_id_length;
	return ss->session_id;
}

const unsigned char *
SSL_SESSION_get0_id_context(const SSL_SESSION *ss, unsigned int *len)
{
	if (len != NULL)
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
			return (0);
		}

		/*
		 * Don't allow the callback to set the session length to zero.
		 * nor set it higher than it was.
		 */
		if (!tmp || (tmp > ss->session_id_length)) {
			/* The callback set an illegal length */
			SSLerror(s, SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH);
			SSL_SESSION_free(ss);
			return (0);
		}
		ss->session_id_length = tmp;

		/* Finally, check for a conflict. */
		if (SSL_has_matching_session_id(s, ss->session_id,
			ss->session_id_length)) {
			SSLerror(s, SSL_R_SSL_SESSION_ID_CONFLICT);
			SSL_SESSION_free(ss);
			return (0);
		}

 sess_id_done:
		if (s->tlsext_hostname) {







|









|







376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
			return (0);
		}

		/*
		 * Don't allow the callback to set the session length to zero.
		 * nor set it higher than it was.
		 */
		if (tmp == 0 || tmp > ss->session_id_length) {
			/* The callback set an illegal length */
			SSLerror(s, SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH);
			SSL_SESSION_free(ss);
			return (0);
		}
		ss->session_id_length = tmp;

		/* Finally, check for a conflict. */
		if (SSL_has_matching_session_id(s, ss->session_id,
		    ss->session_id_length)) {
			SSLerror(s, SSL_R_SSL_SESSION_ID_CONFLICT);
			SSL_SESSION_free(ss);
			return (0);
		}

 sess_id_done:
		if (s->tlsext_hostname) {
431
432
433
434
435
436
437
438
439


440
441
442
443
444
445
446
	if ((s->session_ctx->internal->session_cache_mode &
	     SSL_SESS_CACHE_NO_INTERNAL_LOOKUP))
		return NULL;

	memset(&data, 0, sizeof(data));

	data.ssl_version = s->version;
	data.session_id_length = CBS_len(session_id);
	memcpy(data.session_id, CBS_data(session_id), CBS_len(session_id));



	CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);
	sess = lh_SSL_SESSION_retrieve(s->session_ctx->internal->sessions, &data);
	if (sess != NULL)
		CRYPTO_add(&sess->references, 1, CRYPTO_LOCK_SSL_SESSION);
	CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);








|
|
>
>







433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
	if ((s->session_ctx->internal->session_cache_mode &
	     SSL_SESS_CACHE_NO_INTERNAL_LOOKUP))
		return NULL;

	memset(&data, 0, sizeof(data));

	data.ssl_version = s->version;

	if (!CBS_write_bytes(session_id, data.session_id,
	    sizeof(data.session_id), &data.session_id_length))
		return NULL;

	CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);
	sess = lh_SSL_SESSION_retrieve(s->session_ctx->internal->sessions, &data);
	if (sess != NULL)
		CRYPTO_add(&sess->references, 1, CRYPTO_LOCK_SSL_SESSION);
	CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);

522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
 *   - For both new and resumed sessions, s->internal->tlsext_ticket_expected
 *     indicates whether the server should issue a new session ticket or not.
 */
int
ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block, int *alert)
{
	SSL_SESSION *sess = NULL;
	size_t session_id_len;
	int alert_desc = SSL_AD_INTERNAL_ERROR, fatal = 0;
	int ticket_decrypted = 0;

	/* This is used only by servers. */

	if (CBS_len(session_id) > SSL_MAX_SSL_SESSION_ID_LENGTH)
		goto err;







<







526
527
528
529
530
531
532

533
534
535
536
537
538
539
 *   - For both new and resumed sessions, s->internal->tlsext_ticket_expected
 *     indicates whether the server should issue a new session ticket or not.
 */
int
ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block, int *alert)
{
	SSL_SESSION *sess = NULL;

	int alert_desc = SSL_AD_INTERNAL_ERROR, fatal = 0;
	int ticket_decrypted = 0;

	/* This is used only by servers. */

	if (CBS_len(session_id) > SSL_MAX_SSL_SESSION_ID_LENGTH)
		goto err;
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
		ticket_decrypted = 1;

		/*
		 * The session ID is used by some clients to detect that the
		 * ticket has been accepted so we copy it into sess.
		 */
		if (!CBS_write_bytes(session_id, sess->session_id,
		    sizeof(sess->session_id), &session_id_len)) {
			fatal = 1;
			goto err;
		}
		sess->session_id_length = (unsigned int)session_id_len;
		break;
	default:
		SSLerror(s, ERR_R_INTERNAL_ERROR);
		fatal = 1;
		goto err;
	}








|



<







554
555
556
557
558
559
560
561
562
563
564

565
566
567
568
569
570
571
		ticket_decrypted = 1;

		/*
		 * The session ID is used by some clients to detect that the
		 * ticket has been accepted so we copy it into sess.
		 */
		if (!CBS_write_bytes(session_id, sess->session_id,
		    sizeof(sess->session_id), &sess->session_id_length)) {
			fatal = 1;
			goto err;
		}

		break;
	default:
		SSLerror(s, ERR_R_INTERNAL_ERROR);
		fatal = 1;
		goto err;
	}

717
718
719
720
721
722
723
724


725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771

static int
remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
{
	SSL_SESSION *r;
	int ret = 0;

	if ((c != NULL) && (c->session_id_length != 0)) {


		if (lck)
			CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
		if ((r = lh_SSL_SESSION_retrieve(ctx->internal->sessions, c)) == c) {
			ret = 1;
			r = lh_SSL_SESSION_delete(ctx->internal->sessions, c);
			SSL_SESSION_list_remove(ctx, c);
		}
		if (lck)
			CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);

		if (ret) {
			r->not_resumable = 1;
			if (ctx->internal->remove_session_cb != NULL)
				ctx->internal->remove_session_cb(ctx, r);
			SSL_SESSION_free(r);
		}
	} else
		ret = 0;
	return (ret);
}

void
SSL_SESSION_free(SSL_SESSION *ss)
{
	int i;

	if (ss == NULL)
		return;

	i = CRYPTO_add(&ss->references, -1, CRYPTO_LOCK_SSL_SESSION);
	if (i > 0)
		return;

	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);

	explicit_bzero(ss->master_key, sizeof ss->master_key);
	explicit_bzero(ss->session_id, sizeof ss->session_id);

	sk_X509_pop_free(ss->cert_chain, X509_free);

	X509_free(ss->peer_cert);

	sk_SSL_CIPHER_free(ss->ciphers);

	free(ss->tlsext_hostname);
	free(ss->tlsext_tick);
	free(ss->tlsext_ecpointformatlist);







|
>
>
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
<
|



















<
<







719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745

746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765


766
767
768
769
770
771
772

static int
remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
{
	SSL_SESSION *r;
	int ret = 0;

	if (c == NULL || c->session_id_length == 0)
		return 0;

	if (lck)
		CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
	if ((r = lh_SSL_SESSION_retrieve(ctx->internal->sessions, c)) == c) {
		ret = 1;
		r = lh_SSL_SESSION_delete(ctx->internal->sessions, c);
		SSL_SESSION_list_remove(ctx, c);
	}
	if (lck)
		CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);

	if (ret) {
		r->not_resumable = 1;
		if (ctx->internal->remove_session_cb != NULL)
			ctx->internal->remove_session_cb(ctx, r);
		SSL_SESSION_free(r);
	}


	return ret;
}

void
SSL_SESSION_free(SSL_SESSION *ss)
{
	int i;

	if (ss == NULL)
		return;

	i = CRYPTO_add(&ss->references, -1, CRYPTO_LOCK_SSL_SESSION);
	if (i > 0)
		return;

	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);

	explicit_bzero(ss->master_key, sizeof ss->master_key);
	explicit_bzero(ss->session_id, sizeof ss->session_id);



	X509_free(ss->peer_cert);

	sk_SSL_CIPHER_free(ss->ciphers);

	free(ss->tlsext_hostname);
	free(ss->tlsext_tick);
	free(ss->tlsext_ecpointformatlist);
Changes to jni/libressl/ssl/ssl_sigalgs.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_sigalgs.c,v 1.41 2022/02/05 14:54:10 jsing Exp $ */
/*
 * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org>
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_sigalgs.c,v 1.47 2022/07/02 16:31:04 tb Exp $ */
/*
 * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org>
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
28
29
30
31
32
33
34

35
36
37
38
39

40
41
42
43
44
45
46

47
48
49
50
51
52

53
54
55
56
57

58
59
60
61
62
63

64
65
66
67
68

69
70
71
72
73
74
75

76
77
78
79
80

81
82
83
84
85
86

87
88
89
90
91
92

93
94
95
96
97
98

99
100
101
102
103
104

105
106
107
108
109
110

111
112
113
114
115
116

117
118
119
120
121
122

123
124
125
126
127

128
129
130
131
132

133
134
135
136
137

138
139
140
141
142

143
144
145
146
147
148
149
#include "tls13_internal.h"

const struct ssl_sigalg sigalgs[] = {
	{
		.value = SIGALG_RSA_PKCS1_SHA512,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha512,

	},
	{
		.value = SIGALG_ECDSA_SECP521R1_SHA512,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha512,

		.curve_nid = NID_secp521r1,
	},
#ifndef OPENSSL_NO_GOST
	{
		.value = SIGALG_GOSTR12_512_STREEBOG_512,
		.key_type = EVP_PKEY_GOSTR12_512,
		.md = EVP_streebog512,

	},
#endif
	{
		.value = SIGALG_RSA_PKCS1_SHA384,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha384,

	},
	{
		.value = SIGALG_ECDSA_SECP384R1_SHA384,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha384,

		.curve_nid = NID_secp384r1,
	},
	{
		.value = SIGALG_RSA_PKCS1_SHA256,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha256,

	},
	{
		.value = SIGALG_ECDSA_SECP256R1_SHA256,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha256,

		.curve_nid = NID_X9_62_prime256v1,
	},
#ifndef OPENSSL_NO_GOST
	{
		.value = SIGALG_GOSTR12_256_STREEBOG_256,
		.key_type = EVP_PKEY_GOSTR12_256,
		.md = EVP_streebog256,

	},
	{
		.value = SIGALG_GOSTR01_GOST94,
		.key_type = EVP_PKEY_GOSTR01,
		.md = EVP_gostr341194,

	},
#endif
	{
		.value = SIGALG_RSA_PSS_RSAE_SHA256,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha256,

		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_RSAE_SHA384,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha384,

		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_RSAE_SHA512,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha512,

		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_PSS_SHA256,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha256,

		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_PSS_SHA384,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha384,

		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_PSS_SHA512,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha512,

		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PKCS1_SHA224,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha224,

	},
	{
		.value = SIGALG_ECDSA_SECP224R1_SHA224,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha224,

	},
	{
		.value = SIGALG_RSA_PKCS1_SHA1,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha1,

	},
	{
		.value = SIGALG_ECDSA_SHA1,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha1,

	},
	{
		.value = SIGALG_RSA_PKCS1_MD5_SHA1,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_md5_sha1,

	},
	{
		.value = SIGALG_NONE,
	},
};

/* Sigalgs for TLSv1.3, in preference order. */







>





>
|






>






>





>
|





>





>
|






>





>






>






>






>






>






>






>






>





>





>





>





>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include "tls13_internal.h"

const struct ssl_sigalg sigalgs[] = {
	{
		.value = SIGALG_RSA_PKCS1_SHA512,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha512,
		.security_level = 5,
	},
	{
		.value = SIGALG_ECDSA_SECP521R1_SHA512,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha512,
		.security_level = 5,
		.group_nid = NID_secp521r1,
	},
#ifndef OPENSSL_NO_GOST
	{
		.value = SIGALG_GOSTR12_512_STREEBOG_512,
		.key_type = EVP_PKEY_GOSTR12_512,
		.md = EVP_streebog512,
		.security_level = 0,
	},
#endif
	{
		.value = SIGALG_RSA_PKCS1_SHA384,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha384,
		.security_level = 4,
	},
	{
		.value = SIGALG_ECDSA_SECP384R1_SHA384,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha384,
		.security_level = 4,
		.group_nid = NID_secp384r1,
	},
	{
		.value = SIGALG_RSA_PKCS1_SHA256,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha256,
		.security_level = 3,
	},
	{
		.value = SIGALG_ECDSA_SECP256R1_SHA256,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha256,
		.security_level = 3,
		.group_nid = NID_X9_62_prime256v1,
	},
#ifndef OPENSSL_NO_GOST
	{
		.value = SIGALG_GOSTR12_256_STREEBOG_256,
		.key_type = EVP_PKEY_GOSTR12_256,
		.md = EVP_streebog256,
		.security_level = 0,
	},
	{
		.value = SIGALG_GOSTR01_GOST94,
		.key_type = EVP_PKEY_GOSTR01,
		.md = EVP_gostr341194,
		.security_level = 0, /* XXX */
	},
#endif
	{
		.value = SIGALG_RSA_PSS_RSAE_SHA256,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha256,
		.security_level = 3,
		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_RSAE_SHA384,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha384,
		.security_level = 4,
		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_RSAE_SHA512,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha512,
		.security_level = 5,
		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_PSS_SHA256,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha256,
		.security_level = 3,
		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_PSS_SHA384,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha384,
		.security_level = 4,
		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PSS_PSS_SHA512,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha512,
		.security_level = 5,
		.flags = SIGALG_FLAG_RSA_PSS,
	},
	{
		.value = SIGALG_RSA_PKCS1_SHA224,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha224,
		.security_level = 2,
	},
	{
		.value = SIGALG_ECDSA_SECP224R1_SHA224,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha224,
		.security_level = 2,
	},
	{
		.value = SIGALG_RSA_PKCS1_SHA1,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_sha1,
		.security_level = 1,
	},
	{
		.value = SIGALG_ECDSA_SHA1,
		.key_type = EVP_PKEY_EC,
		.md = EVP_sha1,
		.security_level = 1,
	},
	{
		.value = SIGALG_RSA_PKCS1_MD5_SHA1,
		.key_type = EVP_PKEY_RSA,
		.md = EVP_md5_sha1,
		.security_level = 1,
	},
	{
		.value = SIGALG_NONE,
	},
};

/* Sigalgs for TLSv1.3, in preference order. */
217
218
219
220
221
222
223
224
225

226
227
228

229
230
231
232
233
234
235
236
237
238



239
240
241


242
243
244
245
246
247



248
249
250
251
252
253
254
			return ssl_sigalg_lookup(value);
	}

	return NULL;
}

int
ssl_sigalgs_build(uint16_t tls_version, CBB *cbb)
{

	const uint16_t *values;
	size_t len;
	size_t i;


	ssl_sigalgs_for_version(tls_version, &values, &len);

	/* Add values in order as long as they are supported. */
	for (i = 0; i < len; i++) {
		/* Do not allow the legacy value for < 1.2 to be used. */
		if (values[i] == SIGALG_RSA_PKCS1_MD5_SHA1)
			return 0;
		if (ssl_sigalg_lookup(values[i]) == NULL)
			return 0;



		if (!CBB_add_u16(cbb, values[i]))
			return 0;
	}


	return 1;
}

static const struct ssl_sigalg *
ssl_sigalg_for_legacy(SSL *s, EVP_PKEY *pkey)
{



	/* Default signature algorithms used for TLSv1.2 and earlier. */
	switch (EVP_PKEY_id(pkey)) {
	case EVP_PKEY_RSA:
		if (s->s3->hs.negotiated_tls_version < TLS1_2_VERSION)
			return ssl_sigalg_lookup(SIGALG_RSA_PKCS1_MD5_SHA1);
		return ssl_sigalg_lookup(SIGALG_RSA_PKCS1_SHA1);
	case EVP_PKEY_EC:







|

>



>








|

>
>
>


|
>
>
|





>
>
>







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
			return ssl_sigalg_lookup(value);
	}

	return NULL;
}

int
ssl_sigalgs_build(uint16_t tls_version, CBB *cbb, int security_level)
{
	const struct ssl_sigalg *sigalg;
	const uint16_t *values;
	size_t len;
	size_t i;
	int ret = 0;

	ssl_sigalgs_for_version(tls_version, &values, &len);

	/* Add values in order as long as they are supported. */
	for (i = 0; i < len; i++) {
		/* Do not allow the legacy value for < 1.2 to be used. */
		if (values[i] == SIGALG_RSA_PKCS1_MD5_SHA1)
			return 0;
		if ((sigalg = ssl_sigalg_lookup(values[i])) == NULL)
			return 0;
		if (sigalg->security_level < security_level)
			continue;

		if (!CBB_add_u16(cbb, values[i]))
			return 0;

		ret = 1;
	}
	return ret;
}

static const struct ssl_sigalg *
ssl_sigalg_for_legacy(SSL *s, EVP_PKEY *pkey)
{
	if (SSL_get_security_level(s) > 1)
		return NULL;

	/* Default signature algorithms used for TLSv1.2 and earlier. */
	switch (EVP_PKEY_id(pkey)) {
	case EVP_PKEY_RSA:
		if (s->s3->hs.negotiated_tls_version < TLS1_2_VERSION)
			return ssl_sigalg_lookup(SIGALG_RSA_PKCS1_MD5_SHA1);
		return ssl_sigalg_lookup(SIGALG_RSA_PKCS1_SHA1);
	case EVP_PKEY_EC:
272
273
274
275
276
277
278



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300

	/* RSA PSS must have a sufficiently large RSA key. */
	if ((sigalg->flags & SIGALG_FLAG_RSA_PSS)) {
		if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA ||
		    EVP_PKEY_size(pkey) < (2 * EVP_MD_size(sigalg->md()) + 2))
			return 0;
	}




	if (s->s3->hs.negotiated_tls_version < TLS1_3_VERSION)
		return 1;

	/* RSA cannot be used without PSS in TLSv1.3. */
	if (sigalg->key_type == EVP_PKEY_RSA &&
	    (sigalg->flags & SIGALG_FLAG_RSA_PSS) == 0)
		return 0;

	/* Ensure that curve matches for EC keys. */
	if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) {
		if (sigalg->curve_nid == 0)
			return 0;
		if (EC_GROUP_get_curve_name(EC_KEY_get0_group(
		    EVP_PKEY_get0_EC_KEY(pkey))) != sigalg->curve_nid)
			return 0;
	}

	return 1;
}

const struct ssl_sigalg *







>
>
>









|

|


|







302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

	/* RSA PSS must have a sufficiently large RSA key. */
	if ((sigalg->flags & SIGALG_FLAG_RSA_PSS)) {
		if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA ||
		    EVP_PKEY_size(pkey) < (2 * EVP_MD_size(sigalg->md()) + 2))
			return 0;
	}

	if (!ssl_security_sigalg_check(s, pkey))
		return 0;

	if (s->s3->hs.negotiated_tls_version < TLS1_3_VERSION)
		return 1;

	/* RSA cannot be used without PSS in TLSv1.3. */
	if (sigalg->key_type == EVP_PKEY_RSA &&
	    (sigalg->flags & SIGALG_FLAG_RSA_PSS) == 0)
		return 0;

	/* Ensure that group matches for EC keys. */
	if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) {
		if (sigalg->group_nid == 0)
			return 0;
		if (EC_GROUP_get_curve_name(EC_KEY_get0_group(
		    EVP_PKEY_get0_EC_KEY(pkey))) != sigalg->group_nid)
			return 0;
	}

	return 1;
}

const struct ssl_sigalg *
Changes to jni/libressl/ssl/ssl_sigalgs.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_sigalgs.h,v 1.23 2021/06/29 19:25:59 jsing Exp $ */
/*
 * Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_sigalgs.h,v 1.26 2022/07/02 16:00:12 tb Exp $ */
/*
 * Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76
77
78

#define SIGALG_FLAG_RSA_PSS	0x00000001

struct ssl_sigalg {
	uint16_t value;
	int key_type;
	const EVP_MD *(*md)(void);

	int curve_nid;
	int flags;
};

int ssl_sigalgs_build(uint16_t tls_version, CBB *cbb);
const struct ssl_sigalg *ssl_sigalg_select(SSL *s, EVP_PKEY *pkey);
const struct ssl_sigalg *ssl_sigalg_for_peer(SSL *s, EVP_PKEY *pkey,
    uint16_t sigalg_value);

__END_HIDDEN_DECLS

#endif







>
|



|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

#define SIGALG_FLAG_RSA_PSS	0x00000001

struct ssl_sigalg {
	uint16_t value;
	int key_type;
	const EVP_MD *(*md)(void);
	int security_level;
	int group_nid;
	int flags;
};

int ssl_sigalgs_build(uint16_t tls_version, CBB *cbb, int security_level);
const struct ssl_sigalg *ssl_sigalg_select(SSL *s, EVP_PKEY *pkey);
const struct ssl_sigalg *ssl_sigalg_for_peer(SSL *s, EVP_PKEY *pkey,
    uint16_t sigalg_value);

__END_HIDDEN_DECLS

#endif
Changes to jni/libressl/ssl/ssl_srvr.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_srvr.c,v 1.141 2022/02/05 14:54:10 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_srvr.c,v 1.149 2022/08/17 07:39:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
218
219
220
221
222
223
224







225
226
227
228
229
230
231
			if (!ssl_supported_tls_version_range(s,
			    &s->s3->hs.our_min_tls_version,
			    &s->s3->hs.our_max_tls_version)) {
				SSLerror(s, SSL_R_NO_PROTOCOLS_AVAILABLE);
				ret = -1;
				goto end;
			}








			if (!ssl3_setup_init_buffer(s)) {
				ret = -1;
				goto end;
			}
			if (!ssl3_setup_buffers(s)) {
				ret = -1;







>
>
>
>
>
>
>







218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
			if (!ssl_supported_tls_version_range(s,
			    &s->s3->hs.our_min_tls_version,
			    &s->s3->hs.our_max_tls_version)) {
				SSLerror(s, SSL_R_NO_PROTOCOLS_AVAILABLE);
				ret = -1;
				goto end;
			}

			if (!ssl_security_version(s,
			    s->s3->hs.our_min_tls_version)) {
				SSLerror(s, SSL_R_VERSION_TOO_LOW);
				ret = -1;
				goto end;
			}

			if (!ssl3_setup_init_buffer(s)) {
				ret = -1;
				goto end;
			}
			if (!ssl3_setup_buffers(s)) {
				ret = -1;
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
			}
			s->internal->rwstate = SSL_NOTHING;
			s->s3->hs.state = s->s3->hs.tls12.next_state;
			break;

		case SSL3_ST_SR_CERT_A:
		case SSL3_ST_SR_CERT_B:
			if (s->s3->hs.tls12.cert_request) {
				ret = ssl3_get_client_certificate(s);
				if (ret <= 0)
					goto end;
			}
			s->internal->init_num = 0;
			s->s3->hs.state = SSL3_ST_SR_KEY_EXCH_A;
			break;







|







521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
			}
			s->internal->rwstate = SSL_NOTHING;
			s->s3->hs.state = s->s3->hs.tls12.next_state;
			break;

		case SSL3_ST_SR_CERT_A:
		case SSL3_ST_SR_CERT_B:
			if (s->s3->hs.tls12.cert_request != 0) {
				ret = ssl3_get_client_certificate(s);
				if (ret <= 0)
					goto end;
			}
			s->internal->init_num = 0;
			s->s3->hs.state = SSL3_ST_SR_KEY_EXCH_A;
			break;
1051
1052
1053
1054
1055
1056
1057
1058
1059

1060
1061
1062
1063
1064









1065
1066
1067
1068


1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100


1101

1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
		} else {
			/* Indicate we chose to downgrade to 1.1 or lower */
			memcpy(magic, tls13_downgrade_11,
			    sizeof(tls13_downgrade_11));
		}
	}

	if (!s->internal->hit && s->internal->tls_session_secret_cb) {
		SSL_CIPHER *pref_cipher = NULL;


		s->session->master_key_length = sizeof(s->session->master_key);
		if (s->internal->tls_session_secret_cb(s, s->session->master_key,
		    &s->session->master_key_length, ciphers, &pref_cipher,
		    s->internal->tls_session_secret_cb_arg)) {









			s->internal->hit = 1;
			s->session->ciphers = ciphers;
			s->session->verify_result = X509_V_OK;



			ciphers = NULL;

			/* check if some cipher was preferred by call back */
			pref_cipher = pref_cipher ? pref_cipher :
			    ssl3_choose_cipher(s, s->session->ciphers,
			    SSL_get_ciphers(s));
			if (pref_cipher == NULL) {
				al = SSL_AD_HANDSHAKE_FAILURE;
				SSLerror(s, SSL_R_NO_SHARED_CIPHER);
				goto fatal_err;
			}

			s->session->cipher = pref_cipher;

			sk_SSL_CIPHER_free(s->cipher_list);
			s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers);
		}
	}

	/*
	 * Given s->session->ciphers and SSL_get_ciphers, we must
	 * pick a cipher
	 */

	if (!s->internal->hit) {
		sk_SSL_CIPHER_free(s->session->ciphers);
		s->session->ciphers = ciphers;
		if (ciphers == NULL) {
			al = SSL_AD_ILLEGAL_PARAMETER;
			SSLerror(s, SSL_R_NO_CIPHERS_PASSED);
			goto fatal_err;
		}


		ciphers = NULL;

		c = ssl3_choose_cipher(s, s->session->ciphers,
		SSL_get_ciphers(s));

		if (c == NULL) {
			al = SSL_AD_HANDSHAKE_FAILURE;
			SSLerror(s, SSL_R_NO_SHARED_CIPHER);
			goto fatal_err;
		}
		s->s3->hs.cipher = c;
	} else {
		s->s3->hs.cipher = s->session->cipher;







|

>

<
|
|
|
>
>
>
>
>
>
>
>
>
|
<
|

>
>
|

|
|
|

|
|
|
|
|
<
|

|
|
<








<
<





>
>

>
|
|
<
<







1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068

1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081

1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096

1097
1098
1099
1100

1101
1102
1103
1104
1105
1106
1107
1108


1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119


1120
1121
1122
1123
1124
1125
1126
		} else {
			/* Indicate we chose to downgrade to 1.1 or lower */
			memcpy(magic, tls13_downgrade_11,
			    sizeof(tls13_downgrade_11));
		}
	}

	if (!s->internal->hit && s->internal->tls_session_secret_cb != NULL) {
		SSL_CIPHER *pref_cipher = NULL;
		int master_key_length = sizeof(s->session->master_key);


		if (!s->internal->tls_session_secret_cb(s,
		    s->session->master_key, &master_key_length, ciphers,
		    &pref_cipher, s->internal->tls_session_secret_cb_arg)) {
			SSLerror(s, ERR_R_INTERNAL_ERROR);
			goto err;
		}
		if (master_key_length <= 0) {
			SSLerror(s, ERR_R_INTERNAL_ERROR);
			goto err;
		}
		s->session->master_key_length = master_key_length;

		s->internal->hit = 1;

		s->session->verify_result = X509_V_OK;

		sk_SSL_CIPHER_free(s->session->ciphers);
		s->session->ciphers = ciphers;
		ciphers = NULL;

		/* Check if some cipher was preferred by the callback. */
		if (pref_cipher == NULL)
			pref_cipher = ssl3_choose_cipher(s, s->session->ciphers,
			    SSL_get_ciphers(s));
		if (pref_cipher == NULL) {
			al = SSL_AD_HANDSHAKE_FAILURE;
			SSLerror(s, SSL_R_NO_SHARED_CIPHER);
			goto fatal_err;
		}

		s->session->cipher = pref_cipher;

		sk_SSL_CIPHER_free(s->cipher_list);
		s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers);

	}

	/*
	 * Given s->session->ciphers and SSL_get_ciphers, we must
	 * pick a cipher
	 */

	if (!s->internal->hit) {


		if (ciphers == NULL) {
			al = SSL_AD_ILLEGAL_PARAMETER;
			SSLerror(s, SSL_R_NO_CIPHERS_PASSED);
			goto fatal_err;
		}
		sk_SSL_CIPHER_free(s->session->ciphers);
		s->session->ciphers = ciphers;
		ciphers = NULL;

		if ((c = ssl3_choose_cipher(s, s->session->ciphers,
		    SSL_get_ciphers(s))) == NULL) {


			al = SSL_AD_HANDSHAKE_FAILURE;
			SSLerror(s, SSL_R_NO_SHARED_CIPHER);
			goto fatal_err;
		}
		s->s3->hs.cipher = c;
	} else {
		s->s3->hs.cipher = s->session->cipher;
1343
1344
1345
1346
1347
1348
1349






1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
	if (!tls_key_share_generate(s->s3->hs.key_share))
		goto err;

	if (!tls_key_share_params(s->s3->hs.key_share, cbb))
		goto err;
	if (!tls_key_share_public(s->s3->hs.key_share, cbb))
		goto err;







	return 1;

 err:
	return 0;
}

static int
ssl3_send_server_kex_ecdhe(SSL *s, CBB *cbb)
{
	CBB public;
	int nid;

	if ((nid = tls1_get_shared_curve(s)) == NID_undef) {
		SSLerror(s, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
		goto err;
	}

	tls_key_share_free(s->s3->hs.key_share);
	if ((s->s3->hs.key_share = tls_key_share_new_nid(nid)) == NULL)







>
>
>
>
>
>













|







1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
	if (!tls_key_share_generate(s->s3->hs.key_share))
		goto err;

	if (!tls_key_share_params(s->s3->hs.key_share, cbb))
		goto err;
	if (!tls_key_share_public(s->s3->hs.key_share, cbb))
		goto err;

	if (!tls_key_share_peer_security(s, s->s3->hs.key_share)) {
		SSLerror(s, SSL_R_DH_KEY_TOO_SMALL);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
		return 0;
	}

	return 1;

 err:
	return 0;
}

static int
ssl3_send_server_kex_ecdhe(SSL *s, CBB *cbb)
{
	CBB public;
	int nid;

	if (!tls1_get_supported_group(s, &nid)) {
		SSLerror(s, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE);
		ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
		goto err;
	}

	tls_key_share_free(s->s3->hs.key_share);
	if ((s->s3->hs.key_share = tls_key_share_new_nid(nid)) == NULL)
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
		if (!ssl3_get_req_cert_types(s, &cert_types))
			goto err;

		if (SSL_USE_SIGALGS(s)) {
			if (!CBB_add_u16_length_prefixed(&cert_request,
			    &sigalgs))
				goto err;
			if (!ssl_sigalgs_build(
			    s->s3->hs.negotiated_tls_version, &sigalgs))
				goto err;
		}

		if (!CBB_add_u16_length_prefixed(&cert_request, &cert_auth))
			goto err;

		sk = SSL_get_client_CA_list(s);







|
|







1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
		if (!ssl3_get_req_cert_types(s, &cert_types))
			goto err;

		if (SSL_USE_SIGALGS(s)) {
			if (!CBB_add_u16_length_prefixed(&cert_request,
			    &sigalgs))
				goto err;
			if (!ssl_sigalgs_build(s->s3->hs.negotiated_tls_version,
			    &sigalgs, SSL_get_security_level(s)))
				goto err;
		}

		if (!CBB_add_u16_length_prefixed(&cert_request, &cert_auth))
			goto err;

		sk = SSL_get_client_CA_list(s);
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142


2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157

2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188

2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221

2222

2223

2224
2225
2226
2227
2228
2229
2230
2231
2232

2233
2234
2235
2236
2237
2238
2239







2240
2241

2242


2243
2244
2245

2246
2247
2248
2249
2250


2251
2252

2253




2254
2255
2256
2257
2258
2259
2260
2261
2262

2263
2264
2265
2266
2267
2268
2269
2270
2271

	return (ret);
}

int
ssl3_get_client_certificate(SSL *s)
{
	CBS cbs, client_certs;
	X509 *x = NULL;
	const unsigned char *q;
	STACK_OF(X509) *sk = NULL;


	int i, al, ret;

	if ((ret = ssl3_get_message(s, SSL3_ST_SR_CERT_A, SSL3_ST_SR_CERT_B,
	    -1, s->internal->max_cert_list)) <= 0)
		return ret;

	ret = -1;

	if (s->s3->hs.tls12.message_type == SSL3_MT_CLIENT_KEY_EXCHANGE) {
		if ((s->verify_mode & SSL_VERIFY_PEER) &&
		    (s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) {
			SSLerror(s, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);
			al = SSL_AD_HANDSHAKE_FAILURE;
			goto fatal_err;
		}

		/*
		 * If tls asked for a client cert,
		 * the client must return a 0 list.
		 */
		if (s->s3->hs.tls12.cert_request) {
			SSLerror(s, SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST
			    );
			al = SSL_AD_UNEXPECTED_MESSAGE;
			goto fatal_err;
		}
		s->s3->hs.tls12.reuse_message = 1;
		return (1);
	}

	if (s->s3->hs.tls12.message_type != SSL3_MT_CERTIFICATE) {
		al = SSL_AD_UNEXPECTED_MESSAGE;
		SSLerror(s, SSL_R_WRONG_MESSAGE_TYPE);
		goto fatal_err;
	}

	if (s->internal->init_num < 0)
		goto decode_err;

	CBS_init(&cbs, s->internal->init_msg, s->internal->init_num);

	if ((sk = sk_X509_new_null()) == NULL) {
		SSLerror(s, ERR_R_MALLOC_FAILURE);
		goto err;
	}

	if (!CBS_get_u24_length_prefixed(&cbs, &client_certs) ||

	    CBS_len(&cbs) != 0)
		goto decode_err;

	while (CBS_len(&client_certs) > 0) {
		CBS cert;

		if (!CBS_get_u24_length_prefixed(&client_certs, &cert)) {
			al = SSL_AD_DECODE_ERROR;
			SSLerror(s, SSL_R_CERT_LENGTH_MISMATCH);
			goto fatal_err;
		}

		q = CBS_data(&cert);
		x = d2i_X509(NULL, &q, CBS_len(&cert));
		if (x == NULL) {
			SSLerror(s, ERR_R_ASN1_LIB);
			goto err;
		}
		if (q != CBS_data(&cert) + CBS_len(&cert)) {
			al = SSL_AD_DECODE_ERROR;
			SSLerror(s, SSL_R_CERT_LENGTH_MISMATCH);
			goto fatal_err;
		}
		if (!sk_X509_push(sk, x)) {
			SSLerror(s, ERR_R_MALLOC_FAILURE);
			goto err;
		}
		x = NULL;
	}

	if (sk_X509_num(sk) <= 0) {
		/*
		 * TLS does not mind 0 certs returned.

		 * Fail for TLS only if we required a certificate.

		 */

		if ((s->verify_mode & SSL_VERIFY_PEER) &&
		    (s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) {
			SSLerror(s, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);
			al = SSL_AD_HANDSHAKE_FAILURE;
			goto fatal_err;
		}
		/* No client certificate so free transcript. */
		tls1_transcript_free(s);
	} else {

		i = ssl_verify_cert_chain(s, sk);
		if (i <= 0) {
			al = ssl_verify_alarm_type(s->verify_result);
			SSLerror(s, SSL_R_NO_CERTIFICATE_RETURNED);
			goto fatal_err;
		}
	}








	X509_free(s->session->peer_cert);

	s->session->peer_cert = sk_X509_shift(sk);



	/*
	 * Inconsistency alert: cert_chain does *not* include the

	 * peer's own certificate, while we do include it in s3_clnt.c
	 */
	sk_X509_pop_free(s->session->cert_chain, X509_free);
	s->session->cert_chain = sk;
	sk = NULL;



	s->session->verify_result = s->verify_result;






	ret = 1;
	if (0) {
 decode_err:
		al = SSL_AD_DECODE_ERROR;
		SSLerror(s, SSL_R_BAD_PACKET_LENGTH);
 fatal_err:
		ssl3_send_alert(s, SSL3_AL_FATAL, al);
	}
 err:

	X509_free(x);
	sk_X509_pop_free(sk, X509_free);

	return (ret);
}

int
ssl3_send_server_certificate(SSL *s)
{







|
<
<
|
>
>
|














>

|
|

|
|
<


















<
<
<
<
<
|
>
|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
>
|
>
|
>








|
>
|
|
<
|
|
|
|
>
>
>
>
>
>
>
|
|
>
|
>
>
|
<
|
>
|
<
<
|
|
>
>
|

>

>
>
>
>









>
|
<







2152
2153
2154
2155
2156
2157
2158
2159


2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184

2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202





2203
2204
2205
2206
2207




























2208

2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225

2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243

2244
2245
2246


2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269

2270
2271
2272
2273
2274
2275
2276

	return (ret);
}

int
ssl3_get_client_certificate(SSL *s)
{
	CBS cbs, cert_list, cert_data;


	STACK_OF(X509) *certs = NULL;
	X509 *cert = NULL;
	const uint8_t *p;
	int al, ret;

	if ((ret = ssl3_get_message(s, SSL3_ST_SR_CERT_A, SSL3_ST_SR_CERT_B,
	    -1, s->internal->max_cert_list)) <= 0)
		return ret;

	ret = -1;

	if (s->s3->hs.tls12.message_type == SSL3_MT_CLIENT_KEY_EXCHANGE) {
		if ((s->verify_mode & SSL_VERIFY_PEER) &&
		    (s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) {
			SSLerror(s, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);
			al = SSL_AD_HANDSHAKE_FAILURE;
			goto fatal_err;
		}

		/*
		 * If we asked for a client certificate and the client has none,
		 * it must respond with a certificate list of length zero.
		 */
		if (s->s3->hs.tls12.cert_request != 0) {
			SSLerror(s, SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST);

			al = SSL_AD_UNEXPECTED_MESSAGE;
			goto fatal_err;
		}
		s->s3->hs.tls12.reuse_message = 1;
		return (1);
	}

	if (s->s3->hs.tls12.message_type != SSL3_MT_CERTIFICATE) {
		al = SSL_AD_UNEXPECTED_MESSAGE;
		SSLerror(s, SSL_R_WRONG_MESSAGE_TYPE);
		goto fatal_err;
	}

	if (s->internal->init_num < 0)
		goto decode_err;

	CBS_init(&cbs, s->internal->init_msg, s->internal->init_num);






	if (!CBS_get_u24_length_prefixed(&cbs, &cert_list))
		goto decode_err;
	if (CBS_len(&cbs) != 0)
		goto decode_err;





























	/*

	 * A TLS client must send an empty certificate list, if no suitable
	 * certificate is available (rather than omitting the Certificate
	 * handshake message) - see RFC 5246 section 7.4.6.
	 */
	if (CBS_len(&cert_list) == 0) {
		if ((s->verify_mode & SSL_VERIFY_PEER) &&
		    (s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) {
			SSLerror(s, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);
			al = SSL_AD_HANDSHAKE_FAILURE;
			goto fatal_err;
		}
		/* No client certificate so free transcript. */
		tls1_transcript_free(s);
		goto done;
	}

	if ((certs = sk_X509_new_null()) == NULL) {

		SSLerror(s, ERR_R_MALLOC_FAILURE);
		goto err;
	}

	while (CBS_len(&cert_list) > 0) {
		if (!CBS_get_u24_length_prefixed(&cert_list, &cert_data))
			goto decode_err;
		p = CBS_data(&cert_data);
		if ((cert = d2i_X509(NULL, &p, CBS_len(&cert_data))) == NULL) {
			SSLerror(s, ERR_R_ASN1_LIB);
			goto err;
		}
		if (p != CBS_data(&cert_data) + CBS_len(&cert_data))
			goto decode_err;
		if (!sk_X509_push(certs, cert)) {
			SSLerror(s, ERR_R_MALLOC_FAILURE);
			goto err;
		}

		cert = NULL;
	}



	if (ssl_verify_cert_chain(s, certs) <= 0) {
		al = ssl_verify_alarm_type(s->verify_result);
		SSLerror(s, SSL_R_NO_CERTIFICATE_RETURNED);
		goto fatal_err;
	}
	s->session->verify_result = s->verify_result;
	ERR_clear_error();

	if (!tls_process_peer_certs(s, certs))
		goto err;

 done:
	ret = 1;
	if (0) {
 decode_err:
		al = SSL_AD_DECODE_ERROR;
		SSLerror(s, SSL_R_BAD_PACKET_LENGTH);
 fatal_err:
		ssl3_send_alert(s, SSL3_AL_FATAL, al);
	}
 err:
	sk_X509_pop_free(certs, X509_free);
	X509_free(cert);


	return (ret);
}

int
ssl3_send_server_certificate(SSL *s)
{
Changes to jni/libressl/ssl/ssl_tlsext.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_tlsext.c,v 1.110 2022/02/05 14:54:10 jsing Exp $ */
/*
 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_tlsext.c,v 1.129 2022/08/15 10:46:53 tb Exp $ */
/*
 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65





















66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218


219
220
221
222
223
224
225
226
227
228
229
230
231
232
233

234

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#include "ssl_sigalgs.h"
#include "ssl_tlsext.h"

/*
 * Supported Application-Layer Protocol Negotiation - RFC 7301
 */

int
tlsext_alpn_client_needs(SSL *s, uint16_t msg_type)
{
	/* ALPN protos have been specified and this is the initial handshake */
	return s->internal->alpn_client_proto_list != NULL &&
	    s->s3->hs.finished_len == 0;
}

int
tlsext_alpn_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB protolist;

	if (!CBB_add_u16_length_prefixed(cbb, &protolist))
		return 0;

	if (!CBB_add_bytes(&protolist, s->internal->alpn_client_proto_list,
	    s->internal->alpn_client_proto_list_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int





















tlsext_alpn_server_parse(SSL *s, uint16_t msg_types, CBS *cbs, int *alert)
{
	CBS proto_name_list, alpn;
	const unsigned char *selected;
	unsigned char selected_len;
	int r;

	if (!CBS_get_u16_length_prefixed(cbs, &alpn))
		goto err;
	if (CBS_len(&alpn) < 2)
		goto err;
	if (CBS_len(cbs) != 0)
		goto err;

	CBS_dup(&alpn, &proto_name_list);
	while (CBS_len(&proto_name_list) > 0) {
		CBS proto_name;

		if (!CBS_get_u8_length_prefixed(&proto_name_list, &proto_name))
			goto err;
		if (CBS_len(&proto_name) == 0)
			goto err;
	}

	if (s->ctx->internal->alpn_select_cb == NULL)
		return 1;

	/*
	 * XXX - A few things should be considered here:
	 * 1. Ensure that the same protocol is selected on session resumption.
	 * 2. Should the callback be called even if no ALPN extension was sent?
	 * 3. TLSv1.2 and earlier: ensure that SNI has already been processed.
	 */
	r = s->ctx->internal->alpn_select_cb(s, &selected, &selected_len,
	    CBS_data(&alpn), CBS_len(&alpn),
	    s->ctx->internal->alpn_select_cb_arg);

	if (r == SSL_TLSEXT_ERR_OK) {

		free(s->s3->alpn_selected);
		if ((s->s3->alpn_selected = malloc(selected_len)) == NULL) {
			s->s3->alpn_selected_len = 0;
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
		memcpy(s->s3->alpn_selected, selected, selected_len);
		s->s3->alpn_selected_len = selected_len;

		return 1;
	}

	/* On SSL_TLSEXT_ERR_NOACK behave as if no callback was present. */
	if (r == SSL_TLSEXT_ERR_NOACK)
		return 1;

	*alert = SSL_AD_NO_APPLICATION_PROTOCOL;
	SSLerror(s, SSL_R_NO_APPLICATION_PROTOCOL);

	return 0;

 err:
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

int
tlsext_alpn_server_needs(SSL *s, uint16_t msg_type)
{
	return s->s3->alpn_selected != NULL;
}

int
tlsext_alpn_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB list, selected;

	if (!CBB_add_u16_length_prefixed(cbb, &list))
		return 0;

	if (!CBB_add_u8_length_prefixed(&list, &selected))
		return 0;

	if (!CBB_add_bytes(&selected, s->s3->alpn_selected,
	    s->s3->alpn_selected_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_alpn_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS list, proto;

	if (s->internal->alpn_client_proto_list == NULL) {
		*alert = SSL_AD_UNSUPPORTED_EXTENSION;
		return 0;
	}

	if (!CBS_get_u16_length_prefixed(cbs, &list))
		goto err;
	if (CBS_len(cbs) != 0)
		goto err;

	if (!CBS_get_u8_length_prefixed(&list, &proto))
		goto err;

	if (CBS_len(&list) != 0)
		goto err;
	if (CBS_len(&proto) == 0)
		goto err;

	if (!CBS_stow(&proto, &(s->s3->alpn_selected),
	    &(s->s3->alpn_selected_len)))
		goto err;

	return 1;

 err:
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

/*
 * Supported Groups - RFC 7919 section 2
 */
int
tlsext_supportedgroups_client_needs(SSL *s, uint16_t msg_type)
{
	return ssl_has_ecc_ciphers(s) ||
	    (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
}

int
tlsext_supportedgroups_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	const uint16_t *groups;
	size_t groups_len;
	CBB grouplist;
	int i;

	tls1_get_group_list(s, 0, &groups, &groups_len);
	if (groups_len == 0) {
		SSLerror(s, ERR_R_INTERNAL_ERROR);
		return 0;
	}

	if (!CBB_add_u16_length_prefixed(cbb, &grouplist))
		return 0;

	for (i = 0; i < groups_len; i++) {


		if (!CBB_add_u16(&grouplist, groups[i]))
			return 0;
	}

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_supportedgroups_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	CBS grouplist;

	size_t groups_len;


	if (!CBS_get_u16_length_prefixed(cbs, &grouplist))
		goto err;
	if (CBS_len(cbs) != 0)
		goto err;

	groups_len = CBS_len(&grouplist);
	if (groups_len == 0 || groups_len % 2 != 0)
		goto err;
	groups_len /= 2;

	if (!s->internal->hit) {
		uint16_t *groups;
		int i;

		if (s->s3->hs.tls13.hrr) {
			if (s->session->tlsext_supportedgroups == NULL) {
				*alert = SSL_AD_HANDSHAKE_FAILURE;
				return 0;
			}

			/*
			 * In the case of TLSv1.3 the client cannot change
			 * the supported groups.
			 */
			if (groups_len != s->session->tlsext_supportedgroups_length) {
				*alert = SSL_AD_ILLEGAL_PARAMETER;
				return 0;
			}
			for (i = 0; i < groups_len; i++) {
				uint16_t group;

				if (!CBS_get_u16(&grouplist, &group))
					goto err;
				if (s->session->tlsext_supportedgroups[i] != group) {
					*alert = SSL_AD_ILLEGAL_PARAMETER;
					return 0;
				}
			}

			return 1;
		}

		if (s->session->tlsext_supportedgroups != NULL)
			goto err;

		if ((groups = reallocarray(NULL, groups_len,
		    sizeof(uint16_t))) == NULL) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}

		for (i = 0; i < groups_len; i++) {
			if (!CBS_get_u16(&grouplist, &groups[i])) {
				free(groups);
				goto err;
			}
		}

		if (CBS_len(&grouplist) != 0) {
			free(groups);
			goto err;
		}

		s->session->tlsext_supportedgroups = groups;
		s->session->tlsext_supportedgroups_length = groups_len;
	}

	return 1;

 err:
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

/* This extension is never used by the server. */
int
tlsext_supportedgroups_server_needs(SSL *s, uint16_t msg_type)
{
	return 0;
}

int
tlsext_supportedgroups_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return 0;
}

int
tlsext_supportedgroups_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	/*
	 * Servers should not send this extension per the RFC.
	 *
	 * However, certain F5 BIG-IP systems incorrectly send it. This bug is







|







|


















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|





<
<
<
|
<

|
<
<
|
<
<
<
<
<















>
|
|
|



<
<












|
<
<
<
|
<
|





|




















|










<
|
<


|


|

|

|
<
<
<
|

<
<
|





|






|

















>
>










|




>

>


<
|
<



|


|
<
|

|
|
|
|
|
>
|
|
|
|
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
|
|

|
|

|
<
|
|
|

|
|
|
|
|
|

|
|
|
|

|
|
|
<

<
<
<
<



|





|





|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94



95

96
97


98





99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120


121
122
123
124
125
126
127
128
129
130
131
132
133



134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

173

174
175
176
177
178
179
180
181
182
183



184
185


186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238

239

240
241
242
243
244
245
246

247
248
249
250
251
252
253
254
255
256
257
258



259











260
261
262
263
264
265
266

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285

286




287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#include "ssl_sigalgs.h"
#include "ssl_tlsext.h"

/*
 * Supported Application-Layer Protocol Negotiation - RFC 7301
 */

static int
tlsext_alpn_client_needs(SSL *s, uint16_t msg_type)
{
	/* ALPN protos have been specified and this is the initial handshake */
	return s->internal->alpn_client_proto_list != NULL &&
	    s->s3->hs.finished_len == 0;
}

static int
tlsext_alpn_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB protolist;

	if (!CBB_add_u16_length_prefixed(cbb, &protolist))
		return 0;

	if (!CBB_add_bytes(&protolist, s->internal->alpn_client_proto_list,
	    s->internal->alpn_client_proto_list_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_alpn_check_format(CBS *cbs)
{
	CBS proto_name_list;

	if (CBS_len(cbs) == 0)
		return 0;

	CBS_dup(cbs, &proto_name_list);
	while (CBS_len(&proto_name_list) > 0) {
		CBS proto_name;

		if (!CBS_get_u8_length_prefixed(&proto_name_list, &proto_name))
			return 0;
		if (CBS_len(&proto_name) == 0)
			return 0;
	}

	return 1;
}

static int
tlsext_alpn_server_parse(SSL *s, uint16_t msg_types, CBS *cbs, int *alert)
{
	CBS alpn, selected_cbs;
	const unsigned char *selected;
	unsigned char selected_len;
	int r;

	if (!CBS_get_u16_length_prefixed(cbs, &alpn))



		return 0;


	if (!tlsext_alpn_check_format(&alpn))


		return 0;






	if (s->ctx->internal->alpn_select_cb == NULL)
		return 1;

	/*
	 * XXX - A few things should be considered here:
	 * 1. Ensure that the same protocol is selected on session resumption.
	 * 2. Should the callback be called even if no ALPN extension was sent?
	 * 3. TLSv1.2 and earlier: ensure that SNI has already been processed.
	 */
	r = s->ctx->internal->alpn_select_cb(s, &selected, &selected_len,
	    CBS_data(&alpn), CBS_len(&alpn),
	    s->ctx->internal->alpn_select_cb_arg);

	if (r == SSL_TLSEXT_ERR_OK) {
		CBS_init(&selected_cbs, selected, selected_len);

		if (!CBS_stow(&selected_cbs, &s->s3->alpn_selected,
		    &s->s3->alpn_selected_len)) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}



		return 1;
	}

	/* On SSL_TLSEXT_ERR_NOACK behave as if no callback was present. */
	if (r == SSL_TLSEXT_ERR_NOACK)
		return 1;

	*alert = SSL_AD_NO_APPLICATION_PROTOCOL;
	SSLerror(s, SSL_R_NO_APPLICATION_PROTOCOL);

	return 0;
}





static int
tlsext_alpn_server_needs(SSL *s, uint16_t msg_type)
{
	return s->s3->alpn_selected != NULL;
}

static int
tlsext_alpn_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB list, selected;

	if (!CBB_add_u16_length_prefixed(cbb, &list))
		return 0;

	if (!CBB_add_u8_length_prefixed(&list, &selected))
		return 0;

	if (!CBB_add_bytes(&selected, s->s3->alpn_selected,
	    s->s3->alpn_selected_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_alpn_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS list, proto;

	if (s->internal->alpn_client_proto_list == NULL) {
		*alert = SSL_AD_UNSUPPORTED_EXTENSION;
		return 0;
	}

	if (!CBS_get_u16_length_prefixed(cbs, &list))

		return 0;


	if (!CBS_get_u8_length_prefixed(&list, &proto))
		return 0;

	if (CBS_len(&list) != 0)
		return 0;
	if (CBS_len(&proto) == 0)
		return 0;

	if (!CBS_stow(&proto, &s->s3->alpn_selected, &s->s3->alpn_selected_len))



		return 0;



	return 1;
}

/*
 * Supported Groups - RFC 7919 section 2
 */
static int
tlsext_supportedgroups_client_needs(SSL *s, uint16_t msg_type)
{
	return ssl_has_ecc_ciphers(s) ||
	    (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
}

static int
tlsext_supportedgroups_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	const uint16_t *groups;
	size_t groups_len;
	CBB grouplist;
	int i;

	tls1_get_group_list(s, 0, &groups, &groups_len);
	if (groups_len == 0) {
		SSLerror(s, ERR_R_INTERNAL_ERROR);
		return 0;
	}

	if (!CBB_add_u16_length_prefixed(cbb, &grouplist))
		return 0;

	for (i = 0; i < groups_len; i++) {
		if (!ssl_security_supported_group(s, groups[i]))
			continue;
		if (!CBB_add_u16(&grouplist, groups[i]))
			return 0;
	}

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_supportedgroups_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	CBS grouplist;
	uint16_t *groups;
	size_t groups_len;
	int i;

	if (!CBS_get_u16_length_prefixed(cbs, &grouplist))

		return 0;


	groups_len = CBS_len(&grouplist);
	if (groups_len == 0 || groups_len % 2 != 0)
		return 0;
	groups_len /= 2;

	if (s->internal->hit)

		return 1;

	if (s->s3->hs.tls13.hrr) {
		if (s->session->tlsext_supportedgroups == NULL) {
			*alert = SSL_AD_HANDSHAKE_FAILURE;
			return 0;
		}

		/*
		 * The ClientHello extension hashing ensures that the client
		 * did not change its list of supported groups.
		 */















		return 1;
	}

	if (s->session->tlsext_supportedgroups != NULL)
		return 0; /* XXX internal error? */

	if ((groups = reallocarray(NULL, groups_len, sizeof(uint16_t))) == NULL) {

		*alert = SSL_AD_INTERNAL_ERROR;
		return 0;
	}

	for (i = 0; i < groups_len; i++) {
		if (!CBS_get_u16(&grouplist, &groups[i])) {
			free(groups);
			return 0;
		}
	}

	if (CBS_len(&grouplist) != 0) {
		free(groups);
		return 0;
	}

	s->session->tlsext_supportedgroups = groups;
	s->session->tlsext_supportedgroups_length = groups_len;


	return 1;




}

/* This extension is never used by the server. */
static int
tlsext_supportedgroups_server_needs(SSL *s, uint16_t msg_type)
{
	return 0;
}

static int
tlsext_supportedgroups_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return 0;
}

static int
tlsext_supportedgroups_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	/*
	 * Servers should not send this extension per the RFC.
	 *
	 * However, certain F5 BIG-IP systems incorrectly send it. This bug is
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470

471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534


535
536
537


538
539
540


541
542
543
544

545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626

627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
{
	CBS ecpf;

	if (!CBS_get_u8_length_prefixed(cbs, &ecpf))
		return 0;
	if (CBS_len(&ecpf) == 0)
		return 0;
	if (CBS_len(cbs) != 0)
		return 0;

	/* Must contain uncompressed (0) - RFC 8422, section 5.1.2. */
	if (!CBS_contains_zero_byte(&ecpf)) {
		SSLerror(s, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	if (!s->internal->hit) {
		if (!CBS_stow(&ecpf, &(s->session->tlsext_ecpointformatlist),
		    &(s->session->tlsext_ecpointformatlist_length))) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
	}

	return 1;
}

int
tlsext_ecpf_client_needs(SSL *s, uint16_t msg_type)
{
	return ssl_has_ecc_ciphers(s);
}

int
tlsext_ecpf_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return tlsext_ecpf_build(s, msg_type, cbb);
}

int
tlsext_ecpf_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	return tlsext_ecpf_parse(s, msg_type, cbs, alert);
}

int
tlsext_ecpf_server_needs(SSL *s, uint16_t msg_type)
{
	return ssl_using_ecc_cipher(s);
}

int
tlsext_ecpf_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return tlsext_ecpf_build(s, msg_type, cbb);
}

int
tlsext_ecpf_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	return tlsext_ecpf_parse(s, msg_type, cbs, alert);
}

/*
 * Renegotiation Indication - RFC 5746.
 */
int
tlsext_ri_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->internal->renegotiate);
}

int
tlsext_ri_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB reneg;

	if (!CBB_add_u8_length_prefixed(cbb, &reneg))
		return 0;
	if (!CBB_add_bytes(&reneg, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len))
		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_ri_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS reneg;

	if (!CBS_get_u8_length_prefixed(cbs, &reneg))
		goto err;
	if (CBS_len(cbs) != 0)
		goto err;


	if (!CBS_mem_equal(&reneg, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_MISMATCH);
		*alert = SSL_AD_HANDSHAKE_FAILURE;
		return 0;
	}

	s->s3->renegotiate_seen = 1;
	s->s3->send_connection_binding = 1;

	return 1;

 err:
	SSLerror(s, SSL_R_RENEGOTIATION_ENCODING_ERR);
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

int
tlsext_ri_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version < TLS1_3_VERSION &&
	    s->s3->send_connection_binding);
}

int
tlsext_ri_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB reneg;

	if (!CBB_add_u8_length_prefixed(cbb, &reneg))
		return 0;
	if (!CBB_add_bytes(&reneg, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len))
		return 0;
	if (!CBB_add_bytes(&reneg, s->s3->previous_server_finished,
	    s->s3->previous_server_finished_len))
		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_ri_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS reneg, prev_client, prev_server;

	/*
	 * Ensure that the previous client and server values are both not
	 * present, or that they are both present.
	 */
	if ((s->s3->previous_client_finished_len == 0 &&
	    s->s3->previous_server_finished_len != 0) ||
	    (s->s3->previous_client_finished_len != 0 &&
	    s->s3->previous_server_finished_len == 0)) {
		*alert = SSL_AD_INTERNAL_ERROR;
		return 0;
	}

	if (!CBS_get_u8_length_prefixed(cbs, &reneg))
		goto err;


	if (!CBS_get_bytes(&reneg, &prev_client,
	    s->s3->previous_client_finished_len))
		goto err;


	if (!CBS_get_bytes(&reneg, &prev_server,
	    s->s3->previous_server_finished_len))
		goto err;


	if (CBS_len(&reneg) != 0)
		goto err;
	if (CBS_len(cbs) != 0)
		goto err;


	if (!CBS_mem_equal(&prev_client, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_MISMATCH);
		*alert = SSL_AD_HANDSHAKE_FAILURE;
		return 0;
	}
	if (!CBS_mem_equal(&prev_server, s->s3->previous_server_finished,
	    s->s3->previous_server_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_MISMATCH);
		*alert = SSL_AD_HANDSHAKE_FAILURE;
		return 0;
	}

	s->s3->renegotiate_seen = 1;
	s->s3->send_connection_binding = 1;

	return 1;

 err:
	SSLerror(s, SSL_R_RENEGOTIATION_ENCODING_ERR);
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

/*
 * Signature Algorithms - RFC 5246 section 7.4.1.4.1.
 */
int
tlsext_sigalgs_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_2_VERSION);
}

int
tlsext_sigalgs_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	uint16_t tls_version = s->s3->hs.negotiated_tls_version;
	CBB sigalgs;

	if (msg_type == SSL_TLSEXT_MSG_CH)
		tls_version = s->s3->hs.our_min_tls_version;

	if (!CBB_add_u16_length_prefixed(cbb, &sigalgs))
		return 0;
	if (!ssl_sigalgs_build(tls_version, &sigalgs))
		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_sigalgs_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS sigalgs;

	if (!CBS_get_u16_length_prefixed(cbs, &sigalgs))
		return 0;
	if (CBS_len(&sigalgs) % 2 != 0 || CBS_len(&sigalgs) > 64)
		return 0;
	if (!CBS_stow(&sigalgs, &s->s3->hs.sigalgs, &s->s3->hs.sigalgs_len))
		return 0;

	return 1;
}

int
tlsext_sigalgs_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION);
}

int
tlsext_sigalgs_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB sigalgs;

	if (!CBB_add_u16_length_prefixed(cbb, &sigalgs))
		return 0;
	if (!ssl_sigalgs_build(s->s3->hs.negotiated_tls_version, &sigalgs))

		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_sigalgs_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS sigalgs;

	if (ssl_effective_tls_version(s) < TLS1_3_VERSION)
		return 0;

	if (!CBS_get_u16_length_prefixed(cbs, &sigalgs))
		return 0;
	if (CBS_len(&sigalgs) % 2 != 0 || CBS_len(&sigalgs) > 64)
		return 0;
	if (!CBS_stow(&sigalgs, &s->s3->hs.sigalgs, &s->s3->hs.sigalgs_len))
		return 0;

	return 1;
}

/*
 * Server Name Indication - RFC 6066, section 3.
 */
int
tlsext_sni_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->tlsext_hostname != NULL);
}

int
tlsext_sni_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB server_name_list, host_name;

	if (!CBB_add_u16_length_prefixed(cbb, &server_name_list))
		return 0;
	if (!CBB_add_u8(&server_name_list, TLSEXT_NAMETYPE_host_name))







<
<



















|





|





|





|





|





|








|





|















|




|
|
|
<
>












|
<
<
<
<
|
<
|






|


















|
















|
|
>
>

|
|
>
>

|
|
>
>
|
|
|
<
>


















<
<
<
<
<





|





|










|







|














|





|






|
>







|




















|





|







353
354
355
356
357
358
359


360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447

448
449
450
451
452
453
454
455
456
457
458
459
460
461




462

463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522

523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541





542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
{
	CBS ecpf;

	if (!CBS_get_u8_length_prefixed(cbs, &ecpf))
		return 0;
	if (CBS_len(&ecpf) == 0)
		return 0;



	/* Must contain uncompressed (0) - RFC 8422, section 5.1.2. */
	if (!CBS_contains_zero_byte(&ecpf)) {
		SSLerror(s, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	if (!s->internal->hit) {
		if (!CBS_stow(&ecpf, &(s->session->tlsext_ecpointformatlist),
		    &(s->session->tlsext_ecpointformatlist_length))) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
	}

	return 1;
}

static int
tlsext_ecpf_client_needs(SSL *s, uint16_t msg_type)
{
	return ssl_has_ecc_ciphers(s);
}

static int
tlsext_ecpf_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return tlsext_ecpf_build(s, msg_type, cbb);
}

static int
tlsext_ecpf_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	return tlsext_ecpf_parse(s, msg_type, cbs, alert);
}

static int
tlsext_ecpf_server_needs(SSL *s, uint16_t msg_type)
{
	return ssl_using_ecc_cipher(s);
}

static int
tlsext_ecpf_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return tlsext_ecpf_build(s, msg_type, cbb);
}

static int
tlsext_ecpf_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	return tlsext_ecpf_parse(s, msg_type, cbs, alert);
}

/*
 * Renegotiation Indication - RFC 5746.
 */
static int
tlsext_ri_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->internal->renegotiate);
}

static int
tlsext_ri_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB reneg;

	if (!CBB_add_u8_length_prefixed(cbb, &reneg))
		return 0;
	if (!CBB_add_bytes(&reneg, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len))
		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_ri_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS reneg;

	if (!CBS_get_u8_length_prefixed(cbs, &reneg)) {
		SSLerror(s, SSL_R_RENEGOTIATION_ENCODING_ERR);
		return 0;

	}

	if (!CBS_mem_equal(&reneg, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_MISMATCH);
		*alert = SSL_AD_HANDSHAKE_FAILURE;
		return 0;
	}

	s->s3->renegotiate_seen = 1;
	s->s3->send_connection_binding = 1;

	return 1;
}






static int
tlsext_ri_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version < TLS1_3_VERSION &&
	    s->s3->send_connection_binding);
}

static int
tlsext_ri_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB reneg;

	if (!CBB_add_u8_length_prefixed(cbb, &reneg))
		return 0;
	if (!CBB_add_bytes(&reneg, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len))
		return 0;
	if (!CBB_add_bytes(&reneg, s->s3->previous_server_finished,
	    s->s3->previous_server_finished_len))
		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_ri_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS reneg, prev_client, prev_server;

	/*
	 * Ensure that the previous client and server values are both not
	 * present, or that they are both present.
	 */
	if ((s->s3->previous_client_finished_len == 0 &&
	    s->s3->previous_server_finished_len != 0) ||
	    (s->s3->previous_client_finished_len != 0 &&
	    s->s3->previous_server_finished_len == 0)) {
		*alert = SSL_AD_INTERNAL_ERROR;
		return 0;
	}

	if (!CBS_get_u8_length_prefixed(cbs, &reneg)) {
		SSLerror(s, SSL_R_RENEGOTIATION_ENCODING_ERR);
		return 0;
	}
	if (!CBS_get_bytes(&reneg, &prev_client,
	    s->s3->previous_client_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_ENCODING_ERR);
		return 0;
	}
	if (!CBS_get_bytes(&reneg, &prev_server,
	    s->s3->previous_server_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_ENCODING_ERR);
		return 0;
	}
	if (CBS_len(&reneg) != 0) {
		SSLerror(s, SSL_R_RENEGOTIATION_ENCODING_ERR);
		return 0;

	}

	if (!CBS_mem_equal(&prev_client, s->s3->previous_client_finished,
	    s->s3->previous_client_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_MISMATCH);
		*alert = SSL_AD_HANDSHAKE_FAILURE;
		return 0;
	}
	if (!CBS_mem_equal(&prev_server, s->s3->previous_server_finished,
	    s->s3->previous_server_finished_len)) {
		SSLerror(s, SSL_R_RENEGOTIATION_MISMATCH);
		*alert = SSL_AD_HANDSHAKE_FAILURE;
		return 0;
	}

	s->s3->renegotiate_seen = 1;
	s->s3->send_connection_binding = 1;

	return 1;





}

/*
 * Signature Algorithms - RFC 5246 section 7.4.1.4.1.
 */
static int
tlsext_sigalgs_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_2_VERSION);
}

static int
tlsext_sigalgs_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	uint16_t tls_version = s->s3->hs.negotiated_tls_version;
	CBB sigalgs;

	if (msg_type == SSL_TLSEXT_MSG_CH)
		tls_version = s->s3->hs.our_min_tls_version;

	if (!CBB_add_u16_length_prefixed(cbb, &sigalgs))
		return 0;
	if (!ssl_sigalgs_build(tls_version, &sigalgs, SSL_get_security_level(s)))
		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_sigalgs_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS sigalgs;

	if (!CBS_get_u16_length_prefixed(cbs, &sigalgs))
		return 0;
	if (CBS_len(&sigalgs) % 2 != 0 || CBS_len(&sigalgs) > 64)
		return 0;
	if (!CBS_stow(&sigalgs, &s->s3->hs.sigalgs, &s->s3->hs.sigalgs_len))
		return 0;

	return 1;
}

static int
tlsext_sigalgs_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION);
}

static int
tlsext_sigalgs_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB sigalgs;

	if (!CBB_add_u16_length_prefixed(cbb, &sigalgs))
		return 0;
	if (!ssl_sigalgs_build(s->s3->hs.negotiated_tls_version, &sigalgs,
	    SSL_get_security_level(s)))
		return 0;
	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_sigalgs_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS sigalgs;

	if (ssl_effective_tls_version(s) < TLS1_3_VERSION)
		return 0;

	if (!CBS_get_u16_length_prefixed(cbs, &sigalgs))
		return 0;
	if (CBS_len(&sigalgs) % 2 != 0 || CBS_len(&sigalgs) > 64)
		return 0;
	if (!CBS_stow(&sigalgs, &s->s3->hs.sigalgs, &s->s3->hs.sigalgs_len))
		return 0;

	return 1;
}

/*
 * Server Name Indication - RFC 6066, section 3.
 */
static int
tlsext_sni_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->tlsext_hostname != NULL);
}

static int
tlsext_sni_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB server_name_list, host_name;

	if (!CBB_add_u16_length_prefixed(cbb, &server_name_list))
		return 0;
	if (!CBB_add_u8(&server_name_list, TLSEXT_NAMETYPE_host_name))
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
		if (++component > 63)
			return 0;
	}

	return 1;
}

int
tlsext_sni_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS server_name_list, host_name;
	uint8_t name_type;
	int is_ip;

	if (!CBS_get_u16_length_prefixed(cbs, &server_name_list))







|







733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
		if (++component > 63)
			return 0;
	}

	return 1;
}

static int
tlsext_sni_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS server_name_list, host_name;
	uint8_t name_type;
	int is_ip;

	if (!CBS_get_u16_length_prefixed(cbs, &server_name_list))
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
	 * RFC 6066 section 3 forbids multiple host names with the same type,
	 * therefore we allow only one entry.
	 */
	if (CBS_len(&server_name_list) != 0) {
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		goto err;
	}
	if (CBS_len(cbs) != 0)
		goto err;

	return 1;

 err:
	return 0;
}

int
tlsext_sni_server_needs(SSL *s, uint16_t msg_type)
{
	if (s->internal->hit)
		return 0;

	return (s->session->tlsext_hostname != NULL);
}

int
tlsext_sni_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return 1;
}

int
tlsext_sni_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	if (s->tlsext_hostname == NULL || CBS_len(cbs) != 0) {
		*alert = SSL_AD_UNRECOGNIZED_NAME;
		return 0;
	}

	if (s->internal->hit) {
		if (s->session->tlsext_hostname == NULL) {
			*alert = SSL_AD_UNRECOGNIZED_NAME;
			return 0;
		}
		if (strcmp(s->tlsext_hostname,
		    s->session->tlsext_hostname) != 0) {
			*alert = SSL_AD_UNRECOGNIZED_NAME;
			return 0;
		}
	} else {
		if (s->session->tlsext_hostname != NULL) {
			*alert = SSL_AD_DECODE_ERROR;
			return 0;
		}
		if ((s->session->tlsext_hostname =
		    strdup(s->tlsext_hostname)) == NULL) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
	}

	return 1;
}


/*
 * Certificate Status Request - RFC 6066 section 8.
 */

int
tlsext_ocsp_client_needs(SSL *s, uint16_t msg_type)
{
	if (msg_type != SSL_TLSEXT_MSG_CH)
		return 0;

	return (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp);
}

int
tlsext_ocsp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB respid_list, respid, exts;
	unsigned char *ext_data;
	size_t ext_len;
	int i;








<
<







|








|





|


















|
<

<










<




|








|







807
808
809
810
811
812
813


814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855

856

857
858
859
860
861
862
863
864
865
866

867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
	 * RFC 6066 section 3 forbids multiple host names with the same type,
	 * therefore we allow only one entry.
	 */
	if (CBS_len(&server_name_list) != 0) {
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		goto err;
	}



	return 1;

 err:
	return 0;
}

static int
tlsext_sni_server_needs(SSL *s, uint16_t msg_type)
{
	if (s->internal->hit)
		return 0;

	return (s->session->tlsext_hostname != NULL);
}

static int
tlsext_sni_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return 1;
}

static int
tlsext_sni_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	if (s->tlsext_hostname == NULL || CBS_len(cbs) != 0) {
		*alert = SSL_AD_UNRECOGNIZED_NAME;
		return 0;
	}

	if (s->internal->hit) {
		if (s->session->tlsext_hostname == NULL) {
			*alert = SSL_AD_UNRECOGNIZED_NAME;
			return 0;
		}
		if (strcmp(s->tlsext_hostname,
		    s->session->tlsext_hostname) != 0) {
			*alert = SSL_AD_UNRECOGNIZED_NAME;
			return 0;
		}
	} else {
		if (s->session->tlsext_hostname != NULL)

			return 0;

		if ((s->session->tlsext_hostname =
		    strdup(s->tlsext_hostname)) == NULL) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
	}

	return 1;
}


/*
 * Certificate Status Request - RFC 6066 section 8.
 */

static int
tlsext_ocsp_client_needs(SSL *s, uint16_t msg_type)
{
	if (msg_type != SSL_TLSEXT_MSG_CH)
		return 0;

	return (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp);
}

static int
tlsext_ocsp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB respid_list, respid, exts;
	unsigned char *ext_data;
	size_t ext_len;
	int i;

947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
	    ext_len))
		return 0;
	if (!CBB_flush(cbb))
		return 0;
	return 1;
}

int
tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	int alert_desc = SSL_AD_DECODE_ERROR;
	CBS respid_list, respid, exts;
	const unsigned char *p;
	uint8_t status_type;
	int ret = 0;







|







917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
	    ext_len))
		return 0;
	if (!CBB_flush(cbb))
		return 0;
	return 1;
}

static int
tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	int alert_desc = SSL_AD_DECODE_ERROR;
	CBS respid_list, respid, exts;
	const unsigned char *p;
	uint8_t status_type;
	int ret = 0;
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
		    X509_EXTENSION_free);
		p = CBS_data(&exts);
		if ((s->internal->tlsext_ocsp_exts = d2i_X509_EXTENSIONS(NULL,
		    &p, CBS_len(&exts))) == NULL)
			goto err;
	}

	/* should be nothing left */
	if (CBS_len(cbs) > 0)
		goto err;

	ret = 1;
 err:
	if (ret == 0)
		*alert = alert_desc;
	return ret;
}

int
tlsext_ocsp_server_needs(SSL *s, uint16_t msg_type)
{
	if (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION &&
	    s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp &&
	    s->ctx->internal->tlsext_status_cb != NULL) {
		s->internal->tlsext_status_expected = 0;
		if (s->ctx->internal->tlsext_status_cb(s,
		    s->ctx->internal->tlsext_status_arg) == SSL_TLSEXT_ERR_OK &&
		    s->internal->tlsext_ocsp_resp_len > 0)
			s->internal->tlsext_status_expected = 1;
	}
	return s->internal->tlsext_status_expected;
}

int
tlsext_ocsp_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB ocsp_response;

	if (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION) {
		if (!CBB_add_u8(cbb, TLSEXT_STATUSTYPE_ocsp))
			return 0;
		if (!CBB_add_u24_length_prefixed(cbb, &ocsp_response))
			return 0;
		if (!CBB_add_bytes(&ocsp_response,
		    s->internal->tlsext_ocsp_resp,
		    s->internal->tlsext_ocsp_resp_len))
			return 0;
		if (!CBB_flush(cbb))
			return 0;
	}
	return 1;
}

int
tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	uint8_t status_type;
	CBS response;

	if (ssl_effective_tls_version(s) >= TLS1_3_VERSION) {
		if (msg_type == SSL_TLSEXT_MSG_CR) {







<
<
<
<







|














|



















|







983
984
985
986
987
988
989




990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
		    X509_EXTENSION_free);
		p = CBS_data(&exts);
		if ((s->internal->tlsext_ocsp_exts = d2i_X509_EXTENSIONS(NULL,
		    &p, CBS_len(&exts))) == NULL)
			goto err;
	}





	ret = 1;
 err:
	if (ret == 0)
		*alert = alert_desc;
	return ret;
}

static int
tlsext_ocsp_server_needs(SSL *s, uint16_t msg_type)
{
	if (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION &&
	    s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp &&
	    s->ctx->internal->tlsext_status_cb != NULL) {
		s->internal->tlsext_status_expected = 0;
		if (s->ctx->internal->tlsext_status_cb(s,
		    s->ctx->internal->tlsext_status_arg) == SSL_TLSEXT_ERR_OK &&
		    s->internal->tlsext_ocsp_resp_len > 0)
			s->internal->tlsext_status_expected = 1;
	}
	return s->internal->tlsext_status_expected;
}

static int
tlsext_ocsp_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB ocsp_response;

	if (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION) {
		if (!CBB_add_u8(cbb, TLSEXT_STATUSTYPE_ocsp))
			return 0;
		if (!CBB_add_u24_length_prefixed(cbb, &ocsp_response))
			return 0;
		if (!CBB_add_bytes(&ocsp_response,
		    s->internal->tlsext_ocsp_resp,
		    s->internal->tlsext_ocsp_resp_len))
			return 0;
		if (!CBB_flush(cbb))
			return 0;
	}
	return 1;
}

static int
tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	uint8_t status_type;
	CBS response;

	if (ssl_effective_tls_version(s) >= TLS1_3_VERSION) {
		if (msg_type == SSL_TLSEXT_MSG_CR) {
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128



1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
	}
	return 1;
}

/*
 * SessionTicket extension - RFC 5077 section 3.2
 */
int
tlsext_sessionticket_client_needs(SSL *s, uint16_t msg_type)
{
	/*
	 * Send session ticket extension when enabled and not overridden.
	 *
	 * When renegotiating, send an empty session ticket to indicate support.
	 */
	if ((SSL_get_options(s) & SSL_OP_NO_TICKET) != 0)
		return 0;




	if (s->internal->new_session)
		return 1;

	if (s->internal->tlsext_session_ticket != NULL &&
	    s->internal->tlsext_session_ticket->data == NULL)
		return 0;

	return 1;
}

int
tlsext_sessionticket_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	/*
	 * Signal that we support session tickets by sending an empty
	 * extension when renegotiating or no session found.
	 */
	if (s->internal->new_session || s->session == NULL)







|









>
>
>











|







1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
	}
	return 1;
}

/*
 * SessionTicket extension - RFC 5077 section 3.2
 */
static int
tlsext_sessionticket_client_needs(SSL *s, uint16_t msg_type)
{
	/*
	 * Send session ticket extension when enabled and not overridden.
	 *
	 * When renegotiating, send an empty session ticket to indicate support.
	 */
	if ((SSL_get_options(s) & SSL_OP_NO_TICKET) != 0)
		return 0;

	if (!ssl_security_tickets(s))
		return 0;

	if (s->internal->new_session)
		return 1;

	if (s->internal->tlsext_session_ticket != NULL &&
	    s->internal->tlsext_session_ticket->data == NULL)
		return 0;

	return 1;
}

static int
tlsext_sessionticket_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	/*
	 * Signal that we support session tickets by sending an empty
	 * extension when renegotiating or no session found.
	 */
	if (s->internal->new_session || s->session == NULL)
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	if (s->internal->tls_session_ticket_ext_cb) {
		if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs),
		    (int)CBS_len(cbs),
		    s->internal->tls_session_ticket_ext_cb_arg)) {







|







1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	if (s->internal->tls_session_ticket_ext_cb) {
		if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs),
		    (int)CBS_len(cbs),
		    s->internal->tls_session_ticket_ext_cb_arg)) {
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209

1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
		*alert = SSL_AD_INTERNAL_ERROR;
		return 0;
	}

	return 1;
}

int
tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->internal->tlsext_ticket_expected &&
	    !(SSL_get_options(s) & SSL_OP_NO_TICKET));

}

int
tlsext_sessionticket_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	/* Empty ticket */
	return 1;
}

int
tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	if (s->internal->tls_session_ticket_ext_cb) {
		if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs),
		    (int)CBS_len(cbs),
		    s->internal->tls_session_ticket_ext_cb_arg)) {







|



|
>


|






|







1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
		*alert = SSL_AD_INTERNAL_ERROR;
		return 0;
	}

	return 1;
}

static int
tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->internal->tlsext_ticket_expected &&
	    !(SSL_get_options(s) & SSL_OP_NO_TICKET) &&
	    ssl_security_tickets(s));
}

static int
tlsext_sessionticket_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	/* Empty ticket */
	return 1;
}

static int
tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	if (s->internal->tls_session_ticket_ext_cb) {
		if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs),
		    (int)CBS_len(cbs),
		    s->internal->tls_session_ticket_ext_cb_arg)) {
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261

/*
 * DTLS extension for SRTP key establishment - RFC 5764
 */

#ifndef OPENSSL_NO_SRTP

int
tlsext_srtp_client_needs(SSL *s, uint16_t msg_type)
{
	return SSL_is_dtls(s) && SSL_get_srtp_profiles(s) != NULL;
}

int
tlsext_srtp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB profiles, mki;
	int ct, i;
	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL;
	const SRTP_PROTECTION_PROFILE *prof;








|





|







1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231

/*
 * DTLS extension for SRTP key establishment - RFC 5764
 */

#ifndef OPENSSL_NO_SRTP

static int
tlsext_srtp_client_needs(SSL *s, uint16_t msg_type)
{
	return SSL_is_dtls(s) && SSL_get_srtp_profiles(s) != NULL;
}

static int
tlsext_srtp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB profiles, mki;
	int ct, i;
	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL;
	const SRTP_PROTECTION_PROFILE *prof;

1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	const SRTP_PROTECTION_PROFILE *cprof, *sprof;
	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL, *srvr;
	int i, j;
	int ret;
	uint16_t id;







|







1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	const SRTP_PROTECTION_PROFILE *cprof, *sprof;
	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL, *srvr;
	int i, j;
	int ret;
	uint16_t id;
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
			if (!sk_SRTP_PROTECTION_PROFILE_push(clnt, cprof))
				goto err;
		}
	}

	if (!CBS_get_u8_length_prefixed(cbs, &mki) || CBS_len(&mki) != 0) {
		SSLerror(s, SSL_R_BAD_SRTP_MKI_VALUE);
		*alert = SSL_AD_DECODE_ERROR;
		goto done;
	}
	if (CBS_len(cbs) != 0)
		goto err;

	/*
	 * Per RFC 5764 section 4.1.1
	 *
	 * Find the server preferred profile using the client's list.
	 *
	 * The server MUST send a profile if it sends the use_srtp
	 * extension.  If one is not found, it should fall back to the
	 * negotiated DTLS cipher suite or return a DTLS alert.
	 */
	if ((srvr = SSL_get_srtp_profiles(s)) == NULL)
		goto err;
	for (i = 0; i < sk_SRTP_PROTECTION_PROFILE_num(srvr); i++) {
		if ((sprof = sk_SRTP_PROTECTION_PROFILE_value(srvr, i))
		    == NULL)
			goto err;

		for (j = 0; j < sk_SRTP_PROTECTION_PROFILE_num(clnt); j++) {
			if ((cprof = sk_SRTP_PROTECTION_PROFILE_value(clnt, j))
			    == NULL)
				goto err;








<


<
<













|
<







1286
1287
1288
1289
1290
1291
1292

1293
1294


1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308

1309
1310
1311
1312
1313
1314
1315
			if (!sk_SRTP_PROTECTION_PROFILE_push(clnt, cprof))
				goto err;
		}
	}

	if (!CBS_get_u8_length_prefixed(cbs, &mki) || CBS_len(&mki) != 0) {
		SSLerror(s, SSL_R_BAD_SRTP_MKI_VALUE);

		goto done;
	}



	/*
	 * Per RFC 5764 section 4.1.1
	 *
	 * Find the server preferred profile using the client's list.
	 *
	 * The server MUST send a profile if it sends the use_srtp
	 * extension.  If one is not found, it should fall back to the
	 * negotiated DTLS cipher suite or return a DTLS alert.
	 */
	if ((srvr = SSL_get_srtp_profiles(s)) == NULL)
		goto err;
	for (i = 0; i < sk_SRTP_PROTECTION_PROFILE_num(srvr); i++) {
		if ((sprof = sk_SRTP_PROTECTION_PROFILE_value(srvr, i)) == NULL)

			goto err;

		for (j = 0; j < sk_SRTP_PROTECTION_PROFILE_num(clnt); j++) {
			if ((cprof = sk_SRTP_PROTECTION_PROFILE_value(clnt, j))
			    == NULL)
				goto err;

1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384

	/* If we didn't find anything, fall back to the negotiated */
	ret = 1;
	goto done;

 err:
	SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
	*alert = SSL_AD_DECODE_ERROR;

 done:
	sk_SRTP_PROTECTION_PROFILE_free(clnt);
	return ret;
}

int
tlsext_srtp_server_needs(SSL *s, uint16_t msg_type)
{
	return SSL_is_dtls(s) && SSL_get_selected_srtp_profile(s) != NULL;
}

int
tlsext_srtp_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	SRTP_PROTECTION_PROFILE *profile;
	CBB srtp, mki;

	if (!CBB_add_u16_length_prefixed(cbb, &srtp))
		return 0;







<






|





|







1323
1324
1325
1326
1327
1328
1329

1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349

	/* If we didn't find anything, fall back to the negotiated */
	ret = 1;
	goto done;

 err:
	SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);


 done:
	sk_SRTP_PROTECTION_PROFILE_free(clnt);
	return ret;
}

static int
tlsext_srtp_server_needs(SSL *s, uint16_t msg_type)
{
	return SSL_is_dtls(s) && SSL_get_selected_srtp_profile(s) != NULL;
}

static int
tlsext_srtp_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	SRTP_PROTECTION_PROFILE *profile;
	CBB srtp, mki;

	if (!CBB_add_u16_length_prefixed(cbb, &srtp))
		return 0;
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt;
	const SRTP_PROTECTION_PROFILE *prof;
	int i;
	uint16_t id;
	CBS profile_ids, mki;

	if (!CBS_get_u16_length_prefixed(cbs, &profile_ids)) {
		SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
		goto err;
	}

	if (!CBS_get_u16(&profile_ids, &id) || CBS_len(&profile_ids) != 0) {
		SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
		goto err;
	}

	if (!CBS_get_u8_length_prefixed(cbs, &mki) || CBS_len(&mki) != 0) {
		SSLerror(s, SSL_R_BAD_SRTP_MKI_VALUE);
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	if ((clnt = SSL_get_srtp_profiles(s)) == NULL) {
		SSLerror(s, SSL_R_NO_SRTP_PROFILES);
		goto err;
	}

	for (i = 0; i < sk_SRTP_PROTECTION_PROFILE_num(clnt); i++) {
		if ((prof = sk_SRTP_PROTECTION_PROFILE_value(clnt, i))
		    == NULL) {
			SSLerror(s, SSL_R_NO_SRTP_PROFILES);
			goto err;
		}

		if (prof->id == id) {
			s->internal->srtp_profile = prof;
			return 1;
		}
	}

	SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
 err:
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

#endif /* OPENSSL_NO_SRTP */

/*
 * TLSv1.3 Key Share - RFC 8446 section 4.2.8.
 */
int
tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
}

int
tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB client_shares, key_exchange;

	if (!CBB_add_u16_length_prefixed(cbb, &client_shares))
		return 0;








|










|




|










|






|









|
<








|





|







1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410

1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt;
	const SRTP_PROTECTION_PROFILE *prof;
	int i;
	uint16_t id;
	CBS profile_ids, mki;

	if (!CBS_get_u16_length_prefixed(cbs, &profile_ids)) {
		SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
		return 0;
	}

	if (!CBS_get_u16(&profile_ids, &id) || CBS_len(&profile_ids) != 0) {
		SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
		return 0;
	}

	if (!CBS_get_u8_length_prefixed(cbs, &mki) || CBS_len(&mki) != 0) {
		SSLerror(s, SSL_R_BAD_SRTP_MKI_VALUE);
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	if ((clnt = SSL_get_srtp_profiles(s)) == NULL) {
		SSLerror(s, SSL_R_NO_SRTP_PROFILES);
		return 0;
	}

	for (i = 0; i < sk_SRTP_PROTECTION_PROFILE_num(clnt); i++) {
		if ((prof = sk_SRTP_PROTECTION_PROFILE_value(clnt, i))
		    == NULL) {
			SSLerror(s, SSL_R_NO_SRTP_PROFILES);
			return 0;
		}

		if (prof->id == id) {
			s->internal->srtp_profile = prof;
			return 1;
		}
	}

	SSLerror(s, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);


	return 0;
}

#endif /* OPENSSL_NO_SRTP */

/*
 * TLSv1.3 Key Share - RFC 8446 section 4.2.8.
 */
static int
tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
}

static int
tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB client_shares, key_exchange;

	if (!CBB_add_u16_length_prefixed(cbb, &client_shares))
		return 0;

1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_keyshare_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS client_shares, key_exchange;
	int decode_error;
	uint16_t group;

	if (!CBS_get_u16_length_prefixed(cbs, &client_shares))







|







1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_keyshare_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS client_shares, key_exchange;
	int decode_error;
	uint16_t group;

	if (!CBS_get_u16_length_prefixed(cbs, &client_shares))
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
		 */
		if (s->s3->hs.our_max_tls_version < TLS1_3_VERSION)
			continue;
		if (s->s3->hs.key_share != NULL)
			continue;

		/* XXX - consider implementing server preference. */
		if (!tls1_check_curve(s, group))
			continue;

		/* Decode and store the selected key share. */
		if ((s->s3->hs.key_share = tls_key_share_new(group)) == NULL) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
		if (!tls_key_share_peer_public(s->s3->hs.key_share,
		    &key_exchange, &decode_error, NULL)) {
			if (!decode_error)
				*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
	}

	return 1;
}

int
tlsext_keyshare_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION &&
	    tlsext_extension_seen(s, TLSEXT_TYPE_key_share));
}

int
tlsext_keyshare_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB key_exchange;

	/* In the case of a HRR, we only send the server selected group. */
	if (s->s3->hs.tls13.hrr) {
		if (s->s3->hs.tls13.server_group == 0)







|


















|






|







1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
		 */
		if (s->s3->hs.our_max_tls_version < TLS1_3_VERSION)
			continue;
		if (s->s3->hs.key_share != NULL)
			continue;

		/* XXX - consider implementing server preference. */
		if (!tls1_check_group(s, group))
			continue;

		/* Decode and store the selected key share. */
		if ((s->s3->hs.key_share = tls_key_share_new(group)) == NULL) {
			*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
		if (!tls_key_share_peer_public(s->s3->hs.key_share,
		    &key_exchange, &decode_error, NULL)) {
			if (!decode_error)
				*alert = SSL_AD_INTERNAL_ERROR;
			return 0;
		}
	}

	return 1;
}

static int
tlsext_keyshare_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION &&
	    tlsext_extension_seen(s, TLSEXT_TYPE_key_share));
}

static int
tlsext_keyshare_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB key_exchange;

	/* In the case of a HRR, we only send the server selected group. */
	if (s->s3->hs.tls13.hrr) {
		if (s->s3->hs.tls13.server_group == 0)
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_keyshare_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS key_exchange;
	int decode_error;
	uint16_t group;

	/* Unpack server share. */







|







1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_keyshare_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS key_exchange;
	int decode_error;
	uint16_t group;

	/* Unpack server share. */
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627

	return 1;
}

/*
 * Supported Versions - RFC 8446 section 4.2.1.
 */
int
tlsext_versions_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
}

int
tlsext_versions_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	uint16_t max, min;
	uint16_t version;
	CBB versions;

	max = s->s3->hs.our_max_tls_version;







|





|







1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591

	return 1;
}

/*
 * Supported Versions - RFC 8446 section 4.2.1.
 */
static int
tlsext_versions_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
}

static int
tlsext_versions_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	uint16_t max, min;
	uint16_t version;
	CBB versions;

	max = s->s3->hs.our_max_tls_version;
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829

1830





































































































































































1831
1832
1833
1834





1835
1836









1837
1838
1839
1840
1841
1842
1843

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_versions_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS versions;
	uint16_t version;
	uint16_t max, min;
	uint16_t matched_version = 0;

	max = s->s3->hs.our_max_tls_version;
	min = s->s3->hs.our_min_tls_version;

	if (!CBS_get_u8_length_prefixed(cbs, &versions))
		goto err;

	while (CBS_len(&versions) > 0) {
		if (!CBS_get_u16(&versions, &version))
			goto err;
		/*
		 * XXX What is below implements client preference, and
		 * ignores any server preference entirely.
		 */
		if (matched_version == 0 && version >= min && version <= max)
			matched_version = version;
	}

	if (matched_version > 0)  {
		/* XXX - this should be stored for later processing. */
		s->version = matched_version;
		return 1;
	}

	*alert = SSL_AD_PROTOCOL_VERSION;
	return 0;

 err:
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

int
tlsext_versions_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION);
}

int
tlsext_versions_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return CBB_add_u16(cbb, TLS1_3_VERSION);
}

int
tlsext_versions_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	uint16_t selected_version;

	if (!CBS_get_u16(cbs, &selected_version)) {
		*alert = SSL_AD_DECODE_ERROR;
		return 0;
	}

	/* XXX - need to fix for DTLS 1.3 */
	if (selected_version < TLS1_3_VERSION) {
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	/* XXX test between min and max once initialization code goes in */
	s->s3->hs.tls13.server_version = selected_version;

	return 1;
}


/*
 * Cookie - RFC 8446 section 4.2.2.
 */

int
tlsext_cookie_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION &&
	    s->s3->hs.tls13.cookie_len > 0 && s->s3->hs.tls13.cookie != NULL);
}

int
tlsext_cookie_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB cookie;

	if (!CBB_add_u16_length_prefixed(cbb, &cookie))
		return 0;

	if (!CBB_add_bytes(&cookie, s->s3->hs.tls13.cookie,
	    s->s3->hs.tls13.cookie_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_cookie_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS cookie;

	if (!CBS_get_u16_length_prefixed(cbs, &cookie))
		goto err;

	if (CBS_len(&cookie) != s->s3->hs.tls13.cookie_len)
		goto err;

	/*
	 * Check provided cookie value against what server previously
	 * sent - client *MUST* send the same cookie with new CR after
	 * a cookie is sent by the server with an HRR.
	 */
	if (!CBS_mem_equal(&cookie, s->s3->hs.tls13.cookie,
	    s->s3->hs.tls13.cookie_len)) {
		/* XXX special cookie mismatch alert? */
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	return 1;

 err:
	*alert = SSL_AD_DECODE_ERROR;
	return 0;
}

int
tlsext_cookie_server_needs(SSL *s, uint16_t msg_type)
{
	/*
	 * Server needs to set cookie value in tls13 handshake
	 * in order to send one, should only be sent with HRR.
	 */
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION &&
	    s->s3->hs.tls13.cookie_len > 0 && s->s3->hs.tls13.cookie != NULL);
}

int
tlsext_cookie_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB cookie;

	/* XXX deduplicate with client code */

	if (!CBB_add_u16_length_prefixed(cbb, &cookie))
		return 0;

	if (!CBB_add_bytes(&cookie, s->s3->hs.tls13.cookie,
	    s->s3->hs.tls13.cookie_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

int
tlsext_cookie_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS cookie;

	/*
	 * XXX This currently assumes we will not get a second
	 * HRR from a server with a cookie to process after accepting
	 * one from the server in the same handshake
	 */
	if (s->s3->hs.tls13.cookie != NULL ||
	    s->s3->hs.tls13.cookie_len != 0) {
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	if (!CBS_get_u16_length_prefixed(cbs, &cookie))
		goto err;

	if (!CBS_stow(&cookie, &s->s3->hs.tls13.cookie,
	    &s->s3->hs.tls13.cookie_len))

		goto err;






































































































































































	return 1;

 err:





	*alert = SSL_AD_DECODE_ERROR;
	return 0;









}

struct tls_extension_funcs {
	int (*needs)(SSL *s, uint16_t msg_type);
	int (*build)(SSL *s, uint16_t msg_type, CBB *cbb);
	int (*parse)(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
};







|











|



|
















|
<
<
<
|
<
|





|





|




|
<

<


















|






|

















|





|


|














|
<
<
<
|
<
|










|



















|
















|



>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|
|
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>







1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642



1643

1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661

1662

1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730



1731

1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_versions_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS versions;
	uint16_t version;
	uint16_t max, min;
	uint16_t matched_version = 0;

	max = s->s3->hs.our_max_tls_version;
	min = s->s3->hs.our_min_tls_version;

	if (!CBS_get_u8_length_prefixed(cbs, &versions))
		return 0;

	while (CBS_len(&versions) > 0) {
		if (!CBS_get_u16(&versions, &version))
			return 0;
		/*
		 * XXX What is below implements client preference, and
		 * ignores any server preference entirely.
		 */
		if (matched_version == 0 && version >= min && version <= max)
			matched_version = version;
	}

	if (matched_version > 0)  {
		/* XXX - this should be stored for later processing. */
		s->version = matched_version;
		return 1;
	}

	*alert = SSL_AD_PROTOCOL_VERSION;
	return 0;
}





static int
tlsext_versions_server_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION);
}

static int
tlsext_versions_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return CBB_add_u16(cbb, TLS1_3_VERSION);
}

static int
tlsext_versions_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	uint16_t selected_version;

	if (!CBS_get_u16(cbs, &selected_version))

		return 0;


	/* XXX - need to fix for DTLS 1.3 */
	if (selected_version < TLS1_3_VERSION) {
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	/* XXX test between min and max once initialization code goes in */
	s->s3->hs.tls13.server_version = selected_version;

	return 1;
}


/*
 * Cookie - RFC 8446 section 4.2.2.
 */

static int
tlsext_cookie_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION &&
	    s->s3->hs.tls13.cookie_len > 0 && s->s3->hs.tls13.cookie != NULL);
}

static int
tlsext_cookie_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB cookie;

	if (!CBB_add_u16_length_prefixed(cbb, &cookie))
		return 0;

	if (!CBB_add_bytes(&cookie, s->s3->hs.tls13.cookie,
	    s->s3->hs.tls13.cookie_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_cookie_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS cookie;

	if (!CBS_get_u16_length_prefixed(cbs, &cookie))
		return 0;

	if (CBS_len(&cookie) != s->s3->hs.tls13.cookie_len)
		return 0;

	/*
	 * Check provided cookie value against what server previously
	 * sent - client *MUST* send the same cookie with new CR after
	 * a cookie is sent by the server with an HRR.
	 */
	if (!CBS_mem_equal(&cookie, s->s3->hs.tls13.cookie,
	    s->s3->hs.tls13.cookie_len)) {
		/* XXX special cookie mismatch alert? */
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	return 1;
}





static int
tlsext_cookie_server_needs(SSL *s, uint16_t msg_type)
{
	/*
	 * Server needs to set cookie value in tls13 handshake
	 * in order to send one, should only be sent with HRR.
	 */
	return (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION &&
	    s->s3->hs.tls13.cookie_len > 0 && s->s3->hs.tls13.cookie != NULL);
}

static int
tlsext_cookie_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB cookie;

	/* XXX deduplicate with client code */

	if (!CBB_add_u16_length_prefixed(cbb, &cookie))
		return 0;

	if (!CBB_add_bytes(&cookie, s->s3->hs.tls13.cookie,
	    s->s3->hs.tls13.cookie_len))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_cookie_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	CBS cookie;

	/*
	 * XXX This currently assumes we will not get a second
	 * HRR from a server with a cookie to process after accepting
	 * one from the server in the same handshake
	 */
	if (s->s3->hs.tls13.cookie != NULL ||
	    s->s3->hs.tls13.cookie_len != 0) {
		*alert = SSL_AD_ILLEGAL_PARAMETER;
		return 0;
	}

	if (!CBS_get_u16_length_prefixed(cbs, &cookie))
		return 0;

	if (!CBS_stow(&cookie, &s->s3->hs.tls13.cookie,
	    &s->s3->hs.tls13.cookie_len))
		return 0;

	return 1;
}

/*
 * Pre-Shared Key Exchange Modes - RFC 8446, 4.2.9.
 */

static int
tlsext_psk_kex_modes_client_needs(SSL *s, uint16_t msg_type)
{
	return (s->s3->hs.tls13.use_psk_dhe_ke &&
	    s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
}

static int
tlsext_psk_kex_modes_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	CBB ke_modes;

	if (!CBB_add_u8_length_prefixed(cbb, &ke_modes))
		return 0;

	/* Only indicate support for PSK with DHE key establishment. */
	if (!CBB_add_u8(&ke_modes, TLS13_PSK_DHE_KE))
		return 0;

	if (!CBB_flush(cbb))
		return 0;

	return 1;
}

static int
tlsext_psk_kex_modes_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	CBS ke_modes;
	uint8_t ke_mode;

	if (!CBS_get_u8_length_prefixed(cbs, &ke_modes))
		return 0;

	while (CBS_len(&ke_modes) > 0) {
		if (!CBS_get_u8(&ke_modes, &ke_mode))
			return 0;

		if (ke_mode == TLS13_PSK_DHE_KE)
			s->s3->hs.tls13.use_psk_dhe_ke = 1;
	}

	return 1;
}

static int
tlsext_psk_kex_modes_server_needs(SSL *s, uint16_t msg_type)
{
	/* Servers MUST NOT send this extension. */
	return 0;
}

static int
tlsext_psk_kex_modes_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return 0;
}

static int
tlsext_psk_kex_modes_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert)
{
	return 0;
}

/*
 * Pre-Shared Key Extension - RFC 8446, 4.2.11
 */

static int
tlsext_psk_client_needs(SSL *s, uint16_t msg_type)
{
	return 0;
}

static int
tlsext_psk_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return 0;
}

static int
tlsext_psk_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	return CBS_skip(cbs, CBS_len(cbs));
}

static int
tlsext_psk_server_needs(SSL *s, uint16_t msg_type)
{
	return 0;
}

static int
tlsext_psk_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
{
	return 0;
}

static int
tlsext_psk_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
{
	return CBS_skip(cbs, CBS_len(cbs));
}

/*
 * QUIC transport parameters extension - RFC 9001 section 8.2.
 */

static int
tlsext_quic_transport_parameters_client_needs(SSL *s, uint16_t msg_type)
{
	return SSL_is_quic(s) && s->internal->quic_transport_params_len > 0;
}

static int
tlsext_quic_transport_parameters_client_build(SSL *s, uint16_t msg_type,
    CBB *cbb)
{
	if (!CBB_add_bytes(cbb, s->internal->quic_transport_params,
	    s->internal->quic_transport_params_len))
		return 0;

	return 1;
}

static int
tlsext_quic_transport_parameters_client_parse(SSL *s, uint16_t msg_type,
    CBS *cbs, int *alert)
{
	if (!SSL_is_quic(s)) {
		*alert = SSL_AD_UNSUPPORTED_EXTENSION;
		return 0;
	}

	if (!CBS_stow(cbs, &s->s3->peer_quic_transport_params,
	    &s->s3->peer_quic_transport_params_len))
		return 0;
	if (!CBS_skip(cbs, s->s3->peer_quic_transport_params_len))
		return 0;

	return 1;
}

static int
tlsext_quic_transport_parameters_server_needs(SSL *s, uint16_t msg_type)
{
	return SSL_is_quic(s) && s->internal->quic_transport_params_len > 0;
}

static int
tlsext_quic_transport_parameters_server_build(SSL *s, uint16_t msg_type,
    CBB *cbb)
{
	if (!CBB_add_bytes(cbb, s->internal->quic_transport_params,
	    s->internal->quic_transport_params_len))
		return 0;

	return 1;
}

static int
tlsext_quic_transport_parameters_server_parse(SSL *s, uint16_t msg_type,
    CBS *cbs, int *alert)
{
	if (!SSL_is_quic(s)) {
		*alert = SSL_AD_UNSUPPORTED_EXTENSION;
		return 0;
	}

	if (!CBS_stow(cbs, &s->s3->peer_quic_transport_params,
	    &s->s3->peer_quic_transport_params_len))
		return 0;
	if (!CBS_skip(cbs, s->s3->peer_quic_transport_params_len))
		return 0;

	return 1;
}

struct tls_extension_funcs {
	int (*needs)(SSL *s, uint16_t msg_type);
	int (*build)(SSL *s, uint16_t msg_type, CBB *cbb);
	int (*parse)(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
};
2018
2019
2020
2021
2022
2023
2024
2025
2026












































2027
2028
2029
2030
2031
2032
2033
			.parse = tlsext_srtp_client_parse,
		},
		.server = {
			.needs = tlsext_srtp_server_needs,
			.build = tlsext_srtp_server_build,
			.parse = tlsext_srtp_server_parse,
		},
	}
#endif /* OPENSSL_NO_SRTP */












































};

#define N_TLS_EXTENSIONS (sizeof(tls_extensions) / sizeof(*tls_extensions))

/* Ensure that extensions fit in a uint32_t bitmask. */
CTASSERT(N_TLS_EXTENSIONS <= (sizeof(uint32_t) * 8));








|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
			.parse = tlsext_srtp_client_parse,
		},
		.server = {
			.needs = tlsext_srtp_server_needs,
			.build = tlsext_srtp_server_build,
			.parse = tlsext_srtp_server_parse,
		},
	},
#endif /* OPENSSL_NO_SRTP */
	{
		.type = TLSEXT_TYPE_quic_transport_parameters,
		.messages = SSL_TLSEXT_MSG_CH | SSL_TLSEXT_MSG_EE,
		.client = {
			.needs = tlsext_quic_transport_parameters_client_needs,
			.build = tlsext_quic_transport_parameters_client_build,
			.parse = tlsext_quic_transport_parameters_client_parse,
		},
		.server = {
			.needs = tlsext_quic_transport_parameters_server_needs,
			.build = tlsext_quic_transport_parameters_server_build,
			.parse = tlsext_quic_transport_parameters_server_parse,
		},
	},
	{
		.type = TLSEXT_TYPE_psk_key_exchange_modes,
		.messages = SSL_TLSEXT_MSG_CH,
		.client = {
			.needs = tlsext_psk_kex_modes_client_needs,
			.build = tlsext_psk_kex_modes_client_build,
			.parse = tlsext_psk_kex_modes_client_parse,
		},
		.server = {
			.needs = tlsext_psk_kex_modes_server_needs,
			.build = tlsext_psk_kex_modes_server_build,
			.parse = tlsext_psk_kex_modes_server_parse,
		},
	},
	{
		/* MUST be last extension in CH per RFC 8446 section 4.2. */

		.type = TLSEXT_TYPE_pre_shared_key,
		.messages = SSL_TLSEXT_MSG_CH | SSL_TLSEXT_MSG_SH,
		.client = {
			.needs = tlsext_psk_client_needs,
			.build = tlsext_psk_client_build,
			.parse = tlsext_psk_client_parse,
		},
		.server = {
			.needs = tlsext_psk_server_needs,
			.build = tlsext_psk_server_build,
			.parse = tlsext_psk_server_parse,
		},
	},
};

#define N_TLS_EXTENSIONS (sizeof(tls_extensions) / sizeof(*tls_extensions))

/* Ensure that extensions fit in a uint32_t bitmask. */
CTASSERT(N_TLS_EXTENSIONS <= (sizeof(uint32_t) * 8));

2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
	size_t idx;

	if (tls_extension_find(type, &idx) == NULL)
		return 0;
	return ((s->s3->hs.extensions_seen & (1 << idx)) != 0);
}

static const struct tls_extension_funcs *
tlsext_funcs(const struct tls_extension *tlsext, int is_server)
{
	if (is_server)
		return &tlsext->server;

	return &tlsext->client;
}







|







2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
	size_t idx;

	if (tls_extension_find(type, &idx) == NULL)
		return 0;
	return ((s->s3->hs.extensions_seen & (1 << idx)) != 0);
}

const struct tls_extension_funcs *
tlsext_funcs(const struct tls_extension *tlsext, int is_server)
{
	if (is_server)
		return &tlsext->server;

	return &tlsext->client;
}
Changes to jni/libressl/ssl/ssl_tlsext.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_tlsext.h,v 1.27 2021/11/01 16:37:17 jsing Exp $ */
/*
 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_tlsext.h,v 1.32 2022/08/04 09:27:36 tb Exp $ */
/*
 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

139
140
141
#define SSL_TLSEXT_MSG_CT	0x0008	/* Certificate */
#define SSL_TLSEXT_MSG_CR	0x0010	/* CertificateRequest */
#define SSL_TLSEXT_MSG_NST	0x0020	/* NewSessionTicket */
#define SSL_TLSEXT_MSG_HRR	0x0040	/* HelloRetryRequest */

__BEGIN_HIDDEN_DECLS

int tlsext_alpn_client_needs(SSL *s, uint16_t msg_type);
int tlsext_alpn_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_alpn_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_alpn_server_needs(SSL *s, uint16_t msg_type);
int tlsext_alpn_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_alpn_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

int tlsext_ri_client_needs(SSL *s, uint16_t msg_type);
int tlsext_ri_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_ri_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_ri_server_needs(SSL *s, uint16_t msg_type);
int tlsext_ri_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_ri_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

int tlsext_sigalgs_client_needs(SSL *s, uint16_t msg_type);
int tlsext_sigalgs_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_sigalgs_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);
int tlsext_sigalgs_server_needs(SSL *s, uint16_t msg_type);
int tlsext_sigalgs_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_sigalgs_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);

int tlsext_sni_client_needs(SSL *s, uint16_t msg_type);
int tlsext_sni_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_sni_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_sni_server_needs(SSL *s, uint16_t msg_type);
int tlsext_sni_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_sni_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_sni_is_valid_hostname(CBS *cbs, int *is_ip);

int tlsext_supportedgroups_client_needs(SSL *s, uint16_t msg_type);
int tlsext_supportedgroups_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_supportedgroups_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);
int tlsext_supportedgroups_server_needs(SSL *s, uint16_t msg_type);
int tlsext_supportedgroups_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_supportedgroups_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);

int tlsext_ecpf_client_needs(SSL *s, uint16_t msg_type);
int tlsext_ecpf_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_ecpf_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_ecpf_server_needs(SSL *s, uint16_t msg_type);
int tlsext_ecpf_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_ecpf_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

int tlsext_ocsp_client_needs(SSL *s, uint16_t msg_type);
int tlsext_ocsp_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_ocsp_server_needs(SSL *s, uint16_t msg_type);
int tlsext_ocsp_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

int tlsext_sessionticket_client_needs(SSL *s, uint16_t msg_type);
int tlsext_sessionticket_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
     int *alert);
int tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type);
int tlsext_sessionticket_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);

int tlsext_versions_client_needs(SSL *s, uint16_t msg_type);
int tlsext_versions_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_versions_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);
int tlsext_versions_server_needs(SSL *s, uint16_t msg_type);
int tlsext_versions_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_versions_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);

int tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type);
int tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_keyshare_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);
int tlsext_keyshare_server_needs(SSL *s, uint16_t msg_type);
int tlsext_keyshare_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_keyshare_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
    int *alert);

int tlsext_cookie_client_needs(SSL *s, uint16_t msg_type);
int tlsext_cookie_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_cookie_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_cookie_server_needs(SSL *s, uint16_t msg_type);
int tlsext_cookie_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_cookie_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

#ifndef OPENSSL_NO_SRTP
int tlsext_srtp_client_needs(SSL *s, uint16_t msg_type);
int tlsext_srtp_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
int tlsext_srtp_server_needs(SSL *s, uint16_t msg_type);
int tlsext_srtp_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
#endif

int tlsext_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

int tlsext_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

const struct tls_extension *tls_extension_find(uint16_t, size_t *);
int tlsext_extension_seen(SSL *s, uint16_t);

__END_HIDDEN_DECLS

#endif







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






<

>



27
28
29
30
31
32
33
34




























35
36


































































37
38
39
40
41
42

43
44
45
46
47
#define SSL_TLSEXT_MSG_CT	0x0008	/* Certificate */
#define SSL_TLSEXT_MSG_CR	0x0010	/* CertificateRequest */
#define SSL_TLSEXT_MSG_NST	0x0020	/* NewSessionTicket */
#define SSL_TLSEXT_MSG_HRR	0x0040	/* HelloRetryRequest */

__BEGIN_HIDDEN_DECLS

int tlsext_alpn_check_format(CBS *cbs);




























int tlsext_sni_is_valid_hostname(CBS *cbs, int *is_ip);



































































int tlsext_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);

int tlsext_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
int tlsext_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);


int tlsext_extension_seen(SSL *s, uint16_t);

__END_HIDDEN_DECLS

#endif
Changes to jni/libressl/ssl/ssl_transcript.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
/* $OpenBSD: ssl_transcript.c,v 1.7 2022/03/17 17:22:16 jsing Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/ssl.h>

#include "ssl_locl.h"


int
tls1_transcript_hash_init(SSL *s)
{
	const unsigned char *data;
	const EVP_MD *md;
	size_t len;
|



















>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* $OpenBSD: ssl_transcript.c,v 1.8 2022/07/22 19:54:46 jsing Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/ssl.h>

#include "ssl_locl.h"
#include "tls_internal.h"

int
tls1_transcript_hash_init(SSL *s)
{
	const unsigned char *data;
	const EVP_MD *md;
	size_t len;
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178


179
180
181
182

183



184
185
186
187
188
189
190

int
tls1_transcript_init(SSL *s)
{
	if (s->s3->handshake_transcript != NULL)
		return 0;

	if ((s->s3->handshake_transcript = BUF_MEM_new()) == NULL)
		return 0;

	tls1_transcript_reset(s);

	return 1;
}

void
tls1_transcript_free(SSL *s)
{
	BUF_MEM_free(s->s3->handshake_transcript);
	s->s3->handshake_transcript = NULL;
}

void
tls1_transcript_reset(SSL *s)
{
	/*
	 * We should check the return value of BUF_MEM_grow_clean(), however
	 * due to yet another bad API design, when called with a length of zero
	 * it is impossible to tell if it succeeded (returning a length of zero)
	 * or if it failed (and returned zero)... our implementation never
	 * fails with a length of zero, so we trust all is okay...
	 */
	(void)BUF_MEM_grow_clean(s->s3->handshake_transcript, 0);

	tls1_transcript_unfreeze(s);
}

int
tls1_transcript_append(SSL *s, const unsigned char *buf, size_t len)
{
	size_t olen, nlen;

	if (s->s3->handshake_transcript == NULL)
		return 1;

	if (s->s3->flags & TLS1_FLAGS_FREEZE_TRANSCRIPT)
		return 1;

	olen = s->s3->handshake_transcript->length;
	nlen = olen + len;

	if (nlen < olen)
		return 0;

	if (BUF_MEM_grow(s->s3->handshake_transcript, nlen) == 0)
		return 0;

	memcpy(s->s3->handshake_transcript->data + olen, buf, len);

	return 1;
}

int
tls1_transcript_data(SSL *s, const unsigned char **data, size_t *len)
{


	if (s->s3->handshake_transcript == NULL)
		return 0;

	*data = s->s3->handshake_transcript->data;

	*len = s->s3->handshake_transcript->length;




	return 1;
}

void
tls1_transcript_freeze(SSL *s)
{







|










|






<
<
<
<
<
<
<
|







<
<






<
<
<
<
<
<
|
<
<
<
<
<





>
>



|
>
|
>
>
>







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139







140
141
142
143
144
145
146
147


148
149
150
151
152
153






154





155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

int
tls1_transcript_init(SSL *s)
{
	if (s->s3->handshake_transcript != NULL)
		return 0;

	if ((s->s3->handshake_transcript = tls_buffer_new(0)) == NULL)
		return 0;

	tls1_transcript_reset(s);

	return 1;
}

void
tls1_transcript_free(SSL *s)
{
	tls_buffer_free(s->s3->handshake_transcript);
	s->s3->handshake_transcript = NULL;
}

void
tls1_transcript_reset(SSL *s)
{







	tls_buffer_clear(s->s3->handshake_transcript);

	tls1_transcript_unfreeze(s);
}

int
tls1_transcript_append(SSL *s, const unsigned char *buf, size_t len)
{


	if (s->s3->handshake_transcript == NULL)
		return 1;

	if (s->s3->flags & TLS1_FLAGS_FREEZE_TRANSCRIPT)
		return 1;







	return tls_buffer_append(s->s3->handshake_transcript, buf, len);





}

int
tls1_transcript_data(SSL *s, const unsigned char **data, size_t *len)
{
	CBS cbs;

	if (s->s3->handshake_transcript == NULL)
		return 0;

	if (!tls_buffer_data(s->s3->handshake_transcript, &cbs))
		return 0;

	/* XXX - change to caller providing a CBS argument. */
	*data = CBS_data(&cbs);
	*len = CBS_len(&cbs);

	return 1;
}

void
tls1_transcript_freeze(SSL *s)
{
Changes to jni/libressl/ssl/ssl_txt.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_txt.c,v 1.31 2021/11/29 18:36:27 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_txt.c,v 1.35 2022/06/07 17:55:08 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

116
117
118
119
120

121
122
123
124
125

126
127
128
129


130
131
132
133
134

135
136

137
138
139
140

141
142

143
144
145
146

147
148

149
150
151
152

153
154
155
156
157
158

159
160
161
162

163
164
165
166
167

168
169

170
171

172
173

174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x)
{
	BIO *b;
	int ret;

	if ((b = BIO_new(BIO_s_file())) == NULL) {
		SSLerrorx(ERR_R_BUF_LIB);
		return (0);
	}
	BIO_set_fp(b, fp, BIO_NOCLOSE);
	ret = SSL_SESSION_print(b, x);
	BIO_free(b);
	return (ret);
}

int
SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
{
	unsigned int i;
	const char *s;

	if (x == NULL)
		goto err;

	if (BIO_puts(bp, "SSL-Session:\n") <= 0)
		goto err;

	s = ssl_version_string(x->ssl_version);
	if (BIO_printf(bp, "    Protocol  : %s\n", s) <= 0)

		goto err;

	if (x->cipher == NULL) {
		if (((x->cipher_id) & 0xff000000) == 0x02000000) {
			if (BIO_printf(bp, "    Cipher    : %06lX\n", x->cipher_id&0xffffff) <= 0)

				goto err;
		} else {
			if (BIO_printf(bp, "    Cipher    : %04lX\n", x->cipher_id&0xffff) <= 0)
				goto err;


		}
	} else {
		if (BIO_printf(bp, "    Cipher    : %s\n",((x->cipher == NULL)?"unknown":x->cipher->name)) <= 0)
			goto err;
	}

	if (BIO_puts(bp, "    Session-ID: ") <= 0)
		goto err;

	for (i = 0; i < x->session_id_length; i++) {
		if (BIO_printf(bp, "%02X", x->session_id[i]) <= 0)
			goto err;
	}

	if (BIO_puts(bp, "\n    Session-ID-ctx: ") <= 0)
		goto err;

	for (i = 0; i < x->sid_ctx_length; i++) {
		if (BIO_printf(bp, "%02X", x->sid_ctx[i]) <= 0)
			goto err;
	}

	if (BIO_puts(bp, "\n    Master-Key: ") <= 0)
		goto err;

	for (i = 0; i < (unsigned int)x->master_key_length; i++) {
		if (BIO_printf(bp, "%02X", x->master_key[i]) <= 0)
			goto err;
	}

	if (x->tlsext_tick_lifetime_hint) {
		if (BIO_printf(bp,
		    "\n    TLS session ticket lifetime hint: %u (seconds)",
		    x->tlsext_tick_lifetime_hint) <= 0)
			goto err;
	}

	if (x->tlsext_tick) {
		if (BIO_puts(bp, "\n    TLS session ticket:\n") <= 0)
			goto err;
		if (BIO_dump_indent(bp, (char *)x->tlsext_tick, x->tlsext_ticklen, 4) <= 0)

			goto err;
	}

	if (x->time != 0) {
		if (BIO_printf(bp, "\n    Start Time: %"PRId64, (int64_t)x->time) <= 0)

			goto err;
	}

	if (x->timeout != 0L) {
		if (BIO_printf(bp, "\n    Timeout   : %ld (sec)", x->timeout) <= 0)

			goto err;
	}

	if (BIO_puts(bp, "\n") <= 0)
		goto err;

	if (BIO_puts(bp, "    Verify return code: ") <= 0)
		goto err;

	if (BIO_printf(bp, "%ld (%s)\n", x->verify_result,
	    X509_verify_cert_error_string(x->verify_result)) <= 0)
		goto err;

	return (1);
 err:
	return (0);
}








|




|





|
|



>



<
|
>



<
|
>
|
|
|
|
>
>
|
<
|


>


>




>


>




>


>
|



>
|





>
|


|
>




|
>


>
|
|
>


>



|
<
<
|



|

|

<
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

120
121
122
123
124

125
126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192


193
194
195
196
197
198
199
200

SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x)
{
	BIO *b;
	int ret;

	if ((b = BIO_new(BIO_s_file())) == NULL) {
		SSLerrorx(ERR_R_BUF_LIB);
		return 0;
	}
	BIO_set_fp(b, fp, BIO_NOCLOSE);
	ret = SSL_SESSION_print(b, x);
	BIO_free(b);
	return ret;
}

int
SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
{
	size_t i;
	int ret = 0;

	if (x == NULL)
		goto err;

	if (BIO_puts(bp, "SSL-Session:\n") <= 0)
		goto err;


	if (BIO_printf(bp, "    Protocol  : %s\n",
	    ssl_version_string(x->ssl_version)) <= 0)
		goto err;

	if (x->cipher == NULL) {

		if (BIO_printf(bp, "    Cipher    : %04lX\n",
		    x->cipher_id & SSL3_CK_VALUE_MASK) <= 0)
			goto err;
	} else {
		const char *cipher_name = "unknown";

		if (x->cipher->name != NULL)
			cipher_name = x->cipher->name;


		if (BIO_printf(bp, "    Cipher    : %s\n", cipher_name) <= 0)
			goto err;
	}

	if (BIO_puts(bp, "    Session-ID: ") <= 0)
		goto err;

	for (i = 0; i < x->session_id_length; i++) {
		if (BIO_printf(bp, "%02X", x->session_id[i]) <= 0)
			goto err;
	}

	if (BIO_puts(bp, "\n    Session-ID-ctx: ") <= 0)
		goto err;

	for (i = 0; i < x->sid_ctx_length; i++) {
		if (BIO_printf(bp, "%02X", x->sid_ctx[i]) <= 0)
			goto err;
	}

	if (BIO_puts(bp, "\n    Master-Key: ") <= 0)
		goto err;

	for (i = 0; i < x->master_key_length; i++) {
		if (BIO_printf(bp, "%02X", x->master_key[i]) <= 0)
			goto err;
	}

	if (x->tlsext_tick_lifetime_hint > 0) {
		if (BIO_printf(bp,
		    "\n    TLS session ticket lifetime hint: %u (seconds)",
		    x->tlsext_tick_lifetime_hint) <= 0)
			goto err;
	}

	if (x->tlsext_tick != NULL) {
		if (BIO_puts(bp, "\n    TLS session ticket:\n") <= 0)
			goto err;
		if (BIO_dump_indent(bp, x->tlsext_tick, x->tlsext_ticklen,
		    4) <= 0)
			goto err;
	}

	if (x->time != 0) {
		if (BIO_printf(bp, "\n    Start Time: %"PRId64,
		    (int64_t)x->time) <= 0)
			goto err;
	}

	if (x->timeout != 0) {
		if (BIO_printf(bp, "\n    Timeout   : %ld (sec)",
		    x->timeout) <= 0)
			goto err;
	}

	if (BIO_puts(bp, "\n") <= 0)
		goto err;

	if (BIO_printf(bp, "    Verify return code: %ld (%s)\n",


	    x->verify_result,
	    X509_verify_cert_error_string(x->verify_result)) <= 0)
		goto err;

	ret = 1;
 err:
	return ret;
}

Changes to jni/libressl/ssl/ssl_versions.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_versions.c,v 1.22 2022/02/05 14:54:10 jsing Exp $ */
/*
 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: ssl_versions.c,v 1.24 2022/09/11 18:13:30 jsing Exp $ */
/*
 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
172
173
174
175
176
177
178








179
180
181
182
183
184
185
	if (min_version == 0 || max_version == 0)
		return 0;

	/* Limit to configured version range. */
	if (!ssl_clamp_tls_version_range(&min_version, &max_version,
	    s->internal->min_tls_version, s->internal->max_tls_version))
		return 0;









	if (min_ver != NULL)
		*min_ver = min_version;
	if (max_ver != NULL)
		*max_ver = max_version;

	return 1;







>
>
>
>
>
>
>
>







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
	if (min_version == 0 || max_version == 0)
		return 0;

	/* Limit to configured version range. */
	if (!ssl_clamp_tls_version_range(&min_version, &max_version,
	    s->internal->min_tls_version, s->internal->max_tls_version))
		return 0;

	/* QUIC requires a minimum of TLSv1.3. */
	if (SSL_is_quic(s)) {
		if (max_version < TLS1_3_VERSION)
			return 0;
		if (min_version < TLS1_3_VERSION)
			min_version = TLS1_3_VERSION;
	}

	if (min_ver != NULL)
		*min_ver = min_version;
	if (max_ver != NULL)
		*max_ver = max_version;

	return 1;
324
325
326
327
328
329
330



331
332
333
334
335
336
337
		 * The resulting shared version will by definition be something
		 * that we know about. Switch back from TLS to DTLS.
		 */
		shared_version = ssl_tls_to_dtls_version(shared_version);
		if (shared_version == 0)
			return 0;
	}




	*max_ver = shared_version;

	return 1;
}

int







>
>
>







332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
		 * The resulting shared version will by definition be something
		 * that we know about. Switch back from TLS to DTLS.
		 */
		shared_version = ssl_tls_to_dtls_version(shared_version);
		if (shared_version == 0)
			return 0;
	}

	if (!ssl_security_version(s, shared_version))
		return 0;

	*max_ver = shared_version;

	return 1;
}

int
348
349
350
351
352
353
354
355
356



357
358
359
360
361
362
363
364
365
366
367
			return 0;
	}

	if (!ssl_supported_tls_version_range(s, &min_tls_version,
	    &max_tls_version))
		return 0;

	return (server_tls_version >= min_tls_version &&
	    server_tls_version <= max_tls_version);



}

int
ssl_legacy_stack_version(SSL *s, uint16_t version)
{
	if (SSL_is_dtls(s))
		return version == DTLS1_VERSION || version == DTLS1_2_VERSION;

	return version == TLS1_VERSION || version == TLS1_1_VERSION ||
	    version == TLS1_2_VERSION;
}







|
|
>
>
>











359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
			return 0;
	}

	if (!ssl_supported_tls_version_range(s, &min_tls_version,
	    &max_tls_version))
		return 0;

	if (server_tls_version < min_tls_version ||
	    server_tls_version > max_tls_version)
		return 0;

	return ssl_security_version(s, server_tls_version);
}

int
ssl_legacy_stack_version(SSL *s, uint16_t version)
{
	if (SSL_is_dtls(s))
		return version == DTLS1_VERSION || version == DTLS1_2_VERSION;

	return version == TLS1_VERSION || version == TLS1_1_VERSION ||
	    version == TLS1_2_VERSION;
}
Changes to jni/libressl/ssl/t1_lib.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: t1_lib.c,v 1.186 2022/01/24 13:47:53 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: t1_lib.c,v 1.195 2022/08/17 18:45:25 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
146
147
148
149
150
151
152

153









154



155



156



157



158



159



160



161



162



163



164



165



166



167



168



169



170



171



172



173



174



175



176



177



178



179



180



181



182


183


184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
void
tls1_clear(SSL *s)
{
	ssl3_clear(s);
	s->version = s->method->version;
}


static const int nid_list[] = {









	NID_sect163k1,		/* sect163k1 (1) */



	NID_sect163r1,		/* sect163r1 (2) */



	NID_sect163r2,		/* sect163r2 (3) */



	NID_sect193r1,		/* sect193r1 (4) */



	NID_sect193r2,		/* sect193r2 (5) */



	NID_sect233k1,		/* sect233k1 (6) */



	NID_sect233r1,		/* sect233r1 (7) */



	NID_sect239k1,		/* sect239k1 (8) */



	NID_sect283k1,		/* sect283k1 (9) */



	NID_sect283r1,		/* sect283r1 (10) */



	NID_sect409k1,		/* sect409k1 (11) */



	NID_sect409r1,		/* sect409r1 (12) */



	NID_sect571k1,		/* sect571k1 (13) */



	NID_sect571r1,		/* sect571r1 (14) */



	NID_secp160k1,		/* secp160k1 (15) */



	NID_secp160r1,		/* secp160r1 (16) */



	NID_secp160r2,		/* secp160r2 (17) */



	NID_secp192k1,		/* secp192k1 (18) */



	NID_X9_62_prime192v1,	/* secp192r1 (19) */



	NID_secp224k1,		/* secp224k1 (20) */



	NID_secp224r1,		/* secp224r1 (21) */



	NID_secp256k1,		/* secp256k1 (22) */



	NID_X9_62_prime256v1,	/* secp256r1 (23) */



	NID_secp384r1,		/* secp384r1 (24) */



	NID_secp521r1,		/* secp521r1 (25) */



	NID_brainpoolP256r1,	/* brainpoolP256r1 (26) */



	NID_brainpoolP384r1,	/* brainpoolP384r1 (27) */



	NID_brainpoolP512r1,	/* brainpoolP512r1 (28) */



	NID_X25519,		/* X25519 (29) */


};



#if 0
static const uint8_t ecformats_list[] = {
	TLSEXT_ECPOINTFORMAT_uncompressed,
	TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime,
	TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2
};
#endif

static const uint8_t ecformats_default[] = {
	TLSEXT_ECPOINTFORMAT_uncompressed,
};

#if 0
static const uint16_t eccurves_list[] = {
	29,			/* X25519 (29) */
	14,			/* sect571r1 (14) */
	13,			/* sect571k1 (13) */
	25,			/* secp521r1 (25) */
	28,			/* brainpoolP512r1 (28) */
	11,			/* sect409k1 (11) */
	12,			/* sect409r1 (12) */







>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>
>
|
>
>

>
>














|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
void
tls1_clear(SSL *s)
{
	ssl3_clear(s);
	s->version = s->method->version;
}

struct supported_group {
	int nid;
	int bits;
};

/*
 * Supported groups (formerly known as named curves)
 * https://www.iana.org/assignments/tls-parameters/#tls-parameters-8
 */
static const struct supported_group nid_list[] = {
	[1] = {
		.nid = NID_sect163k1,
		.bits = 80,
	},
	[2] = {
		.nid = NID_sect163r1,
		.bits = 80,
	},
	[3] = {
		.nid = NID_sect163r2,
		.bits = 80,
	},
	[4] = {
		.nid = NID_sect193r1,
		.bits = 80,
	},
	[5] = {
		.nid = NID_sect193r2,
		.bits = 80,
	},
	[6] = {
		.nid = NID_sect233k1,
		.bits = 112,
	},
	[7] = {
		.nid = NID_sect233r1,
		.bits = 112,
	},
	[8] = {
		.nid = NID_sect239k1,
		.bits = 112,
	},
	[9] = {
		.nid = NID_sect283k1,
		.bits = 128,
	},
	[10] = {
		.nid = NID_sect283r1,
		.bits = 128,
	},
	[11] = {
		.nid = NID_sect409k1,
		.bits = 192,
	},
	[12] = {
		.nid = NID_sect409r1,
		.bits = 192,
	},
	[13] = {
		.nid = NID_sect571k1,
		.bits = 256,
	},
	[14] = {
		.nid = NID_sect571r1,
		.bits = 256,
	},
	[15] = {
		.nid = NID_secp160k1,
		.bits = 80,
	},
	[16] = {
		.nid = NID_secp160r1,
		.bits = 80,
	},
	[17] = {
		.nid = NID_secp160r2,
		.bits = 80,
	},
	[18] = {
		.nid = NID_secp192k1,
		.bits = 80,
	},
	[19] = {
		.nid = NID_X9_62_prime192v1,	/* aka secp192r1 */
		.bits = 80,
	},
	[20] = {
		.nid = NID_secp224k1,
		.bits = 112,
	},
	[21] = {
		.nid = NID_secp224r1,
		.bits = 112,
	},
	[22] = {
		.nid = NID_secp256k1,
		.bits = 128,
	},
	[23] = {
		.nid = NID_X9_62_prime256v1,	/* aka secp256r1 */
		.bits = 128,
	},
	[24] = {
		.nid = NID_secp384r1,
		.bits = 192,
	},
	[25] = {
		.nid = NID_secp521r1,
		.bits = 256,
	},
	[26] = {
		.nid = NID_brainpoolP256r1,
		.bits = 128,
	},
	[27] = {
		.nid = NID_brainpoolP384r1,
		.bits = 192,
	},
	[28] = {
		.nid = NID_brainpoolP512r1,
		.bits = 256,
	},
	[29] = {
		.nid = NID_X25519,
		.bits = 128,
	},
};

#define NID_LIST_LEN (sizeof(nid_list) / sizeof(nid_list[0]))

#if 0
static const uint8_t ecformats_list[] = {
	TLSEXT_ECPOINTFORMAT_uncompressed,
	TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime,
	TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2
};
#endif

static const uint8_t ecformats_default[] = {
	TLSEXT_ECPOINTFORMAT_uncompressed,
};

#if 0
static const uint16_t ecgroups_list[] = {
	29,			/* X25519 (29) */
	14,			/* sect571r1 (14) */
	13,			/* sect571k1 (13) */
	25,			/* secp521r1 (25) */
	28,			/* brainpoolP512r1 (28) */
	11,			/* sect409k1 (11) */
	12,			/* sect409r1 (12) */
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246

247
248

249

250



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
280
281
282

283
284
285
286
287

288
289
290
291
292
293
294
295


296


297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
	3,			/* sect163r2 (3) */
	15,			/* secp160k1 (15) */
	16,			/* secp160r1 (16) */
	17,			/* secp160r2 (17) */
};
#endif

static const uint16_t eccurves_client_default[] = {
	29,			/* X25519 (29) */
	23,			/* secp256r1 (23) */
	24,			/* secp384r1 (24) */
	25,			/* secp521r1 (25) */
};

static const uint16_t eccurves_server_default[] = {
	29,			/* X25519 (29) */
	23,			/* secp256r1 (23) */
	24,			/* secp384r1 (24) */
};

int
tls1_ec_curve_id2nid(const uint16_t curve_id)
{

	/* ECC curves from draft-ietf-tls-ecc-12.txt (Oct. 17, 2005) */
	if ((curve_id < 1) ||

	    ((unsigned int)curve_id > sizeof(nid_list) / sizeof(nid_list[0])))

		return 0;



	return nid_list[curve_id - 1];
}

uint16_t
tls1_ec_nid2curve_id(const int nid)
{
	/* ECC curves from draft-ietf-tls-ecc-12.txt (Oct. 17, 2005) */
	switch (nid) {
	case NID_sect163k1: /* sect163k1 (1) */
		return 1;
	case NID_sect163r1: /* sect163r1 (2) */
		return 2;
	case NID_sect163r2: /* sect163r2 (3) */
		return 3;
	case NID_sect193r1: /* sect193r1 (4) */
		return 4;
	case NID_sect193r2: /* sect193r2 (5) */
		return 5;
	case NID_sect233k1: /* sect233k1 (6) */
		return 6;
	case NID_sect233r1: /* sect233r1 (7) */

		return 7;
	case NID_sect239k1: /* sect239k1 (8) */
		return 8;
	case NID_sect283k1: /* sect283k1 (9) */
		return 9;
	case NID_sect283r1: /* sect283r1 (10) */
		return 10;
	case NID_sect409k1: /* sect409k1 (11) */
		return 11;
	case NID_sect409r1: /* sect409r1 (12) */
		return 12;

	case NID_sect571k1: /* sect571k1 (13) */
		return 13;
	case NID_sect571r1: /* sect571r1 (14) */
		return 14;
	case NID_secp160k1: /* secp160k1 (15) */

		return 15;
	case NID_secp160r1: /* secp160r1 (16) */
		return 16;
	case NID_secp160r2: /* secp160r2 (17) */
		return 17;
	case NID_secp192k1: /* secp192k1 (18) */
		return 18;
	case NID_X9_62_prime192v1: /* secp192r1 (19) */


		return 19;


	case NID_secp224k1: /* secp224k1 (20) */
		return 20;
	case NID_secp224r1: /* secp224r1 (21) */
		return 21;
	case NID_secp256k1: /* secp256k1 (22) */
		return 22;
	case NID_X9_62_prime256v1: /* secp256r1 (23) */
		return 23;
	case NID_secp384r1: /* secp384r1 (24) */
		return 24;
	case NID_secp521r1: /* secp521r1 (25) */
		return 25;
	case NID_brainpoolP256r1: /* brainpoolP256r1 (26) */
		return 26;
	case NID_brainpoolP384r1: /* brainpoolP384r1 (27) */
		return 27;
	case NID_brainpoolP512r1: /* brainpoolP512r1 (28) */
		return 28;
	case NID_X25519:		/* X25519 (29) */
		return 29;
	default:
		return 0;
	}
}

/*
 * Return the appropriate format list. If client_formats is non-zero, return
 * the client/session formats. Otherwise return the custom format list if one
 * exists, or the default formats if a custom list has not been specified.
 */
void
tls1_get_formatlist(SSL *s, int client_formats, const uint8_t **pformats,
    size_t *pformatslen)
{
	if (client_formats != 0) {
		*pformats = s->session->tlsext_ecpointformatlist;
		*pformatslen = s->session->tlsext_ecpointformatlist_length;
		return;
	}







|






|






|

>
|
|
>
|
>

>
>
>
|


|
|

<
|
|
<
|
|
|
<
<
<
<
|
<
|
|
>
|
<
<
<
<
<
<
<
<
<
|
>
|
|
<
|
<
>
|
|
|
<
|
|
<
|
>
>
|
>
>
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<








|







322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360

361
362

363
364
365




366

367
368
369
370









371
372
373
374

375

376
377
378
379

380
381

382
383
384
385
386
387
388




















389

390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
	3,			/* sect163r2 (3) */
	15,			/* secp160k1 (15) */
	16,			/* secp160r1 (16) */
	17,			/* secp160r2 (17) */
};
#endif

static const uint16_t ecgroups_client_default[] = {
	29,			/* X25519 (29) */
	23,			/* secp256r1 (23) */
	24,			/* secp384r1 (24) */
	25,			/* secp521r1 (25) */
};

static const uint16_t ecgroups_server_default[] = {
	29,			/* X25519 (29) */
	23,			/* secp256r1 (23) */
	24,			/* secp384r1 (24) */
};

int
tls1_ec_group_id2nid(uint16_t group_id, int *out_nid)
{
	int nid;

	if (group_id >= NID_LIST_LEN)
		return 0;

	if ((nid = nid_list[group_id].nid) == 0)
		return 0;

	*out_nid = nid;

	return 1;
}

int
tls1_ec_group_id2bits(uint16_t group_id, int *out_bits)
{

	int bits;


	if (group_id >= NID_LIST_LEN)
		return 0;





	if ((bits = nid_list[group_id].bits) == 0)

		return 0;

	*out_bits = bits;










	return 1;
}

int

tls1_ec_nid2group_id(int nid, uint16_t *out_group_id)

{
	uint16_t group_id;

	if (nid == 0)

		return 0;


	for (group_id = 0; group_id < NID_LIST_LEN; group_id++) {
		if (nid_list[group_id].nid == nid) {
			*out_group_id = group_id;
			return 1;
		}
	}





















	return 0;

}

/*
 * Return the appropriate format list. If client_formats is non-zero, return
 * the client/session formats. Otherwise return the custom format list if one
 * exists, or the default formats if a custom list has not been specified.
 */
void
tls1_get_formatlist(const SSL *s, int client_formats, const uint8_t **pformats,
    size_t *pformatslen)
{
	if (client_formats != 0) {
		*pformats = s->session->tlsext_ecpointformatlist;
		*pformatslen = s->session->tlsext_ecpointformatlist_length;
		return;
	}
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371






























































































372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394

/*
 * Return the appropriate group list. If client_groups is non-zero, return
 * the client/session groups. Otherwise return the custom group list if one
 * exists, or the default groups if a custom list has not been specified.
 */
void
tls1_get_group_list(SSL *s, int client_groups, const uint16_t **pgroups,
    size_t *pgroupslen)
{
	if (client_groups != 0) {
		*pgroups = s->session->tlsext_supportedgroups;
		*pgroupslen = s->session->tlsext_supportedgroups_length;
		return;
	}

	*pgroups = s->internal->tlsext_supportedgroups;
	*pgroupslen = s->internal->tlsext_supportedgroups_length;
	if (*pgroups != NULL)
		return;

	if (!s->server) {
		*pgroups = eccurves_client_default;
		*pgroupslen = sizeof(eccurves_client_default) / 2;
	} else {
		*pgroups = eccurves_server_default;
		*pgroupslen = sizeof(eccurves_server_default) / 2;
	}






























































































}

int
tls1_set_groups(uint16_t **out_group_ids, size_t *out_group_ids_len,
    const int *groups, size_t ngroups)
{
	uint16_t *group_ids;
	size_t i;

	group_ids = calloc(ngroups, sizeof(uint16_t));
	if (group_ids == NULL)
		return 0;

	for (i = 0; i < ngroups; i++) {
		group_ids[i] = tls1_ec_nid2curve_id(groups[i]);
		if (group_ids[i] == 0) {
			free(group_ids);
			return 0;
		}
	}

	free(*out_group_ids);
	*out_group_ids = group_ids;







|














|
|

|
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









|
<



|
<







414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545

546
547
548
549

550
551
552
553
554
555
556

/*
 * Return the appropriate group list. If client_groups is non-zero, return
 * the client/session groups. Otherwise return the custom group list if one
 * exists, or the default groups if a custom list has not been specified.
 */
void
tls1_get_group_list(const SSL *s, int client_groups, const uint16_t **pgroups,
    size_t *pgroupslen)
{
	if (client_groups != 0) {
		*pgroups = s->session->tlsext_supportedgroups;
		*pgroupslen = s->session->tlsext_supportedgroups_length;
		return;
	}

	*pgroups = s->internal->tlsext_supportedgroups;
	*pgroupslen = s->internal->tlsext_supportedgroups_length;
	if (*pgroups != NULL)
		return;

	if (!s->server) {
		*pgroups = ecgroups_client_default;
		*pgroupslen = sizeof(ecgroups_client_default) / 2;
	} else {
		*pgroups = ecgroups_server_default;
		*pgroupslen = sizeof(ecgroups_server_default) / 2;
	}
}

static int
tls1_get_group_lists(const SSL *ssl, const uint16_t **pref, size_t *preflen,
    const uint16_t **supp, size_t *supplen)
{
	unsigned long server_pref;

	/* Cannot do anything on the client side. */
	if (!ssl->server)
		return 0;

	server_pref = (ssl->internal->options & SSL_OP_CIPHER_SERVER_PREFERENCE);
	tls1_get_group_list(ssl, (server_pref == 0), pref, preflen);
	tls1_get_group_list(ssl, (server_pref != 0), supp, supplen);

	return 1;
}

static int
tls1_group_id_present(uint16_t group_id, const uint16_t *list, size_t list_len)
{
	size_t i;

	for (i = 0; i < list_len; i++) {
		if (group_id == list[i])
			return 1;
	}

	return 0;
}

int
tls1_count_shared_groups(const SSL *ssl, size_t *out_count)
{
	size_t count, preflen, supplen, i;
	const uint16_t *pref, *supp;

	if (!tls1_get_group_lists(ssl, &pref, &preflen, &supp, &supplen))
		return 0;

	count = 0;
	for (i = 0; i < preflen; i++) {
		if (!tls1_group_id_present(pref[i], supp, supplen))
			continue;

		if (!ssl_security_shared_group(ssl, pref[i]))
			continue;

		count++;
	}

	*out_count = count;

	return 1;
}

static int
tls1_group_by_index(const SSL *ssl, size_t n, int *out_nid,
    int (*ssl_security_fn)(const SSL *, uint16_t))
{
	size_t count, preflen, supplen, i;
	const uint16_t *pref, *supp;

	if (!tls1_get_group_lists(ssl, &pref, &preflen, &supp, &supplen))
		return 0;

	count = 0;
	for (i = 0; i < preflen; i++) {
		if (!tls1_group_id_present(pref[i], supp, supplen))
			continue;

		if (!ssl_security_fn(ssl, pref[i]))
			continue;

		if (count++ == n)
			return tls1_ec_group_id2nid(pref[i], out_nid);
	}

	return 0;
}

int
tls1_get_shared_group_by_index(const SSL *ssl, size_t index, int *out_nid)
{
	return tls1_group_by_index(ssl, index, out_nid,
	    ssl_security_shared_group);
}

int
tls1_get_supported_group(const SSL *ssl, int *out_nid)
{
	return tls1_group_by_index(ssl, 0, out_nid,
	    ssl_security_supported_group);
}

int
tls1_set_groups(uint16_t **out_group_ids, size_t *out_group_ids_len,
    const int *groups, size_t ngroups)
{
	uint16_t *group_ids;
	size_t i;

	if ((group_ids = calloc(ngroups, sizeof(uint16_t))) == NULL)

		return 0;

	for (i = 0; i < ngroups; i++) {
		if (!tls1_ec_nid2group_id(groups[i], &group_ids[i])) {

			free(group_ids);
			return 0;
		}
	}

	free(*out_group_ids);
	*out_group_ids = group_ids;
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457


458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
			goto err;

		if ((new_group_ids = reallocarray(group_ids, ngroups + 1,
		    sizeof(uint16_t))) == NULL)
			goto err;
		group_ids = new_group_ids;

		group_ids[ngroups] = tls1_ec_nid2curve_id(nid);
		if (group_ids[ngroups] == 0)
			goto err;

		ngroups++;
	}

	free(gs);
	free(*out_group_ids);
	*out_group_ids = group_ids;
	*out_group_ids_len = ngroups;

	return 1;

 err:
	free(gs);
	free(group_ids);

	return 0;
}

/* Check that a curve is one of our preferences. */
int
tls1_check_curve(SSL *s, const uint16_t curve_id)
{
	const uint16_t *groups;
	size_t groupslen, i;

	tls1_get_group_list(s, 0, &groups, &groupslen);

	for (i = 0; i < groupslen; i++) {


		if (groups[i] == curve_id)
			return (1);
	}
	return (0);
}

int
tls1_get_shared_curve(SSL *s)
{
	size_t preflen, supplen, i, j;
	const uint16_t *pref, *supp;
	unsigned long server_pref;

	/* Cannot do anything on the client side. */
	if (s->server == 0)
		return (NID_undef);

	/* Return first preference shared curve. */
	server_pref = (s->internal->options & SSL_OP_CIPHER_SERVER_PREFERENCE);
	tls1_get_group_list(s, (server_pref == 0), &pref, &preflen);
	tls1_get_group_list(s, (server_pref != 0), &supp, &supplen);

	for (i = 0; i < preflen; i++) {
		for (j = 0; j < supplen; j++) {
			if (pref[i] == supp[j])
				return (tls1_ec_curve_id2nid(pref[i]));
		}
	}
	return (NID_undef);
}

/* For an EC key set TLS ID and required compression based on parameters. */
static int
tls1_set_ec_id(uint16_t *curve_id, uint8_t *comp_id, EC_KEY *ec)
{
	const EC_GROUP *grp;
	const EC_METHOD *meth;
	int prime_field;
	int nid;

	if (ec == NULL)
		return (0);

	/* Determine whether the curve is defined over a prime field. */
	if ((grp = EC_KEY_get0_group(ec)) == NULL)
		return (0);
	if ((meth = EC_GROUP_method_of(grp)) == NULL)
		return (0);
	prime_field = (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field);

	/* Determine curve ID - NID_undef results in a curve ID of zero. */
	nid = EC_GROUP_get_curve_name(grp);
	/* If we have an ID set it, otherwise set arbitrary explicit curve. */
	if ((*curve_id = tls1_ec_nid2curve_id(nid)) == 0)
		*curve_id = prime_field ? 0xff01 : 0xff02;

	if (comp_id == NULL)
		return (1);

	/* Specify the compression identifier. */
	if (EC_KEY_get0_public_key(ec) == NULL)
		return (0);
	*comp_id = TLSEXT_ECPOINTFORMAT_uncompressed;
	if (EC_KEY_get_conv_form(ec) == POINT_CONVERSION_COMPRESSED) {
		*comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2;
		if (prime_field)
			*comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	}

	return (1);
}

/* Check that an EC key is compatible with extensions. */
static int
tls1_check_ec_key(SSL *s, const uint16_t *curve_id, const uint8_t *comp_id)
{
	size_t groupslen, formatslen, i;
	const uint16_t *groups;
	const uint8_t *formats;

	/*
	 * Check point formats extension if present, otherwise everything
	 * is supported (see RFC4492).
	 */
	tls1_get_formatlist(s, 1, &formats, &formatslen);
	if (comp_id != NULL && formats != NULL) {
		for (i = 0; i < formatslen; i++) {
			if (formats[i] == *comp_id)
				break;
		}
		if (i == formatslen)
			return (0);
	}

	/*
	 * Check curve list if present, otherwise everything is supported.
	 */
	tls1_get_group_list(s, 1, &groups, &groupslen);
	if (curve_id != NULL && groups != NULL) {
		for (i = 0; i < groupslen; i++) {
			if (groups[i] == *curve_id)
				break;
		}
		if (i == groupslen)
			return (0);
	}

	return (1);
}

/* Check EC server key is compatible with client extensions. */
int
tls1_check_ec_server_key(SSL *s)
{
	SSL_CERT_PKEY *cpk = s->cert->pkeys + SSL_PKEY_ECC;
	uint16_t curve_id;
	uint8_t comp_id;
	EC_KEY *eckey;
	EVP_PKEY *pkey;

	if (cpk->x509 == NULL || cpk->privatekey == NULL)
		return (0);
	if ((pkey = X509_get0_pubkey(cpk->x509)) == NULL)
		return (0);
	if ((eckey = EVP_PKEY_get0_EC_KEY(pkey)) == NULL)
		return (0);
	if (!tls1_set_ec_id(&curve_id, &comp_id, eckey))
		return (0);

	return tls1_check_ec_key(s, &curve_id, &comp_id);
}

int
ssl_check_clienthello_tlsext_early(SSL *s)
{
	int ret = SSL_TLSEXT_ERR_NOACK;
	int al = SSL_AD_UNRECOGNIZED_NAME;







<
|



















|

|







>
>
|
|

|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


|









|






|

|
|
|



















|




















|


|

|














|










|


|







582
583
584
585
586
587
588

589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626

























627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
			goto err;

		if ((new_group_ids = reallocarray(group_ids, ngroups + 1,
		    sizeof(uint16_t))) == NULL)
			goto err;
		group_ids = new_group_ids;


		if (!tls1_ec_nid2group_id(nid, &group_ids[ngroups]))
			goto err;

		ngroups++;
	}

	free(gs);
	free(*out_group_ids);
	*out_group_ids = group_ids;
	*out_group_ids_len = ngroups;

	return 1;

 err:
	free(gs);
	free(group_ids);

	return 0;
}

/* Check that a group is one of our preferences. */
int
tls1_check_group(SSL *s, uint16_t group_id)
{
	const uint16_t *groups;
	size_t groupslen, i;

	tls1_get_group_list(s, 0, &groups, &groupslen);

	for (i = 0; i < groupslen; i++) {
		if (!ssl_security_supported_group(s, groups[i]))
			continue;
		if (groups[i] == group_id)
			return 1;
	}
	return 0;
}


























/* For an EC key set TLS ID and required compression based on parameters. */
static int
tls1_set_ec_id(uint16_t *group_id, uint8_t *comp_id, EC_KEY *ec)
{
	const EC_GROUP *grp;
	const EC_METHOD *meth;
	int prime_field;
	int nid;

	if (ec == NULL)
		return (0);

	/* Determine whether the group is defined over a prime field. */
	if ((grp = EC_KEY_get0_group(ec)) == NULL)
		return (0);
	if ((meth = EC_GROUP_method_of(grp)) == NULL)
		return (0);
	prime_field = (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field);

	/* Determine group ID. */
	nid = EC_GROUP_get_curve_name(grp);
	/* If we have an ID set it, otherwise set arbitrary explicit group. */
	if (!tls1_ec_nid2group_id(nid, group_id))
		*group_id = prime_field ? 0xff01 : 0xff02;

	if (comp_id == NULL)
		return (1);

	/* Specify the compression identifier. */
	if (EC_KEY_get0_public_key(ec) == NULL)
		return (0);
	*comp_id = TLSEXT_ECPOINTFORMAT_uncompressed;
	if (EC_KEY_get_conv_form(ec) == POINT_CONVERSION_COMPRESSED) {
		*comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2;
		if (prime_field)
			*comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	}

	return (1);
}

/* Check that an EC key is compatible with extensions. */
static int
tls1_check_ec_key(SSL *s, const uint16_t *group_id, const uint8_t *comp_id)
{
	size_t groupslen, formatslen, i;
	const uint16_t *groups;
	const uint8_t *formats;

	/*
	 * Check point formats extension if present, otherwise everything
	 * is supported (see RFC4492).
	 */
	tls1_get_formatlist(s, 1, &formats, &formatslen);
	if (comp_id != NULL && formats != NULL) {
		for (i = 0; i < formatslen; i++) {
			if (formats[i] == *comp_id)
				break;
		}
		if (i == formatslen)
			return (0);
	}

	/*
	 * Check group list if present, otherwise everything is supported.
	 */
	tls1_get_group_list(s, 1, &groups, &groupslen);
	if (group_id != NULL && groups != NULL) {
		for (i = 0; i < groupslen; i++) {
			if (groups[i] == *group_id)
				break;
		}
		if (i == groupslen)
			return (0);
	}

	return (1);
}

/* Check EC server key is compatible with client extensions. */
int
tls1_check_ec_server_key(SSL *s)
{
	SSL_CERT_PKEY *cpk = s->cert->pkeys + SSL_PKEY_ECC;
	uint16_t group_id;
	uint8_t comp_id;
	EC_KEY *eckey;
	EVP_PKEY *pkey;

	if (cpk->x509 == NULL || cpk->privatekey == NULL)
		return (0);
	if ((pkey = X509_get0_pubkey(cpk->x509)) == NULL)
		return (0);
	if ((eckey = EVP_PKEY_get0_EC_KEY(pkey)) == NULL)
		return (0);
	if (!tls1_set_ec_id(&group_id, &comp_id, eckey))
		return (0);

	return tls1_check_ec_key(s, &group_id, &comp_id);
}

int
ssl_check_clienthello_tlsext_early(SSL *s)
{
	int ret = SSL_TLSEXT_ERR_NOACK;
	int al = SSL_AD_UNRECOGNIZED_NAME;
Changes to jni/libressl/ssl/tls12_lib.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: tls12_lib.c,v 1.4 2022/02/05 14:54:10 jsing Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: tls12_lib.c,v 1.5 2022/06/07 17:19:09 tb Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    size_t *out_len)
{
	uint8_t transcript_hash[EVP_MAX_MD_SIZE];
	size_t transcript_hash_len;

	*out_len = 0;

	if (s->session->master_key_length <= 0)
		return 0;

	if (verify_data_len < TLS1_FINISH_MAC_LENGTH)
		return 0;

	if (!tls1_transcript_hash_value(s, transcript_hash,
	    sizeof(transcript_hash), &transcript_hash_len))







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    size_t *out_len)
{
	uint8_t transcript_hash[EVP_MAX_MD_SIZE];
	size_t transcript_hash_len;

	*out_len = 0;

	if (s->session->master_key_length == 0)
		return 0;

	if (verify_data_len < TLS1_FINISH_MAC_LENGTH)
		return 0;

	if (!tls1_transcript_hash_value(s, transcript_hash,
	    sizeof(transcript_hash), &transcript_hash_len))
Changes to jni/libressl/ssl/tls13_client.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_client.c,v 1.94 2022/02/03 16:33:12 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_client.c,v 1.99 2022/09/11 14:33:07 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
144
145
146
147
148
149
150
151
152
153
154
155

156

157
158
159
160
161
162
163

	return 1;
}

int
tls13_client_hello_sent(struct tls13_ctx *ctx)
{
	tls13_record_layer_allow_ccs(ctx->rl, 1);

	tls1_transcript_freeze(ctx->ssl);

	if (ctx->middlebox_compat)

		ctx->send_dummy_ccs = 1;


	return 1;
}

static int
tls13_server_hello_is_legacy(CBS *cbs)
{







<
<


|
>

>







144
145
146
147
148
149
150


151
152
153
154
155
156
157
158
159
160
161
162
163

	return 1;
}

int
tls13_client_hello_sent(struct tls13_ctx *ctx)
{


	tls1_transcript_freeze(ctx->ssl);

	if (ctx->middlebox_compat) {
		tls13_record_layer_allow_ccs(ctx->rl, 1);
		ctx->send_dummy_ccs = 1;
	}

	return 1;
}

static int
tls13_server_hello_is_legacy(CBS *cbs)
{
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
	    shared_key_len, &context))
		goto err;

	tls13_record_layer_set_aead(ctx->rl, ctx->aead);
	tls13_record_layer_set_hash(ctx->rl, ctx->hash);

	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->server_handshake_traffic))
		goto err;
	if (!tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->client_handshake_traffic))
		goto err;

	ret = 1;

 err:
	freezero(shared_key, shared_key_len);








|


|







378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
	    shared_key_len, &context))
		goto err;

	tls13_record_layer_set_aead(ctx->rl, ctx->aead);
	tls13_record_layer_set_hash(ctx->rl, ctx->hash);

	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->server_handshake_traffic, ssl_encryption_handshake))
		goto err;
	if (!tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->client_handshake_traffic, ssl_encryption_handshake))
		goto err;

	ret = 1;

 err:
	freezero(shared_key, shared_key_len);

436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
tls13_client_hello_retry_send(struct tls13_ctx *ctx, CBB *cbb)
{
	/*
	 * Ensure that the server supported group is one that we listed in our
	 * supported groups and is not the same as the key share we previously
	 * offered.
	 */
	if (!tls1_check_curve(ctx->ssl, ctx->hs->tls13.server_group))
		return 0; /* XXX alert */
	if (ctx->hs->tls13.server_group == tls_key_share_group(ctx->hs->key_share))
		return 0; /* XXX alert */

	/* Switch to new key share. */
	tls_key_share_free(ctx->hs->key_share);
	if ((ctx->hs->key_share =







|







436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
tls13_client_hello_retry_send(struct tls13_ctx *ctx, CBB *cbb)
{
	/*
	 * Ensure that the server supported group is one that we listed in our
	 * supported groups and is not the same as the key share we previously
	 * offered.
	 */
	if (!tls1_check_group(ctx->ssl, ctx->hs->tls13.server_group))
		return 0; /* XXX alert */
	if (ctx->hs->tls13.server_group == tls_key_share_group(ctx->hs->key_share))
		return 0; /* XXX alert */

	/* Switch to new key share. */
	tls_key_share_free(ctx->hs->key_share);
	if ((ctx->hs->key_share =
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
int
tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	int alert_desc;

	if (!tlsext_client_parse(ctx->ssl, SSL_TLSEXT_MSG_EE, cbs, &alert_desc)) {
		ctx->alert = alert_desc;
		goto err;
	}

	return 1;

 err:
	if (ctx->alert == 0)
		ctx->alert = TLS13_ALERT_DECODE_ERROR;

	return 0;
}

int
tls13_server_certificate_request_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	CBS cert_request_context;
	int alert_desc;







|



<
<
<
<
<
<







500
501
502
503
504
505
506
507
508
509
510






511
512
513
514
515
516
517
int
tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	int alert_desc;

	if (!tlsext_client_parse(ctx->ssl, SSL_TLSEXT_MSG_EE, cbs, &alert_desc)) {
		ctx->alert = alert_desc;
		return 0;
	}

	return 1;






}

int
tls13_server_certificate_request_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	CBS cert_request_context;
	int alert_desc;
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
int
tls13_server_certificate_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	CBS cert_request_context, cert_list, cert_data;
	struct stack_st_X509 *certs = NULL;
	SSL *s = ctx->ssl;
	X509 *cert = NULL;
	EVP_PKEY *pkey;
	const uint8_t *p;
	int alert_desc, cert_type;
	int ret = 0;

	if ((certs = sk_X509_new_null()) == NULL)
		goto err;

	if (!CBS_get_u8_length_prefixed(cbs, &cert_request_context))
		goto err;







<

|







549
550
551
552
553
554
555

556
557
558
559
560
561
562
563
564
int
tls13_server_certificate_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	CBS cert_request_context, cert_list, cert_data;
	struct stack_st_X509 *certs = NULL;
	SSL *s = ctx->ssl;
	X509 *cert = NULL;

	const uint8_t *p;
	int alert_desc;
	int ret = 0;

	if ((certs = sk_X509_new_null()) == NULL)
		goto err;

	if (!CBS_get_u8_length_prefixed(cbs, &cert_request_context))
		goto err;
612
613
614
615
616
617
618

619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
	if (ssl_verify_cert_chain(s, certs) <= 0 &&
	    s->verify_mode != SSL_VERIFY_NONE) {
		ctx->alert = ssl_verify_alarm_type(s->verify_result);
		tls13_set_errorx(ctx, TLS13_ERR_VERIFY_FAILED, 0,
		    "failed to verify peer certificate", NULL);
		goto err;
	}

	ERR_clear_error();

	cert = sk_X509_value(certs, 0);
	X509_up_ref(cert);

	if ((pkey = X509_get0_pubkey(cert)) == NULL)
		goto err;
	if (EVP_PKEY_missing_parameters(pkey))
		goto err;
	if ((cert_type = ssl_cert_type(pkey)) < 0)
		goto err;

	X509_up_ref(cert);
	X509_free(s->session->peer_cert);
	s->session->peer_cert = cert;
	s->session->peer_cert_type = cert_type;

	s->session->verify_result = s->verify_result;

	sk_X509_pop_free(s->session->cert_chain, X509_free);
	s->session->cert_chain = certs;
	certs = NULL;

	if (ctx->ocsp_status_recv_cb != NULL &&
	    !ctx->ocsp_status_recv_cb(ctx))
		goto err;

	ret = 1;








>


<
<
|
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







605
606
607
608
609
610
611
612
613
614


615

616















617
618
619
620
621
622
623
	if (ssl_verify_cert_chain(s, certs) <= 0 &&
	    s->verify_mode != SSL_VERIFY_NONE) {
		ctx->alert = ssl_verify_alarm_type(s->verify_result);
		tls13_set_errorx(ctx, TLS13_ERR_VERIFY_FAILED, 0,
		    "failed to verify peer certificate", NULL);
		goto err;
	}
	s->session->verify_result = s->verify_result;
	ERR_clear_error();



	if (!tls_process_peer_certs(s, certs))

		goto err;
















	if (ctx->ocsp_status_recv_cb != NULL &&
	    !ctx->ocsp_status_recv_cb(ctx))
		goto err;

	ret = 1;

803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
		goto err;

	/*
	 * Any records following the server finished message must be encrypted
	 * using the server application traffic keys.
	 */
	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->server_application_traffic))
		goto err;

	tls13_record_layer_allow_ccs(ctx->rl, 0);

	ret = 1;

 err:







|







779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
		goto err;

	/*
	 * Any records following the server finished message must be encrypted
	 * using the server application traffic keys.
	 */
	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->server_application_traffic, ssl_encryption_application))
		goto err;

	tls13_record_layer_allow_ccs(ctx->rl, 0);

	ret = 1;

 err:
1082
1083
1084
1085
1086
1087
1088
1089
1090
	struct tls13_secrets *secrets = ctx->hs->tls13.secrets;

	/*
	 * Any records following the client finished message must be encrypted
	 * using the client application traffic keys.
	 */
	return tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->client_application_traffic);
}







|

1058
1059
1060
1061
1062
1063
1064
1065
1066
	struct tls13_secrets *secrets = ctx->hs->tls13.secrets;

	/*
	 * Any records following the client finished message must be encrypted
	 * using the client application traffic keys.
	 */
	return tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->client_application_traffic, ssl_encryption_application);
}
Changes to jni/libressl/ssl/tls13_handshake.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: tls13_handshake.c,v 1.70 2021/09/16 19:25:30 jsing Exp $	*/
/*
 * Copyright (c) 2018-2021 Theo Buehler <tb@openbsd.org>
 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: tls13_handshake.c,v 1.71 2022/04/19 17:01:43 tb Exp $	*/
/*
 * Copyright (c) 2018-2021 Theo Buehler <tb@openbsd.org>
 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
		return "Certificate";
	case TLS13_MT_CERTIFICATE_REQUEST:
		return "CertificateRequest";
	case TLS13_MT_CERTIFICATE_VERIFY:
		return "CertificateVerify";
	case TLS13_MT_FINISHED:
		return "Finished";
	case TLS13_MT_KEY_UPDATE:
		return "KeyUpdate";
	}
	return "Unknown";
}
#endif

static enum tls13_message_type
tls13_handshake_active_state(struct tls13_ctx *ctx)







<
<







287
288
289
290
291
292
293


294
295
296
297
298
299
300
		return "Certificate";
	case TLS13_MT_CERTIFICATE_REQUEST:
		return "CertificateRequest";
	case TLS13_MT_CERTIFICATE_VERIFY:
		return "CertificateVerify";
	case TLS13_MT_FINISHED:
		return "Finished";


	}
	return "Unknown";
}
#endif

static enum tls13_message_type
tls13_handshake_active_state(struct tls13_ctx *ctx)
Changes to jni/libressl/ssl/tls13_handshake_msg.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_handshake_msg.c,v 1.4 2021/10/23 13:12:14 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_handshake_msg.c,v 1.6 2022/07/22 19:33:53 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

void
tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs)
{
	CBS_init(cbs, msg->data, msg->data_len);
}

int
tls13_handshake_msg_set_buffer(struct tls13_handshake_msg *msg, CBS *cbs)
{
	return tls_buffer_set_data(msg->buf, cbs);
}

uint8_t
tls13_handshake_msg_type(struct tls13_handshake_msg *msg)
{
	return msg->msg_type;
}

int







<
<
<
<
<
<







67
68
69
70
71
72
73






74
75
76
77
78
79
80

void
tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs)
{
	CBS_init(cbs, msg->data, msg->data_len);
}







uint8_t
tls13_handshake_msg_type(struct tls13_handshake_msg *msg)
{
	return msg->msg_type;
}

int
138
139
140
141
142
143
144
145

146
147
148
149
150
151
152

	if (msg->msg_type == 0) {
		if ((ret = tls_buffer_extend(msg->buf,
		    TLS13_HANDSHAKE_MSG_HEADER_LEN,
		    tls13_handshake_msg_read_cb, rl)) <= 0)
			return ret;

		tls_buffer_cbs(msg->buf, &cbs);


		if (!CBS_get_u8(&cbs, &msg_type))
			return TLS13_IO_FAILURE;
		if (!CBS_get_u24(&cbs, &msg_len))
			return TLS13_IO_FAILURE;

		/* XXX - do we want to make this variable on message type? */







|
>







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

	if (msg->msg_type == 0) {
		if ((ret = tls_buffer_extend(msg->buf,
		    TLS13_HANDSHAKE_MSG_HEADER_LEN,
		    tls13_handshake_msg_read_cb, rl)) <= 0)
			return ret;

		if (!tls_buffer_data(msg->buf, &cbs))
			return TLS13_IO_FAILURE;

		if (!CBS_get_u8(&cbs, &msg_type))
			return TLS13_IO_FAILURE;
		if (!CBS_get_u24(&cbs, &msg_len))
			return TLS13_IO_FAILURE;

		/* XXX - do we want to make this variable on message type? */
Changes to jni/libressl/ssl/tls13_internal.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_internal.h,v 1.96 2022/01/05 17:10:02 jsing Exp $ */
/*
 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_internal.h,v 1.101 2022/07/24 14:28:16 jsing Exp $ */
/*
 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
84
85
86
87
88
89
90
91
92
93
94
95
96











97
98
99
100
101
102
103
#define TLS13_INFO_HANDSHAKE_COMPLETED			SSL_CB_HANDSHAKE_DONE
#define TLS13_INFO_ACCEPT_LOOP				SSL_CB_ACCEPT_LOOP
#define TLS13_INFO_CONNECT_LOOP				SSL_CB_CONNECT_LOOP
#define TLS13_INFO_ACCEPT_EXIT				SSL_CB_ACCEPT_EXIT
#define TLS13_INFO_CONNECT_EXIT				SSL_CB_CONNECT_EXIT

typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg);
typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg, CBS *_cbs);
typedef void (*tls13_phh_sent_cb)(void *_cb_arg);
typedef void (*tls13_handshake_message_cb)(void *_cb_arg);
typedef void (*tls13_info_cb)(void *_cb_arg, int _state, int _ret);
typedef int (*tls13_ocsp_status_cb)(void *_cb_arg);












/*
 * Secrets.
 */
struct tls13_secret {
	uint8_t *data;
	size_t len;
};







|





>
>
>
>
>
>
>
>
>
>
>







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#define TLS13_INFO_HANDSHAKE_COMPLETED			SSL_CB_HANDSHAKE_DONE
#define TLS13_INFO_ACCEPT_LOOP				SSL_CB_ACCEPT_LOOP
#define TLS13_INFO_CONNECT_LOOP				SSL_CB_CONNECT_LOOP
#define TLS13_INFO_ACCEPT_EXIT				SSL_CB_ACCEPT_EXIT
#define TLS13_INFO_CONNECT_EXIT				SSL_CB_CONNECT_EXIT

typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg);
typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg);
typedef void (*tls13_phh_sent_cb)(void *_cb_arg);
typedef void (*tls13_handshake_message_cb)(void *_cb_arg);
typedef void (*tls13_info_cb)(void *_cb_arg, int _state, int _ret);
typedef int (*tls13_ocsp_status_cb)(void *_cb_arg);

/*
 * PSK support.
 */

/*
 * Known PskKeyExchangeMode values.
 * https://www.iana.org/assignments/tls-parameters/#tls-pskkeyexchangemode
 */
#define TLS13_PSK_KE					0
#define TLS13_PSK_DHE_KE				1

/*
 * Secrets.
 */
struct tls13_secret {
	uint8_t *data;
	size_t len;
};
160
161
162
163
164
165
166

167
168
169









170
171
172
173
174
175
176
177
178


179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

/*
 * Record Layer.
 */
struct tls13_record_layer;

struct tls13_record_layer_callbacks {

	tls_read_cb wire_read;
	tls_write_cb wire_write;
	tls_flush_cb wire_flush;









	tls13_alert_cb alert_recv;
	tls13_alert_cb alert_sent;
	tls13_phh_recv_cb phh_recv;
	tls13_phh_sent_cb phh_sent;
};

struct tls13_record_layer *tls13_record_layer_new(
    const struct tls13_record_layer_callbacks *callbacks, void *cb_arg);
void tls13_record_layer_free(struct tls13_record_layer *rl);


void tls13_record_layer_allow_ccs(struct tls13_record_layer *rl, int allow);
void tls13_record_layer_allow_legacy_alerts(struct tls13_record_layer *rl, int allow);
void tls13_record_layer_rcontent(struct tls13_record_layer *rl, CBS *cbs);
void tls13_record_layer_set_aead(struct tls13_record_layer *rl,
    const EVP_AEAD *aead);
void tls13_record_layer_set_hash(struct tls13_record_layer *rl,
    const EVP_MD *hash);
void tls13_record_layer_set_legacy_version(struct tls13_record_layer *rl,
    uint16_t version);
void tls13_record_layer_set_retry_after_phh(struct tls13_record_layer *rl, int retry);
void tls13_record_layer_handshake_completed(struct tls13_record_layer *rl);
int tls13_record_layer_set_read_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *read_key);
int tls13_record_layer_set_write_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *write_key);
ssize_t tls13_record_layer_send_pending(struct tls13_record_layer *rl);
ssize_t tls13_record_layer_phh(struct tls13_record_layer *rl, CBS *cbs);
ssize_t tls13_record_layer_flush(struct tls13_record_layer *rl);

ssize_t tls13_read_handshake_data(struct tls13_record_layer *rl, uint8_t *buf, size_t n);
ssize_t tls13_write_handshake_data(struct tls13_record_layer *rl, const uint8_t *buf,
    size_t n);







>



>
>
>
>
>
>
>
>
>









>
>












|

|







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

/*
 * Record Layer.
 */
struct tls13_record_layer;

struct tls13_record_layer_callbacks {
	/* Wire callbacks. */
	tls_read_cb wire_read;
	tls_write_cb wire_write;
	tls_flush_cb wire_flush;

	/* Interceptors. */
	tls_handshake_read_cb handshake_read;
	tls_handshake_write_cb handshake_write;
	tls_traffic_key_cb set_read_traffic_key;
	tls_traffic_key_cb set_write_traffic_key;
	tls_alert_send_cb alert_send;

	/* Notification callbacks. */
	tls13_alert_cb alert_recv;
	tls13_alert_cb alert_sent;
	tls13_phh_recv_cb phh_recv;
	tls13_phh_sent_cb phh_sent;
};

struct tls13_record_layer *tls13_record_layer_new(
    const struct tls13_record_layer_callbacks *callbacks, void *cb_arg);
void tls13_record_layer_free(struct tls13_record_layer *rl);
void tls13_record_layer_set_callbacks(struct tls13_record_layer *rl,
    const struct tls13_record_layer_callbacks *callbacks, void *cb_arg);
void tls13_record_layer_allow_ccs(struct tls13_record_layer *rl, int allow);
void tls13_record_layer_allow_legacy_alerts(struct tls13_record_layer *rl, int allow);
void tls13_record_layer_rcontent(struct tls13_record_layer *rl, CBS *cbs);
void tls13_record_layer_set_aead(struct tls13_record_layer *rl,
    const EVP_AEAD *aead);
void tls13_record_layer_set_hash(struct tls13_record_layer *rl,
    const EVP_MD *hash);
void tls13_record_layer_set_legacy_version(struct tls13_record_layer *rl,
    uint16_t version);
void tls13_record_layer_set_retry_after_phh(struct tls13_record_layer *rl, int retry);
void tls13_record_layer_handshake_completed(struct tls13_record_layer *rl);
int tls13_record_layer_set_read_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *read_key, enum ssl_encryption_level_t read_level);
int tls13_record_layer_set_write_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *write_key, enum ssl_encryption_level_t write_level);
ssize_t tls13_record_layer_send_pending(struct tls13_record_layer *rl);
ssize_t tls13_record_layer_phh(struct tls13_record_layer *rl, CBS *cbs);
ssize_t tls13_record_layer_flush(struct tls13_record_layer *rl);

ssize_t tls13_read_handshake_data(struct tls13_record_layer *rl, uint8_t *buf, size_t n);
ssize_t tls13_write_handshake_data(struct tls13_record_layer *rl, const uint8_t *buf,
    size_t n);
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
 * Handshake Messages.
 */
struct tls13_handshake_msg;

struct tls13_handshake_msg *tls13_handshake_msg_new(void);
void tls13_handshake_msg_free(struct tls13_handshake_msg *msg);
void tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs);
int tls13_handshake_msg_set_buffer(struct tls13_handshake_msg *msg, CBS *cbs);
uint8_t tls13_handshake_msg_type(struct tls13_handshake_msg *msg);
int tls13_handshake_msg_content(struct tls13_handshake_msg *msg, CBS *cbs);
int tls13_handshake_msg_start(struct tls13_handshake_msg *msg, CBB *body,
    uint8_t msg_type);
int tls13_handshake_msg_finish(struct tls13_handshake_msg *msg);
int tls13_handshake_msg_recv(struct tls13_handshake_msg *msg,
    struct tls13_record_layer *rl);







<







234
235
236
237
238
239
240

241
242
243
244
245
246
247
 * Handshake Messages.
 */
struct tls13_handshake_msg;

struct tls13_handshake_msg *tls13_handshake_msg_new(void);
void tls13_handshake_msg_free(struct tls13_handshake_msg *msg);
void tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs);

uint8_t tls13_handshake_msg_type(struct tls13_handshake_msg *msg);
int tls13_handshake_msg_content(struct tls13_handshake_msg *msg, CBS *cbs);
int tls13_handshake_msg_start(struct tls13_handshake_msg *msg, CBB *body,
    uint8_t msg_type);
int tls13_handshake_msg_finish(struct tls13_handshake_msg *msg);
int tls13_handshake_msg_recv(struct tls13_handshake_msg *msg,
    struct tls13_record_layer *rl);
277
278
279
280
281
282
283
284
285
286
287
288







289
290
291
292
293
294
295
#ifndef TLS13_PHH_LIMIT_TIME
#define TLS13_PHH_LIMIT_TIME 3600
#endif
#ifndef TLS13_PHH_LIMIT
#define TLS13_PHH_LIMIT 100
#endif

struct tls13_ctx *tls13_ctx_new(int mode);
void tls13_ctx_free(struct tls13_ctx *ctx);

const EVP_AEAD *tls13_cipher_aead(const SSL_CIPHER *cipher);
const EVP_MD *tls13_cipher_hash(const SSL_CIPHER *cipher);








/*
 * Legacy interfaces.
 */
int tls13_use_legacy_client(struct tls13_ctx *ctx);
int tls13_use_legacy_server(struct tls13_ctx *ctx);
int tls13_legacy_accept(SSL *ssl);







|




>
>
>
>
>
>
>







299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
#ifndef TLS13_PHH_LIMIT_TIME
#define TLS13_PHH_LIMIT_TIME 3600
#endif
#ifndef TLS13_PHH_LIMIT
#define TLS13_PHH_LIMIT 100
#endif

struct tls13_ctx *tls13_ctx_new(int mode, SSL *ssl);
void tls13_ctx_free(struct tls13_ctx *ctx);

const EVP_AEAD *tls13_cipher_aead(const SSL_CIPHER *cipher);
const EVP_MD *tls13_cipher_hash(const SSL_CIPHER *cipher);

void tls13_alert_received_cb(uint8_t alert_desc, void *arg);
void tls13_alert_sent_cb(uint8_t alert_desc, void *arg);
ssize_t tls13_phh_received_cb(void *cb_arg);
void tls13_phh_done_cb(void *cb_arg);

int tls13_quic_init(struct tls13_ctx *ctx);

/*
 * Legacy interfaces.
 */
int tls13_use_legacy_client(struct tls13_ctx *ctx);
int tls13_use_legacy_server(struct tls13_ctx *ctx);
int tls13_legacy_accept(SSL *ssl);
Changes to jni/libressl/ssl/tls13_key_schedule.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_key_schedule.c,v 1.14 2021/01/05 18:36:22 tb Exp $ */
/*
 * Copyright (c) 2018, Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_key_schedule.c,v 1.15 2022/07/07 17:09:45 tb Exp $ */
/*
 * Copyright (c) 2018, Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

int
tls13_hkdf_expand_label_with_length(struct tls13_secret *out,
    const EVP_MD *digest, const struct tls13_secret *secret,
    const uint8_t *label, size_t label_len, const struct tls13_secret *context)
{
	const char tls13_plabel[] = "tls13 ";
	uint8_t *hkdf_label;
	size_t hkdf_label_len;
	CBB cbb, child;
	int ret;

	if (!CBB_init(&cbb, 256))
		return 0;
	if (!CBB_add_u16(&cbb, out->len))







|







165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

int
tls13_hkdf_expand_label_with_length(struct tls13_secret *out,
    const EVP_MD *digest, const struct tls13_secret *secret,
    const uint8_t *label, size_t label_len, const struct tls13_secret *context)
{
	const char tls13_plabel[] = "tls13 ";
	uint8_t *hkdf_label = NULL;
	size_t hkdf_label_len;
	CBB cbb, child;
	int ret;

	if (!CBB_init(&cbb, 256))
		return 0;
	if (!CBB_add_u16(&cbb, out->len))
Changes to jni/libressl/ssl/tls13_legacy.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: tls13_legacy.c,v 1.37 2022/02/06 16:08:14 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: tls13_legacy.c,v 1.38 2022/07/17 15:49:20 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
int
tls13_legacy_accept(SSL *ssl)
{
	struct tls13_ctx *ctx = ssl->internal->tls13;
	int ret;

	if (ctx == NULL) {
		if ((ctx = tls13_ctx_new(TLS13_HS_SERVER)) == NULL) {
			SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}
		ssl->internal->tls13 = ctx;
		ctx->ssl = ssl;
		ctx->hs = &ssl->s3->hs;

		if (!tls13_server_init(ctx)) {
			if (ERR_peek_error() == 0)
				SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}
	}








|



<
<
<
<







410
411
412
413
414
415
416
417
418
419
420




421
422
423
424
425
426
427
int
tls13_legacy_accept(SSL *ssl)
{
	struct tls13_ctx *ctx = ssl->internal->tls13;
	int ret;

	if (ctx == NULL) {
		if ((ctx = tls13_ctx_new(TLS13_HS_SERVER, ssl)) == NULL) {
			SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}




		if (!tls13_server_init(ctx)) {
			if (ERR_peek_error() == 0)
				SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}
	}

446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
int
tls13_legacy_connect(SSL *ssl)
{
	struct tls13_ctx *ctx = ssl->internal->tls13;
	int ret;

	if (ctx == NULL) {
		if ((ctx = tls13_ctx_new(TLS13_HS_CLIENT)) == NULL) {
			SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}
		ssl->internal->tls13 = ctx;
		ctx->ssl = ssl;
		ctx->hs = &ssl->s3->hs;

		if (!tls13_client_init(ctx)) {
			if (ERR_peek_error() == 0)
				SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}
	}








|



<
<
<
<







442
443
444
445
446
447
448
449
450
451
452




453
454
455
456
457
458
459
int
tls13_legacy_connect(SSL *ssl)
{
	struct tls13_ctx *ctx = ssl->internal->tls13;
	int ret;

	if (ctx == NULL) {
		if ((ctx = tls13_ctx_new(TLS13_HS_CLIENT, ssl)) == NULL) {
			SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}




		if (!tls13_client_init(ctx)) {
			if (ERR_peek_error() == 0)
				SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
			return -1;
		}
	}

Changes to jni/libressl/ssl/tls13_lib.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: tls13_lib.c,v 1.63 2022/02/05 14:54:10 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: tls13_lib.c,v 1.71 2022/09/10 15:29:33 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	case SSL_HANDSHAKE_MAC_SHA384:
		return EVP_sha384();
	}

	return NULL;
}

static void
tls13_alert_received_cb(uint8_t alert_desc, void *arg)
{
	struct tls13_ctx *ctx = arg;

	if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY) {
		ctx->close_notify_recv = 1;
		ctx->ssl->internal->shutdown |= SSL_RECEIVED_SHUTDOWN;







|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	case SSL_HANDSHAKE_MAC_SHA384:
		return EVP_sha384();
	}

	return NULL;
}

void
tls13_alert_received_cb(uint8_t alert_desc, void *arg)
{
	struct tls13_ctx *ctx = arg;

	if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY) {
		ctx->close_notify_recv = 1;
		ctx->ssl->internal->shutdown |= SSL_RECEIVED_SHUTDOWN;
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

	SSLerror(ctx->ssl, SSL_AD_REASON_OFFSET + alert_desc);
	ERR_asprintf_error_data("SSL alert number %d", alert_desc);

	SSL_CTX_remove_session(ctx->ssl->ctx, ctx->ssl->session);
}

static void
tls13_alert_sent_cb(uint8_t alert_desc, void *arg)
{
	struct tls13_ctx *ctx = arg;

	if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY) {
		ctx->close_notify_sent = 1;
		return;







|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

	SSLerror(ctx->ssl, SSL_AD_REASON_OFFSET + alert_desc);
	ERR_asprintf_error_data("SSL alert number %d", alert_desc);

	SSL_CTX_remove_session(ctx->ssl->ctx, ctx->ssl->session);
}

void
tls13_alert_sent_cb(uint8_t alert_desc, void *arg)
{
	struct tls13_ctx *ctx = arg;

	if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY) {
		ctx->close_notify_sent = 1;
		return;
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
	SSL *s = ctx->ssl;
	CBS cbs;

	if (s->internal->msg_callback == NULL)
		return;

	tls13_handshake_msg_data(ctx->hs_msg, &cbs);
	ssl_msg_callback(s, 0, SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs));
}

static void
tls13_legacy_handshake_message_sent_cb(void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *s = ctx->ssl;
	CBS cbs;

	if (s->internal->msg_callback == NULL)
		return;

	tls13_handshake_msg_data(ctx->hs_msg, &cbs);
	ssl_msg_callback(s, 1, SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs));
}

static void
tls13_legacy_info_cb(void *arg, int state, int ret)
{
	struct tls13_ctx *ctx = arg;
	SSL *s = ctx->ssl;







|













|







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
	SSL *s = ctx->ssl;
	CBS cbs;

	if (s->internal->msg_callback == NULL)
		return;

	tls13_handshake_msg_data(ctx->hs_msg, &cbs);
	ssl_msg_callback_cbs(s, 0, SSL3_RT_HANDSHAKE, &cbs);
}

static void
tls13_legacy_handshake_message_sent_cb(void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *s = ctx->ssl;
	CBS cbs;

	if (s->internal->msg_callback == NULL)
		return;

	tls13_handshake_msg_data(ctx->hs_msg, &cbs);
	ssl_msg_callback_cbs(s, 1, SSL3_RT_HANDSHAKE, &cbs);
}

static void
tls13_legacy_info_cb(void *arg, int state, int ret)
{
	struct tls13_ctx *ctx = arg;
	SSL *s = ctx->ssl;
211
212
213
214
215
216
217
218
219
220

221
222

223
224


225
226



227
228
229
230
231
232
233
234

235
236

237
238


239
240



241
242
243
244
245
246
247
248
249
		return 0;
	}

	return 1;
}

static int
tls13_phh_update_local_traffic_secret(struct tls13_ctx *ctx)
{
	struct tls13_secrets *secrets = ctx->hs->tls13.secrets;


	if (ctx->mode == TLS13_HS_CLIENT)

		return (tls13_update_client_traffic_secret(secrets) &&
		    tls13_record_layer_set_write_traffic_key(ctx->rl,


			&secrets->client_application_traffic));
	return (tls13_update_server_traffic_secret(secrets) &&



	    tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->server_application_traffic));
}

static int
tls13_phh_update_peer_traffic_secret(struct tls13_ctx *ctx)
{
	struct tls13_secrets *secrets = ctx->hs->tls13.secrets;


	if (ctx->mode == TLS13_HS_CLIENT)

		return (tls13_update_server_traffic_secret(secrets) &&
		    tls13_record_layer_set_read_traffic_key(ctx->rl,


		    &secrets->server_application_traffic));
	return (tls13_update_client_traffic_secret(secrets) &&



	    tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->client_application_traffic));
}

/*
 * XXX arbitrarily chosen limit of 100 post handshake handshake
 * messages in an hour - to avoid a hostile peer from constantly
 * requesting certificates or key renegotiaitons, etc.
 */







|


>

|
>
|
<
>
>
|
|
>
>
>
|
|



|


>

|
>
|
<
>
>
|
|
>
>
>
|
|







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
		return 0;
	}

	return 1;
}

static int
tls13_phh_update_read_traffic_secret(struct tls13_ctx *ctx)
{
	struct tls13_secrets *secrets = ctx->hs->tls13.secrets;
	struct tls13_secret *secret;

	if (ctx->mode == TLS13_HS_CLIENT) {
		secret = &secrets->server_application_traffic;
		if (!tls13_update_server_traffic_secret(secrets))

			return 0;
	} else {
		secret = &secrets->client_application_traffic;
		if (!tls13_update_client_traffic_secret(secrets))
			return 0;
	}

	return tls13_record_layer_set_read_traffic_key(ctx->rl,
	    secret, ssl_encryption_application);
}

static int
tls13_phh_update_write_traffic_secret(struct tls13_ctx *ctx)
{
	struct tls13_secrets *secrets = ctx->hs->tls13.secrets;
	struct tls13_secret *secret;

	if (ctx->mode == TLS13_HS_CLIENT) {
		secret = &secrets->client_application_traffic;
		if (!tls13_update_client_traffic_secret(secrets))

			return 0;
	} else {
		secret = &secrets->server_application_traffic;
		if (!tls13_update_server_traffic_secret(secrets))
			return 0;
	}

	return tls13_record_layer_set_write_traffic_key(ctx->rl,
	    secret, ssl_encryption_application);
}

/*
 * XXX arbitrarily chosen limit of 100 post handshake handshake
 * messages in an hour - to avoid a hostile peer from constantly
 * requesting certificates or key renegotiaitons, etc.
 */
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
		goto err;
	}
	if (key_update_request > 1) {
		alert = TLS13_ALERT_ILLEGAL_PARAMETER;
		goto err;
	}

	if (!tls13_phh_update_peer_traffic_secret(ctx))
		goto err;

	if (key_update_request == 0)
		return TLS13_IO_SUCCESS;

	/* key_update_request == 1 */
	if ((hs_msg = tls13_handshake_msg_new()) == NULL)
		goto err;
	if (!tls13_handshake_msg_start(hs_msg, &cbb_hs, TLS13_MT_KEY_UPDATE))
		goto err;
	if (!CBB_add_u8(&cbb_hs, 0))
		goto err;
	if (!tls13_handshake_msg_finish(hs_msg))







|





|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
		goto err;
	}
	if (key_update_request > 1) {
		alert = TLS13_ALERT_ILLEGAL_PARAMETER;
		goto err;
	}

	if (!tls13_phh_update_read_traffic_secret(ctx))
		goto err;

	if (key_update_request == 0)
		return TLS13_IO_SUCCESS;

	/* Our peer requested that we update our write traffic keys. */
	if ((hs_msg = tls13_handshake_msg_new()) == NULL)
		goto err;
	if (!tls13_handshake_msg_start(hs_msg, &cbb_hs, TLS13_MT_KEY_UPDATE))
		goto err;
	if (!CBB_add_u8(&cbb_hs, 0))
		goto err;
	if (!tls13_handshake_msg_finish(hs_msg))
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373











374
375
376
377

378
379
380
381
382
383
384
385
386
387
388
389
390
391

392

393
394
395
396
397
398
399
400
401
402







403
404
405
406
407
408
409

 err:
	tls13_handshake_msg_free(hs_msg);

	return tls13_send_alert(ctx->rl, alert);
}

static void
tls13_phh_done_cb(void *cb_arg)
{
	struct tls13_ctx *ctx = cb_arg;

	if (ctx->key_update_request) {
		tls13_phh_update_local_traffic_secret(ctx);
		ctx->key_update_request = 0;
	}
}

static ssize_t
tls13_phh_received_cb(void *cb_arg, CBS *cbs)
{
	ssize_t ret = TLS13_IO_FAILURE;
	struct tls13_ctx *ctx = cb_arg;
	CBS phh_cbs;

	if (!tls13_phh_limit_check(ctx))
		return tls13_send_alert(ctx->rl, TLS13_ALERT_UNEXPECTED_MESSAGE);

	if ((ctx->hs_msg == NULL) &&
	    ((ctx->hs_msg = tls13_handshake_msg_new()) == NULL))
		return TLS13_IO_FAILURE;

	if (!tls13_handshake_msg_set_buffer(ctx->hs_msg, cbs))
		return TLS13_IO_FAILURE;

	if ((ret = tls13_handshake_msg_recv(ctx->hs_msg, ctx->rl))
	    != TLS13_IO_SUCCESS)
		return ret;

	if (!tls13_handshake_msg_content(ctx->hs_msg, &phh_cbs))
		return TLS13_IO_FAILURE;

	switch(tls13_handshake_msg_type(ctx->hs_msg)) {
	case TLS13_MT_KEY_UPDATE:
		ret = tls13_key_update_recv(ctx, &phh_cbs);
		break;
	case TLS13_MT_NEW_SESSION_TICKET:
		/* XXX do nothing for now and ignore this */
		break;
	case TLS13_MT_CERTIFICATE_REQUEST:
		/* XXX add support if we choose to advertise this */
		/* FALLTHROUGH */
	default:
		ret = TLS13_IO_FAILURE; /* XXX send alert */
		break;
	}

	tls13_handshake_msg_free(ctx->hs_msg);
	ctx->hs_msg = NULL;
	return ret;
}












static const struct tls13_record_layer_callbacks rl_callbacks = {
	.wire_read = tls13_legacy_wire_read_cb,
	.wire_write = tls13_legacy_wire_write_cb,
	.wire_flush = tls13_legacy_wire_flush_cb,

	.alert_recv = tls13_alert_received_cb,
	.alert_sent = tls13_alert_sent_cb,
	.phh_recv = tls13_phh_received_cb,
	.phh_sent = tls13_phh_done_cb,
};

struct tls13_ctx *
tls13_ctx_new(int mode)
{
	struct tls13_ctx *ctx = NULL;

	if ((ctx = calloc(sizeof(struct tls13_ctx), 1)) == NULL)
		goto err;


	ctx->mode = mode;


	if ((ctx->rl = tls13_record_layer_new(&rl_callbacks, ctx)) == NULL)
		goto err;

	ctx->handshake_message_sent_cb = tls13_legacy_handshake_message_sent_cb;
	ctx->handshake_message_recv_cb = tls13_legacy_handshake_message_recv_cb;
	ctx->info_cb = tls13_legacy_info_cb;
	ctx->ocsp_status_recv_cb = tls13_legacy_ocsp_status_recv_cb;

	ctx->middlebox_compat = 1;








	return ctx;

 err:
	tls13_ctx_free(ctx);

	return NULL;







<
<
<
<
<
<
<
<
<
<
<
|
|



|








<
<
<
|
|


|




|

















>
>
>
>
>
>
>
>
>
>
>
|



>







|






>

>

|








>
>
>
>
>
>
>







324
325
326
327
328
329
330











331
332
333
334
335
336
337
338
339
340
341
342
343
344



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428

 err:
	tls13_handshake_msg_free(hs_msg);

	return tls13_send_alert(ctx->rl, alert);
}












ssize_t
tls13_phh_received_cb(void *cb_arg)
{
	ssize_t ret = TLS13_IO_FAILURE;
	struct tls13_ctx *ctx = cb_arg;
	CBS cbs;

	if (!tls13_phh_limit_check(ctx))
		return tls13_send_alert(ctx->rl, TLS13_ALERT_UNEXPECTED_MESSAGE);

	if ((ctx->hs_msg == NULL) &&
	    ((ctx->hs_msg = tls13_handshake_msg_new()) == NULL))
		return TLS13_IO_FAILURE;




	if ((ret = tls13_handshake_msg_recv(ctx->hs_msg, ctx->rl)) !=
	    TLS13_IO_SUCCESS)
		return ret;

	if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs))
		return TLS13_IO_FAILURE;

	switch(tls13_handshake_msg_type(ctx->hs_msg)) {
	case TLS13_MT_KEY_UPDATE:
		ret = tls13_key_update_recv(ctx, &cbs);
		break;
	case TLS13_MT_NEW_SESSION_TICKET:
		/* XXX do nothing for now and ignore this */
		break;
	case TLS13_MT_CERTIFICATE_REQUEST:
		/* XXX add support if we choose to advertise this */
		/* FALLTHROUGH */
	default:
		ret = TLS13_IO_FAILURE; /* XXX send alert */
		break;
	}

	tls13_handshake_msg_free(ctx->hs_msg);
	ctx->hs_msg = NULL;
	return ret;
}

void
tls13_phh_done_cb(void *cb_arg)
{
	struct tls13_ctx *ctx = cb_arg;

	if (ctx->key_update_request) {
		tls13_phh_update_write_traffic_secret(ctx);
		ctx->key_update_request = 0;
	}
}

static const struct tls13_record_layer_callbacks tls13_rl_callbacks = {
	.wire_read = tls13_legacy_wire_read_cb,
	.wire_write = tls13_legacy_wire_write_cb,
	.wire_flush = tls13_legacy_wire_flush_cb,

	.alert_recv = tls13_alert_received_cb,
	.alert_sent = tls13_alert_sent_cb,
	.phh_recv = tls13_phh_received_cb,
	.phh_sent = tls13_phh_done_cb,
};

struct tls13_ctx *
tls13_ctx_new(int mode, SSL *ssl)
{
	struct tls13_ctx *ctx = NULL;

	if ((ctx = calloc(sizeof(struct tls13_ctx), 1)) == NULL)
		goto err;

	ctx->hs = &ssl->s3->hs;
	ctx->mode = mode;
	ctx->ssl = ssl;

	if ((ctx->rl = tls13_record_layer_new(&tls13_rl_callbacks, ctx)) == NULL)
		goto err;

	ctx->handshake_message_sent_cb = tls13_legacy_handshake_message_sent_cb;
	ctx->handshake_message_recv_cb = tls13_legacy_handshake_message_recv_cb;
	ctx->info_cb = tls13_legacy_info_cb;
	ctx->ocsp_status_recv_cb = tls13_legacy_ocsp_status_recv_cb;

	ctx->middlebox_compat = 1;

	ssl->internal->tls13 = ctx;

	if (SSL_is_quic(ssl)) {
		if (!tls13_quic_init(ctx))
			goto err;
	}

	return ctx;

 err:
	tls13_ctx_free(ctx);

	return NULL;
Added jni/libressl/ssl/tls13_quic.c.












































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*	$OpenBSD: tls13_quic.c,v 1.6 2022/08/30 18:23:40 tb Exp $ */
/*
 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <ssl_locl.h>

#include "tls13_internal.h"

static ssize_t
tls13_quic_wire_read_cb(void *buf, size_t n, void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *ssl = ctx->ssl;

	SSLerror(ssl, SSL_R_QUIC_INTERNAL_ERROR);
	return TLS13_IO_FAILURE;
}

static ssize_t
tls13_quic_wire_write_cb(const void *buf, size_t n, void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *ssl = ctx->ssl;

	SSLerror(ssl, SSL_R_QUIC_INTERNAL_ERROR);
	return TLS13_IO_FAILURE;
}

static ssize_t
tls13_quic_wire_flush_cb(void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *ssl = ctx->ssl;

	if (!ssl->quic_method->flush_flight(ssl)) {
		SSLerror(ssl, SSL_R_QUIC_INTERNAL_ERROR);
		return TLS13_IO_FAILURE;
	}

	return TLS13_IO_SUCCESS;
}

static ssize_t
tls13_quic_handshake_read_cb(void *buf, size_t n, void *arg)
{
	struct tls13_ctx *ctx = arg;

	if (ctx->hs->tls13.quic_read_buffer == NULL)
		return TLS13_IO_WANT_POLLIN;

	return tls_buffer_read(ctx->hs->tls13.quic_read_buffer, buf, n);
}

static ssize_t
tls13_quic_handshake_write_cb(const void *buf, size_t n, void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *ssl = ctx->ssl;

	if (!ssl->quic_method->add_handshake_data(ssl,
	    ctx->hs->tls13.quic_write_level, buf, n)) {
		SSLerror(ssl, SSL_R_QUIC_INTERNAL_ERROR);
		return TLS13_IO_FAILURE;
	}

	return n;
}

static int
tls13_quic_set_read_traffic_key(struct tls13_secret *read_key,
    enum ssl_encryption_level_t read_level, void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *ssl = ctx->ssl;

	ctx->hs->tls13.quic_read_level = read_level;

	/* Handle both the new (BoringSSL) and old (quictls) APIs. */

	if (ssl->quic_method->set_read_secret != NULL)
		return ssl->quic_method->set_read_secret(ssl,
		    ctx->hs->tls13.quic_read_level, ctx->hs->cipher,
		    read_key->data, read_key->len);

	if (ssl->quic_method->set_encryption_secrets != NULL)
		return ssl->quic_method->set_encryption_secrets(ssl,
		    ctx->hs->tls13.quic_read_level, read_key->data, NULL,
		    read_key->len);

	return 0;
}

static int
tls13_quic_set_write_traffic_key(struct tls13_secret *write_key,
    enum ssl_encryption_level_t write_level, void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *ssl = ctx->ssl;

	ctx->hs->tls13.quic_write_level = write_level;

	/* Handle both the new (BoringSSL) and old (quictls) APIs. */

	if (ssl->quic_method->set_write_secret != NULL)
		return ssl->quic_method->set_write_secret(ssl,
		    ctx->hs->tls13.quic_write_level, ctx->hs->cipher,
		    write_key->data, write_key->len);

	if (ssl->quic_method->set_encryption_secrets != NULL)
		return ssl->quic_method->set_encryption_secrets(ssl,
		    ctx->hs->tls13.quic_write_level, NULL, write_key->data,
		    write_key->len);

	return 0;
}

static int
tls13_quic_alert_send_cb(int alert_desc, void *arg)
{
	struct tls13_ctx *ctx = arg;
	SSL *ssl = ctx->ssl;

	if (!ssl->quic_method->send_alert(ssl, ctx->hs->tls13.quic_write_level,
	    alert_desc)) {
		SSLerror(ssl, SSL_R_QUIC_INTERNAL_ERROR);
		return TLS13_IO_FAILURE;
	}

	return TLS13_IO_SUCCESS;
}

static const struct tls13_record_layer_callbacks quic_rl_callbacks = {
	.wire_read = tls13_quic_wire_read_cb,
	.wire_write = tls13_quic_wire_write_cb,
	.wire_flush = tls13_quic_wire_flush_cb,

	.handshake_read = tls13_quic_handshake_read_cb,
	.handshake_write = tls13_quic_handshake_write_cb,
	.set_read_traffic_key = tls13_quic_set_read_traffic_key,
	.set_write_traffic_key = tls13_quic_set_write_traffic_key,
	.alert_send = tls13_quic_alert_send_cb,

	.alert_recv = tls13_alert_received_cb,
	.alert_sent = tls13_alert_sent_cb,
	.phh_recv = tls13_phh_received_cb,
	.phh_sent = tls13_phh_done_cb,
};

int
tls13_quic_init(struct tls13_ctx *ctx)
{
	BIO *bio;

	tls13_record_layer_set_callbacks(ctx->rl, &quic_rl_callbacks, ctx);

	ctx->middlebox_compat = 0;

	/*
	 * QUIC does not use BIOs, however we currently expect a BIO to exist
	 * for status handling.
	 */
	if ((bio = BIO_new(BIO_s_null())) == NULL)
		return 0;

	SSL_set_bio(ctx->ssl, bio, bio);
	bio = NULL;

	return 1;
}
Changes to jni/libressl/ssl/tls13_record.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_record.c,v 1.9 2021/10/23 13:12:14 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_record.c,v 1.10 2022/07/22 19:33:53 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
130
131
132
133
134
135
136
137

138
139
140
141
142
143
144
		return TLS13_IO_FAILURE;

	if (rec->content_type == 0) {
		if ((ret = tls_buffer_extend(rec->buf,
		    TLS13_RECORD_HEADER_LEN, wire_read, wire_arg)) <= 0)
			return ret;

		tls_buffer_cbs(rec->buf, &cbs);


		if (!CBS_get_u8(&cbs, &content_type))
			return TLS13_IO_FAILURE;
		if (!CBS_get_u16(&cbs, &rec_version))
			return TLS13_IO_FAILURE;
		if (!CBS_get_u16(&cbs, &rec_len))
			return TLS13_IO_FAILURE;







|
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
		return TLS13_IO_FAILURE;

	if (rec->content_type == 0) {
		if ((ret = tls_buffer_extend(rec->buf,
		    TLS13_RECORD_HEADER_LEN, wire_read, wire_arg)) <= 0)
			return ret;

		if (!tls_buffer_data(rec->buf, &cbs))
			return TLS13_IO_FAILURE;

		if (!CBS_get_u8(&cbs, &content_type))
			return TLS13_IO_FAILURE;
		if (!CBS_get_u16(&cbs, &rec_version))
			return TLS13_IO_FAILURE;
		if (!CBS_get_u16(&cbs, &rec_len))
			return TLS13_IO_FAILURE;
Changes to jni/libressl/ssl/tls13_record_layer.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_record_layer.c,v 1.67 2022/01/14 09:12:15 tb Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_record_layer.c,v 1.71 2022/09/11 13:50:41 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

	if ((rl->read = tls13_record_protection_new()) == NULL)
		goto err;
	if ((rl->write = tls13_record_protection_new()) == NULL)
		goto err;

	rl->legacy_version = TLS1_2_VERSION;
	rl->cb = *callbacks;
	rl->cb_arg = cb_arg;

	return rl;

 err:
	tls13_record_layer_free(rl);

	return NULL;







|
|







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

	if ((rl->read = tls13_record_protection_new()) == NULL)
		goto err;
	if ((rl->write = tls13_record_protection_new()) == NULL)
		goto err;

	rl->legacy_version = TLS1_2_VERSION;

	tls13_record_layer_set_callbacks(rl, callbacks, cb_arg);

	return rl;

 err:
	tls13_record_layer_free(rl);

	return NULL;
172
173
174
175
176
177
178








179
180
181
182
183
184
185
	tls_content_free(rl->rcontent);

	tls13_record_protection_free(rl->read);
	tls13_record_protection_free(rl->write);

	freezero(rl, sizeof(struct tls13_record_layer));
}









void
tls13_record_layer_rcontent(struct tls13_record_layer *rl, CBS *cbs)
{
	CBS_dup(tls_content_cbs(rl->rcontent), cbs);
}








>
>
>
>
>
>
>
>







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
	tls_content_free(rl->rcontent);

	tls13_record_protection_free(rl->read);
	tls13_record_protection_free(rl->write);

	freezero(rl, sizeof(struct tls13_record_layer));
}

void
tls13_record_layer_set_callbacks(struct tls13_record_layer *rl,
    const struct tls13_record_layer_callbacks *callbacks, void *cb_arg)
{
	rl->cb = *callbacks;
	rl->cb_arg = cb_arg;
}

void
tls13_record_layer_rcontent(struct tls13_record_layer *rl, CBS *cbs)
{
	CBS_dup(tls_content_cbs(rl->rcontent), cbs);
}

483
484
485
486
487
488
489
490
491




492
493
494
495
496
497
498
499




500
501
502
503
504
505
506
	tls13_secret_cleanup(&key);

	return ret;
}

int
tls13_record_layer_set_read_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *read_key)
{




	return tls13_record_layer_set_traffic_key(rl->aead, rl->hash,
	    rl->read, read_key);
}

int
tls13_record_layer_set_write_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *write_key)
{




	return tls13_record_layer_set_traffic_key(rl->aead, rl->hash,
	    rl->write, write_key);
}

static int
tls13_record_layer_open_record_plaintext(struct tls13_record_layer *rl)
{







|

>
>
>
>






|

>
>
>
>







491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
	tls13_secret_cleanup(&key);

	return ret;
}

int
tls13_record_layer_set_read_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *read_key, enum ssl_encryption_level_t read_level)
{
	if (rl->cb.set_read_traffic_key != NULL)
		return rl->cb.set_read_traffic_key(read_key, read_level,
		    rl->cb_arg);

	return tls13_record_layer_set_traffic_key(rl->aead, rl->hash,
	    rl->read, read_key);
}

int
tls13_record_layer_set_write_traffic_key(struct tls13_record_layer *rl,
    struct tls13_secret *write_key, enum ssl_encryption_level_t write_level)
{
	if (rl->cb.set_write_traffic_key != NULL)
		return rl->cb.set_write_traffic_key(write_key, write_level,
		    rl->cb_arg);

	return tls13_record_layer_set_traffic_key(rl->aead, rl->hash,
	    rl->write, write_key);
}

static int
tls13_record_layer_open_record_plaintext(struct tls13_record_layer *rl)
{
830
831
832
833
834
835
836


837
838
839
840
841
842
843
			return tls13_send_alert(rl, TLS13_ALERT_UNEXPECTED_MESSAGE);
		if (!tls13_record_content(rl->rrec, &cbs))
			return tls13_send_alert(rl, TLS13_ALERT_DECODE_ERROR);
		if (!CBS_get_u8(&cbs, &ccs))
			return tls13_send_alert(rl, TLS13_ALERT_DECODE_ERROR);
		if (ccs != 1)
			return tls13_send_alert(rl, TLS13_ALERT_ILLEGAL_PARAMETER);


		rl->ccs_seen++;
		tls13_record_layer_rrec_free(rl);
		return TLS13_IO_WANT_RETRY;
	}

	/*
	 * Once record protection is engaged, we should only receive







>
>







846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
			return tls13_send_alert(rl, TLS13_ALERT_UNEXPECTED_MESSAGE);
		if (!tls13_record_content(rl->rrec, &cbs))
			return tls13_send_alert(rl, TLS13_ALERT_DECODE_ERROR);
		if (!CBS_get_u8(&cbs, &ccs))
			return tls13_send_alert(rl, TLS13_ALERT_DECODE_ERROR);
		if (ccs != 1)
			return tls13_send_alert(rl, TLS13_ALERT_ILLEGAL_PARAMETER);
		if (CBS_len(&cbs) != 0)
			return tls13_send_alert(rl, TLS13_ALERT_DECODE_ERROR);
		rl->ccs_seen++;
		tls13_record_layer_rrec_free(rl);
		return TLS13_IO_WANT_RETRY;
	}

	/*
	 * Once record protection is engaged, we should only receive
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
	 *
	 * TLS13_IO_WANT_POLLIN  need more handshake data.
	 * TLS13_IO_WANT_POLLOUT got whole handshake message, response enqueued.
	 * TLS13_IO_SUCCESS	 got the whole handshake, nothing more to do.
	 * TLS13_IO_FAILURE	 something broke.
	 */
	if (rl->cb.phh_recv != NULL)
		ret = rl->cb.phh_recv(rl->cb_arg, tls_content_cbs(rl->rcontent));

	tls_content_clear(rl->rcontent);

	/* Leave post handshake handshake mode unless we need more data. */
	if (ret != TLS13_IO_WANT_POLLIN)
		rl->phh = 0;








|







923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
	 *
	 * TLS13_IO_WANT_POLLIN  need more handshake data.
	 * TLS13_IO_WANT_POLLOUT got whole handshake message, response enqueued.
	 * TLS13_IO_SUCCESS	 got the whole handshake, nothing more to do.
	 * TLS13_IO_FAILURE	 something broke.
	 */
	if (rl->cb.phh_recv != NULL)
		ret = rl->cb.phh_recv(rl->cb_arg);

	tls_content_clear(rl->rcontent);

	/* Leave post handshake handshake mode unless we need more data. */
	if (ret != TLS13_IO_WANT_POLLIN)
		rl->phh = 0;

1124
1125
1126
1127
1128
1129
1130



1131
1132
1133
1134
1135
1136
1137



1138
1139
1140
1141
1142
1143
1144

	return TLS13_IO_SUCCESS;
}

ssize_t
tls13_read_handshake_data(struct tls13_record_layer *rl, uint8_t *buf, size_t n)
{



	return tls13_record_layer_read(rl, SSL3_RT_HANDSHAKE, buf, n);
}

ssize_t
tls13_write_handshake_data(struct tls13_record_layer *rl, const uint8_t *buf,
    size_t n)
{



	return tls13_record_layer_write(rl, SSL3_RT_HANDSHAKE, buf, n);
}

ssize_t
tls13_pending_application_data(struct tls13_record_layer *rl)
{
	if (!rl->handshake_completed)







>
>
>







>
>
>







1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168

	return TLS13_IO_SUCCESS;
}

ssize_t
tls13_read_handshake_data(struct tls13_record_layer *rl, uint8_t *buf, size_t n)
{
	if (rl->cb.handshake_read != NULL)
		return rl->cb.handshake_read(buf, n, rl->cb_arg);

	return tls13_record_layer_read(rl, SSL3_RT_HANDSHAKE, buf, n);
}

ssize_t
tls13_write_handshake_data(struct tls13_record_layer *rl, const uint8_t *buf,
    size_t n)
{
	if (rl->cb.handshake_write != NULL)
		return rl->cb.handshake_write(buf, n, rl->cb_arg);

	return tls13_record_layer_write(rl, SSL3_RT_HANDSHAKE, buf, n);
}

ssize_t
tls13_pending_application_data(struct tls13_record_layer *rl)
{
	if (!rl->handshake_completed)
1177
1178
1179
1180
1181
1182
1183



1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194

ssize_t
tls13_send_alert(struct tls13_record_layer *rl, uint8_t alert_desc)
{
	uint8_t alert_level = TLS13_ALERT_LEVEL_FATAL;
	ssize_t ret;




	if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY ||
	    alert_desc == TLS13_ALERT_USER_CANCELED)
		alert_level = TLS13_ALERT_LEVEL_WARNING;

	do {
		ret = tls13_record_layer_enqueue_alert(rl, alert_level,
		    alert_desc);
	} while (ret == TLS13_IO_WANT_RETRY);

	return ret;
}







>
>
>











1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221

ssize_t
tls13_send_alert(struct tls13_record_layer *rl, uint8_t alert_desc)
{
	uint8_t alert_level = TLS13_ALERT_LEVEL_FATAL;
	ssize_t ret;

	if (rl->cb.alert_send != NULL)
		return rl->cb.alert_send(alert_desc, rl->cb_arg);

	if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY ||
	    alert_desc == TLS13_ALERT_USER_CANCELED)
		alert_level = TLS13_ALERT_LEVEL_WARNING;

	do {
		ret = tls13_record_layer_enqueue_alert(rl, alert_level,
		    alert_desc);
	} while (ret == TLS13_IO_WANT_RETRY);

	return ret;
}
Changes to jni/libressl/ssl/tls13_server.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_server.c,v 1.96 2022/02/03 16:33:12 jsing Exp $ */
/*
 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls13_server.c,v 1.103 2022/09/17 17:14:06 jsing Exp $ */
/*
 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
104
105
106
107
108
109
110
111

112
113

114



115
116
117
118
119
120
121
	/*
	 * RFC 8446, section 9.2. If the ClientHello has supported_versions
	 * containing TLSv1.3, presence or absence of some extensions requires
	 * presence or absence of others.
	 */

	/*
	 * If we got no pre_shared_key, then signature_algorithms and

	 * supported_groups must both be present.
	 */

	if (!tlsext_extension_seen(s, TLSEXT_TYPE_pre_shared_key)) {



		if (!tlsext_extension_seen(s, TLSEXT_TYPE_signature_algorithms))
			return 0;
		if (!tlsext_extension_seen(s, TLSEXT_TYPE_supported_groups))
			return 0;
	}

	/*







|
>
|

>
|
>
>
>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	/*
	 * RFC 8446, section 9.2. If the ClientHello has supported_versions
	 * containing TLSv1.3, presence or absence of some extensions requires
	 * presence or absence of others.
	 */

	/*
	 * RFC 8446 section 4.2.9 - if we received a pre_shared_key, then we
	 * also need psk_key_exchange_modes. Otherwise, section 9.2 specifies
	 * that we need both signature_algorithms and supported_groups.
	 */
	if (tlsext_extension_seen(s, TLSEXT_TYPE_pre_shared_key)) {
		if (!tlsext_extension_seen(s,
		    TLSEXT_TYPE_psk_key_exchange_modes))
			return 0;
	} else {
		if (!tlsext_extension_seen(s, TLSEXT_TYPE_signature_algorithms))
			return 0;
		if (!tlsext_extension_seen(s, TLSEXT_TYPE_supported_groups))
			return 0;
	}

	/*
164
165
166
167
168
169
170









171
172
173
174
175
176
177
		return tls13_use_legacy_server(ctx);
	}
	ctx->hs->negotiated_tls_version = TLS1_3_VERSION;
	ctx->hs->peer_legacy_version = legacy_version;

	/* Ensure we send subsequent alerts with the correct record version. */
	tls13_record_layer_set_legacy_version(ctx->rl, TLS1_2_VERSION);










	/* Add decoded values to the current ClientHello hash */
	if (!tls13_clienthello_hash_init(ctx)) {
		ctx->alert = TLS13_ALERT_INTERNAL_ERROR;
		goto err;
	}
	if (!tls13_clienthello_hash_update_bytes(ctx, (void *)&legacy_version,







>
>
>
>
>
>
>
>
>







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
		return tls13_use_legacy_server(ctx);
	}
	ctx->hs->negotiated_tls_version = TLS1_3_VERSION;
	ctx->hs->peer_legacy_version = legacy_version;

	/* Ensure we send subsequent alerts with the correct record version. */
	tls13_record_layer_set_legacy_version(ctx->rl, TLS1_2_VERSION);

	/*
	 * Ensure that the client has not requested middlebox compatibility mode
	 * if it is prohibited from doing so.
	 */
	if (!ctx->middlebox_compat && CBS_len(&session_id) != 0) {
		ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
		goto err;
	}

	/* Add decoded values to the current ClientHello hash */
	if (!tls13_clienthello_hash_init(ctx)) {
		ctx->alert = TLS13_ALERT_INTERNAL_ERROR;
		goto err;
	}
	if (!tls13_clienthello_hash_update_bytes(ctx, (void *)&legacy_version,
225
226
227
228
229
230
231

232




233

234
235
236
237
238
239
240
	 * TLS 1.3 or later. This requires the legacy version be set to 0x0303.
	 */
	if (legacy_version != TLS1_2_VERSION) {
		ctx->alert = TLS13_ALERT_PROTOCOL_VERSION;
		goto err;
	}


	/* Store legacy session identifier so we can echo it. */




	if (CBS_len(&session_id) > sizeof(ctx->hs->tls13.legacy_session_id)) {

		ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
		goto err;
	}
	if (!CBS_write_bytes(&session_id, ctx->hs->tls13.legacy_session_id,
	    sizeof(ctx->hs->tls13.legacy_session_id),
	    &ctx->hs->tls13.legacy_session_id_len)) {
		ctx->alert = TLS13_ALERT_INTERNAL_ERROR;







>
|
>
>
>
>
|
>







239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
	 * TLS 1.3 or later. This requires the legacy version be set to 0x0303.
	 */
	if (legacy_version != TLS1_2_VERSION) {
		ctx->alert = TLS13_ALERT_PROTOCOL_VERSION;
		goto err;
	}

	/*
	 * The legacy session identifier must either be zero length or a 32 byte
	 * value (in which case the client is requesting middlebox compatibility
	 * mode), as per RFC 8446 section 4.1.2. If it is valid, store the value
	 * so that we can echo it back to the client.
	 */
	if (CBS_len(&session_id) != 0 &&
	    CBS_len(&session_id) != sizeof(ctx->hs->tls13.legacy_session_id)) {
		ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
		goto err;
	}
	if (!CBS_write_bytes(&session_id, ctx->hs->tls13.legacy_session_id,
	    sizeof(ctx->hs->tls13.legacy_session_id),
	    &ctx->hs->tls13.legacy_session_id_len)) {
		ctx->alert = TLS13_ALERT_INTERNAL_ERROR;
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
	 * XXX - ideally NEGOTIATED would only be added after record protection
	 * has been enabled. This would probably mean using either an
	 * INITIAL | WITHOUT_HRR state, or another intermediate state.
	 */
	if (ctx->hs->key_share != NULL)
		ctx->handshake_stage.hs_type |= NEGOTIATED | WITHOUT_HRR;

	/* XXX - check this is the correct point */
	tls13_record_layer_allow_ccs(ctx->rl, 1);

	return 1;

 err:
	return 0;
}







<







314
315
316
317
318
319
320

321
322
323
324
325
326
327
	 * XXX - ideally NEGOTIATED would only be added after record protection
	 * has been enabled. This would probably mean using either an
	 * INITIAL | WITHOUT_HRR state, or another intermediate state.
	 */
	if (ctx->hs->key_share != NULL)
		ctx->handshake_stage.hs_type |= NEGOTIATED | WITHOUT_HRR;


	tls13_record_layer_allow_ccs(ctx->rl, 1);

	return 1;

 err:
	return 0;
}
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
	    shared_key_len, &context))
		goto err;

	tls13_record_layer_set_aead(ctx->rl, ctx->aead);
	tls13_record_layer_set_hash(ctx->rl, ctx->hash);

	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->client_handshake_traffic))
		goto err;
	if (!tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->server_handshake_traffic))
		goto err;

	ctx->handshake_stage.hs_type |= NEGOTIATED;
	if (!(SSL_get_verify_mode(s) & SSL_VERIFY_PEER))
		ctx->handshake_stage.hs_type |= WITHOUT_CR;

	ret = 1;







|


|







413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
	    shared_key_len, &context))
		goto err;

	tls13_record_layer_set_aead(ctx->rl, ctx->aead);
	tls13_record_layer_set_hash(ctx->rl, ctx->hash);

	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->client_handshake_traffic, ssl_encryption_handshake))
		goto err;
	if (!tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->server_handshake_traffic, ssl_encryption_handshake))
		goto err;

	ctx->handshake_stage.hs_type |= NEGOTIATED;
	if (!(SSL_get_verify_mode(s) & SSL_VERIFY_PEER))
		ctx->handshake_stage.hs_type |= WITHOUT_CR;

	ret = 1;
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
	ctx->hs->tls13.hrr = 1;

	if (!tls13_synthetic_handshake_message(ctx))
		return 0;

	if (ctx->hs->key_share != NULL)
		return 0;
	if ((nid = tls1_get_shared_curve(ctx->ssl)) == NID_undef)
		return 0;
	if ((ctx->hs->tls13.server_group = tls1_ec_nid2curve_id(nid)) == 0)
		return 0;

	if (!tls13_server_hello_build(ctx, cbb, 1))
		return 0;

	return 1;
}







|

|







442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
	ctx->hs->tls13.hrr = 1;

	if (!tls13_synthetic_handshake_message(ctx))
		return 0;

	if (ctx->hs->key_share != NULL)
		return 0;
	if (!tls1_get_supported_group(ctx->ssl, &nid))
		return 0;
	if (!tls1_ec_nid2group_id(nid, &ctx->hs->tls13.server_group))
		return 0;

	if (!tls13_server_hello_build(ctx, cbb, 1))
		return 0;

	return 1;
}
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
		return 0;

	/*
	 * Any records following the server finished message must be encrypted
	 * using the server application traffic keys.
	 */
	return tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->server_application_traffic);
}

int
tls13_client_certificate_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	CBS cert_request_context, cert_list, cert_data, cert_exts;
	struct stack_st_X509 *certs = NULL;
	SSL *s = ctx->ssl;
	X509 *cert = NULL;
	EVP_PKEY *pkey;
	const uint8_t *p;
	int cert_type;
	int ret = 0;

	if (!CBS_get_u8_length_prefixed(cbs, &cert_request_context))
		goto err;
	if (CBS_len(&cert_request_context) != 0)
		goto err;
	if (!CBS_get_u24_length_prefixed(cbs, &cert_list))







|









<

<







860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876

877

878
879
880
881
882
883
884
		return 0;

	/*
	 * Any records following the server finished message must be encrypted
	 * using the server application traffic keys.
	 */
	return tls13_record_layer_set_write_traffic_key(ctx->rl,
	    &secrets->server_application_traffic, ssl_encryption_application);
}

int
tls13_client_certificate_recv(struct tls13_ctx *ctx, CBS *cbs)
{
	CBS cert_request_context, cert_list, cert_data, cert_exts;
	struct stack_st_X509 *certs = NULL;
	SSL *s = ctx->ssl;
	X509 *cert = NULL;

	const uint8_t *p;

	int ret = 0;

	if (!CBS_get_u8_length_prefixed(cbs, &cert_request_context))
		goto err;
	if (CBS_len(&cert_request_context) != 0)
		goto err;
	if (!CBS_get_u24_length_prefixed(cbs, &cert_list))
902
903
904
905
906
907
908

909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
	 */
	if (ssl_verify_cert_chain(s, certs) <= 0) {
		ctx->alert = ssl_verify_alarm_type(s->verify_result);
		tls13_set_errorx(ctx, TLS13_ERR_VERIFY_FAILED, 0,
		    "failed to verify peer certificate", NULL);
		goto err;
	}

	ERR_clear_error();

	/*
	 * Achtung! Due to API inconsistency, a client includes the peer's leaf
	 * certificate in the stored certificate chain, while a server does not.
	 */
	cert = sk_X509_shift(certs);

	if ((pkey = X509_get0_pubkey(cert)) == NULL)
		goto err;
	if (EVP_PKEY_missing_parameters(pkey))
		goto err;
	if ((cert_type = ssl_cert_type(pkey)) < 0)
		goto err;

	X509_up_ref(cert);
	X509_free(s->session->peer_cert);
	s->session->peer_cert = cert;
	s->session->peer_cert_type = cert_type;

	s->session->verify_result = s->verify_result;

	sk_X509_pop_free(s->session->cert_chain, X509_free);
	s->session->cert_chain = certs;
	certs = NULL;

	ctx->handshake_stage.hs_type |= WITH_CCV;
	ret = 1;

 err:
	sk_X509_pop_free(certs, X509_free);
	X509_free(cert);







>


<
<
<
<
<
|
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







919
920
921
922
923
924
925
926
927
928





929

930















931
932
933
934
935
936
937
	 */
	if (ssl_verify_cert_chain(s, certs) <= 0) {
		ctx->alert = ssl_verify_alarm_type(s->verify_result);
		tls13_set_errorx(ctx, TLS13_ERR_VERIFY_FAILED, 0,
		    "failed to verify peer certificate", NULL);
		goto err;
	}
	s->session->verify_result = s->verify_result;
	ERR_clear_error();






	if (!tls_process_peer_certs(s, certs))

		goto err;
















	ctx->handshake_stage.hs_type |= WITH_CCV;
	ret = 1;

 err:
	sk_X509_pop_free(certs, X509_free);
	X509_free(cert);
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
		goto err;

	/*
	 * Any records following the client finished message must be encrypted
	 * using the client application traffic keys.
	 */
	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->client_application_traffic))
		goto err;

	tls13_record_layer_allow_ccs(ctx->rl, 0);

	ret = 1;

 err:
	HMAC_CTX_free(hmac_ctx);
	free(verify_data);

	return ret;
}







|












1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
		goto err;

	/*
	 * Any records following the client finished message must be encrypted
	 * using the client application traffic keys.
	 */
	if (!tls13_record_layer_set_read_traffic_key(ctx->rl,
	    &secrets->client_application_traffic, ssl_encryption_application))
		goto err;

	tls13_record_layer_allow_ccs(ctx->rl, 0);

	ret = 1;

 err:
	HMAC_CTX_free(hmac_ctx);
	free(verify_data);

	return ret;
}
Changes to jni/libressl/ssl/tls_buffer.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23


24
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40


41
42
43
44
45
46
47
48
49
50











51
52
53
54
55
56
57

58
59
60









61
62
63
64
65
66




67
68



69
70
71
72
73
74
75






76
77
78
79
80
81
82

83


84
85
86
87
88
89
90
91
92
/* $OpenBSD: tls_buffer.c,v 1.1 2021/10/23 13:12:14 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <stdlib.h>
#include <string.h>


#include "bytestring.h"
#include "tls_internal.h"



struct tls_buffer {
	size_t capacity;

	uint8_t *data;
	size_t len;
	size_t offset;
};

static int tls_buffer_resize(struct tls_buffer *buf, size_t capacity);

struct tls_buffer *
tls_buffer_new(size_t init_size)
{
	struct tls_buffer *buf = NULL;

	if ((buf = calloc(1, sizeof(struct tls_buffer))) == NULL)
		goto err;



	if (!tls_buffer_resize(buf, init_size))
		goto err;

	return buf;

 err:
	tls_buffer_free(buf);

	return NULL;
}












void
tls_buffer_free(struct tls_buffer *buf)
{
	if (buf == NULL)
		return;


	freezero(buf->data, buf->capacity);
	freezero(buf, sizeof(struct tls_buffer));
}










static int
tls_buffer_resize(struct tls_buffer *buf, size_t capacity)
{
	uint8_t *data;





	if (buf->capacity == capacity)
		return 1;




	if ((data = recallocarray(buf->data, buf->capacity, capacity, 1)) == NULL)
		return 0;

	buf->data = data;
	buf->capacity = capacity;







	return 1;
}

int
tls_buffer_set_data(struct tls_buffer *buf, CBS *data)
{
	if (!tls_buffer_resize(buf, CBS_len(data)))

		return 0;


	memcpy(buf->data, CBS_data(data), CBS_len(data));
	return 1;
}

ssize_t
tls_buffer_extend(struct tls_buffer *buf, size_t len,
    tls_read_cb read_cb, void *cb_arg)
{
	ssize_t ret;
|

|
















>




>
>


>















>
>










>
>
>
>
>
>
>
>
>
>
>







>
|


>
>
>
>
>
>
>
>
>






>
>
>
>


>
>
>







>
>
>
>
>
>



|
|

<
>
|
>
>
|
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

122
123
124
125
126

127
128
129
130
131
132
133
/* $OpenBSD: tls_buffer.c,v 1.3 2022/07/22 19:33:53 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <stdlib.h>
#include <string.h>
#include <limits.h>

#include "bytestring.h"
#include "tls_internal.h"

#define TLS_BUFFER_CAPACITY_LIMIT	(1024 * 1024)

struct tls_buffer {
	size_t capacity;
	size_t capacity_limit;
	uint8_t *data;
	size_t len;
	size_t offset;
};

static int tls_buffer_resize(struct tls_buffer *buf, size_t capacity);

struct tls_buffer *
tls_buffer_new(size_t init_size)
{
	struct tls_buffer *buf = NULL;

	if ((buf = calloc(1, sizeof(struct tls_buffer))) == NULL)
		goto err;

	buf->capacity_limit = TLS_BUFFER_CAPACITY_LIMIT;

	if (!tls_buffer_resize(buf, init_size))
		goto err;

	return buf;

 err:
	tls_buffer_free(buf);

	return NULL;
}

void
tls_buffer_clear(struct tls_buffer *buf)
{
	freezero(buf->data, buf->capacity);

	buf->data = NULL;
	buf->capacity = 0;
	buf->len = 0;
	buf->offset = 0;
}

void
tls_buffer_free(struct tls_buffer *buf)
{
	if (buf == NULL)
		return;

	tls_buffer_clear(buf);

	freezero(buf, sizeof(struct tls_buffer));
}

static int
tls_buffer_grow(struct tls_buffer *buf, size_t capacity)
{
	if (buf->capacity >= capacity)
		return 1;

	return tls_buffer_resize(buf, capacity);
}

static int
tls_buffer_resize(struct tls_buffer *buf, size_t capacity)
{
	uint8_t *data;

	/*
	 * XXX - Consider maintaining a minimum size and growing more
	 * intelligently (rather than exactly).
	 */
	if (buf->capacity == capacity)
		return 1;

	if (capacity > buf->capacity_limit)
		return 0;

	if ((data = recallocarray(buf->data, buf->capacity, capacity, 1)) == NULL)
		return 0;

	buf->data = data;
	buf->capacity = capacity;

	/* Ensure that len and offset are valid if capacity decreased. */
	if (buf->len > buf->capacity)
		buf->len = buf->capacity;
	if (buf->offset > buf->len)
		buf->offset = buf->len;

	return 1;
}

void
tls_buffer_set_capacity_limit(struct tls_buffer *buf, size_t limit)
{

	/*
	 * XXX - do we want to force a resize if this limit is less than current
	 * capacity... and what do we do with existing data? Force a clear?
	 */
	buf->capacity_limit = limit;

}

ssize_t
tls_buffer_extend(struct tls_buffer *buf, size_t len,
    tls_read_cb read_cb, void *cb_arg)
{
	ssize_t ret;
111
112
113
114
115
116
117





118























































119
120


121







122
123
124
125
126
127
128
129
130
131
132
133
134

135

136
137
138
		buf->len += ret;

		if (buf->len == buf->capacity)
			return buf->len;
	}
}






void























































tls_buffer_cbs(struct tls_buffer *buf, CBS *cbs)
{


	CBS_init(cbs, buf->data, buf->len);







}

int
tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len)
{
	if (out == NULL || out_len == NULL)
		return 0;

	*out = buf->data;
	*out_len = buf->len;

	buf->capacity = 0;
	buf->data = NULL;

	buf->len = 0;


	return 1;
}







>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|

>
>
|
>
>
>
>
>
>
>











<

>

>



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

243
244
245
246
247
248
249
		buf->len += ret;

		if (buf->len == buf->capacity)
			return buf->len;
	}
}

ssize_t
tls_buffer_read(struct tls_buffer *buf, uint8_t *rbuf, size_t n)
{
	if (buf->offset > buf->len)
		return TLS_IO_FAILURE;

	if (buf->offset == buf->len)
		return TLS_IO_WANT_POLLIN;

	if (n > buf->len - buf->offset)
		n = buf->len - buf->offset;

	memcpy(rbuf, &buf->data[buf->offset], n);

	buf->offset += n;

	return n;
}

ssize_t
tls_buffer_write(struct tls_buffer *buf, const uint8_t *wbuf, size_t n)
{
	if (buf->offset > buf->len)
		return TLS_IO_FAILURE;

	/*
	 * To avoid continually growing the buffer, pull data up to the
	 * start of the buffer. If all data has been read then we can simply
	 * reset, otherwise wait until we're going to save at least 4KB of
	 * memory to reduce overhead.
	 */
	if (buf->offset == buf->len) {
		buf->len = 0;
		buf->offset = 0;
	}
	if (buf->offset >= 4096) {
		memmove(buf->data, &buf->data[buf->offset],
		    buf->len - buf->offset);
		buf->len -= buf->offset;
		buf->offset = 0;
	}

	if (buf->len > SIZE_MAX - n)
		return TLS_IO_FAILURE;
	if (!tls_buffer_grow(buf, buf->len + n))
		return TLS_IO_FAILURE;

	memcpy(&buf->data[buf->len], wbuf, n);

	buf->len += n;

	return n;
}

int
tls_buffer_append(struct tls_buffer *buf, const uint8_t *wbuf, size_t n)
{
	return tls_buffer_write(buf, wbuf, n) == n;
}

int
tls_buffer_data(struct tls_buffer *buf, CBS *out_cbs)
{
	CBS cbs;

	CBS_init(&cbs, buf->data, buf->len);

	if (!CBS_skip(&cbs, buf->offset))
		return 0;

	CBS_dup(&cbs, out_cbs);

	return 1;
}

int
tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len)
{
	if (out == NULL || out_len == NULL)
		return 0;

	*out = buf->data;
	*out_len = buf->len;


	buf->data = NULL;
	buf->capacity = 0;
	buf->len = 0;
	buf->offset = 0;

	return 1;
}
Changes to jni/libressl/ssl/tls_internal.h.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls_internal.h,v 1.5 2022/01/11 18:28:41 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls_internal.h,v 1.9 2022/07/24 14:28:16 jsing Exp $ */
/*
 * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
29
30
31
32
33
34
35




36
37
38
39
40
41
42
43








44
45
46
47
48
49
50
51

52
53



54
55
56
57
58
59
60
61
#define TLS_IO_EOF			 0
#define TLS_IO_FAILURE			-1
#define TLS_IO_ALERT			-2
#define TLS_IO_WANT_POLLIN		-3
#define TLS_IO_WANT_POLLOUT		-4
#define TLS_IO_WANT_RETRY		-5 /* Retry the previous call immediately. */





/*
 * Callbacks.
 */
typedef ssize_t (*tls_read_cb)(void *_buf, size_t _buflen, void *_cb_arg);
typedef ssize_t (*tls_write_cb)(const void *_buf, size_t _buflen,
    void *_cb_arg);
typedef ssize_t (*tls_flush_cb)(void *_cb_arg);









/*
 * Buffers.
 */
struct tls_buffer;

struct tls_buffer *tls_buffer_new(size_t init_size);
int tls_buffer_set_data(struct tls_buffer *buf, CBS *data);
void tls_buffer_free(struct tls_buffer *buf);

ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len,
    tls_read_cb read_cb, void *cb_arg);



void tls_buffer_cbs(struct tls_buffer *buf, CBS *cbs);
int tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len);

/*
 * Key shares.
 */
struct tls_key_share;








>
>
>
>








>
>
>
>
>
>
>
>






|

>


>
>
>
|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#define TLS_IO_EOF			 0
#define TLS_IO_FAILURE			-1
#define TLS_IO_ALERT			-2
#define TLS_IO_WANT_POLLIN		-3
#define TLS_IO_WANT_POLLOUT		-4
#define TLS_IO_WANT_RETRY		-5 /* Retry the previous call immediately. */

enum ssl_encryption_level_t;

struct tls13_secret;

/*
 * Callbacks.
 */
typedef ssize_t (*tls_read_cb)(void *_buf, size_t _buflen, void *_cb_arg);
typedef ssize_t (*tls_write_cb)(const void *_buf, size_t _buflen,
    void *_cb_arg);
typedef ssize_t (*tls_flush_cb)(void *_cb_arg);

typedef ssize_t (*tls_handshake_read_cb)(void *_buf, size_t _buflen,
    void *_cb_arg);
typedef ssize_t (*tls_handshake_write_cb)(const void *_buf, size_t _buflen,
    void *_cb_arg);
typedef int (*tls_traffic_key_cb)(struct tls13_secret *key,
    enum ssl_encryption_level_t level, void *_cb_arg);
typedef int (*tls_alert_send_cb)(int _alert_desc, void *_cb_arg);

/*
 * Buffers.
 */
struct tls_buffer;

struct tls_buffer *tls_buffer_new(size_t init_size);
void tls_buffer_clear(struct tls_buffer *buf);
void tls_buffer_free(struct tls_buffer *buf);
void tls_buffer_set_capacity_limit(struct tls_buffer *buf, size_t limit);
ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len,
    tls_read_cb read_cb, void *cb_arg);
ssize_t tls_buffer_read(struct tls_buffer *buf, uint8_t *rbuf, size_t n);
ssize_t tls_buffer_write(struct tls_buffer *buf, const uint8_t *wbuf, size_t n);
int tls_buffer_append(struct tls_buffer *buf, const uint8_t *wbuf, size_t n);
int tls_buffer_data(struct tls_buffer *buf, CBS *cbs);
int tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len);

/*
 * Key shares.
 */
struct tls_key_share;

73
74
75
76
77
78
79

80
81
82
83
int tls_key_share_public(struct tls_key_share *ks, CBB *cbb);
int tls_key_share_peer_params(struct tls_key_share *ks, CBS *cbs,
    int *decode_error, int *invalid_params);
int tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs,
    int *decode_error, int *invalid_key);
int tls_key_share_derive(struct tls_key_share *ks, uint8_t **shared_key,
    size_t *shared_key_len);


__END_HIDDEN_DECLS

#endif







>




89
90
91
92
93
94
95
96
97
98
99
100
int tls_key_share_public(struct tls_key_share *ks, CBB *cbb);
int tls_key_share_peer_params(struct tls_key_share *ks, CBS *cbs,
    int *decode_error, int *invalid_params);
int tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs,
    int *decode_error, int *invalid_key);
int tls_key_share_derive(struct tls_key_share *ks, uint8_t **shared_key,
    size_t *shared_key_len);
int tls_key_share_peer_security(const SSL *ssl, struct tls_key_share *ks);

__END_HIDDEN_DECLS

#endif
Changes to jni/libressl/ssl/tls_key_share.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls_key_share.c,v 1.4 2022/01/11 18:28:41 jsing Exp $ */
/*
 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls_key_share.c,v 1.7 2022/07/02 16:00:12 tb Exp $ */
/*
 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
}

struct tls_key_share *
tls_key_share_new(uint16_t group_id)
{
	int nid;

	if ((nid = tls1_ec_curve_id2nid(group_id)) == 0)
		return NULL;

	return tls_key_share_new_internal(nid, group_id);
}

struct tls_key_share *
tls_key_share_new_nid(int nid)
{
	uint16_t group_id = 0;

	if (nid != NID_dhKeyAgreement) {
		if ((group_id = tls1_ec_nid2curve_id(nid)) == 0)
			return NULL;
	}

	return tls_key_share_new_internal(nid, group_id);
}

void







|











|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
}

struct tls_key_share *
tls_key_share_new(uint16_t group_id)
{
	int nid;

	if (!tls1_ec_group_id2nid(group_id, &nid))
		return NULL;

	return tls_key_share_new_internal(nid, group_id);
}

struct tls_key_share *
tls_key_share_new_nid(int nid)
{
	uint16_t group_id = 0;

	if (nid != NID_dhKeyAgreement) {
		if (!tls1_ec_nid2group_id(nid, &group_id))
			return NULL;
	}

	return tls_key_share_new_internal(nid, group_id);
}

void
467
468
469
470
471
472
473











	if (ks->nid == NID_X25519)
		return tls_key_share_derive_x25519(ks, shared_key,
		    shared_key_len);

	return tls_key_share_derive_ecdhe_ecp(ks, shared_key,
	    shared_key_len);
}


















>
>
>
>
>
>
>
>
>
>
>
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
	if (ks->nid == NID_X25519)
		return tls_key_share_derive_x25519(ks, shared_key,
		    shared_key_len);

	return tls_key_share_derive_ecdhe_ecp(ks, shared_key,
	    shared_key_len);
}

int
tls_key_share_peer_security(const SSL *ssl, struct tls_key_share *ks)
{
	switch (ks->nid) {
	case NID_dhKeyAgreement:
		return ssl_security_dh(ssl, ks->dhe_peer);
	default:
		return 0;
	}
}
Added jni/libressl/ssl/tls_lib.c.








































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* $OpenBSD: tls_lib.c,v 1.2 2022/08/20 21:48:25 tb Exp $ */
/*
 * Copyright (c) 2019, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "ssl_locl.h"

int
tls_process_peer_certs(SSL *s, STACK_OF(X509) *peer_certs)
{
	STACK_OF(X509) *peer_certs_no_leaf;
	X509 *peer_cert = NULL;
	EVP_PKEY *pkey;
	int cert_type;
	int ret = 0;

	if (sk_X509_num(peer_certs) < 1)
		goto err;
	peer_cert = sk_X509_value(peer_certs, 0);
	X509_up_ref(peer_cert);

	if ((pkey = X509_get0_pubkey(peer_cert)) == NULL) {
		SSLerror(s, SSL_R_NO_PUBLICKEY);
		goto err;
	}
	if (EVP_PKEY_missing_parameters(pkey)) {
		SSLerror(s, SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS);
		goto err;
	}
	if ((cert_type = ssl_cert_type(pkey)) < 0) {
		SSLerror(s, SSL_R_UNKNOWN_CERTIFICATE_TYPE);
		goto err;
	}

	s->session->peer_cert_type = cert_type;

	X509_free(s->session->peer_cert);
	s->session->peer_cert = peer_cert;
	peer_cert = NULL;

	sk_X509_pop_free(s->s3->hs.peer_certs, X509_free);
	if ((s->s3->hs.peer_certs = X509_chain_up_ref(peer_certs)) == NULL)
		goto err;

	if ((peer_certs_no_leaf = X509_chain_up_ref(peer_certs)) == NULL)
		goto err;
	X509_free(sk_X509_shift(peer_certs_no_leaf));
	sk_X509_pop_free(s->s3->hs.peer_certs_no_leaf, X509_free);
	s->s3->hs.peer_certs_no_leaf = peer_certs_no_leaf;

	ret = 1;
 err:
	X509_free(peer_cert);

	return ret;
}
Changes to jni/libressl/tap-driver.sh.
1
2
3
4
5
6
7
8
9
#! /bin/sh
# Copyright (C) 2011-2020 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,

|







1
2
3
4
5
6
7
8
9
#! /bin/sh
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
Changes to jni/libressl/test-driver.
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# test-driver - basic testsuite driver script.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 2011-2020 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,





|







1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
# test-driver - basic testsuite driver script.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 2011-2021 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
101
102
103
104
105
106
107
108


109

110
111
112
113
114
115
116

do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15

# Test script is run here.


"$@" >$log_file 2>&1

estatus=$?

if test $enable_hard_errors = no && test $estatus -eq 99; then
  tweaked_estatus=1
else
  tweaked_estatus=$estatus
fi







|
>
>
|
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15

# Test script is run here. We create the file first, then append to it,
# to ameliorate tests themselves also writing to the log file. Our tests
# don't, but others can (automake bug#35762).
: >"$log_file"
"$@" >>"$log_file" 2>&1
estatus=$?

if test $enable_hard_errors = no && test $estatus -eq 99; then
  tweaked_estatus=1
else
  tweaked_estatus=$estatus
fi
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
esac

# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file

# Report outcome to console.
echo "${col}${res}${std}: $test_name"

# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file







|







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
esac

# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>"$log_file"

# Report outcome to console.
echo "${col}${res}${std}: $test_name"

# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
Changes to jni/libressl/tests/CMakeLists.txt.
1
2
3
4
5
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23




24

25
26
27
28
29
30
31
add_definitions(-DLIBRESSL_CRYPTO_INTERNAL)

include_directories(
	.
	../crypto/asn1
	../crypto/bio

	../crypto/evp
	../crypto/modes
	../crypto/x509
	../ssl
	../apps/openssl
	../apps/openssl/compat
	../include
	../include/compat
)

add_definitions(-D_PATH_SSL_CA_FILE=\"${CMAKE_CURRENT_SOURCE_DIR}/../cert.pem\")

file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} TEST_SOURCE_DIR)

# aeadtest
add_executable(aeadtest aeadtest.c)
target_link_libraries(aeadtest ${OPENSSL_TEST_LIBS})




add_test(aeadtest aeadtest ${CMAKE_CURRENT_SOURCE_DIR}/aeadtests.txt)


# aes_wrap
add_executable(aes_wrap aes_wrap.c)
target_link_libraries(aes_wrap ${OPENSSL_TEST_LIBS})
add_test(aes_wrap aes_wrap)

# arc4randomforktest






>

















>
>
>
>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
add_definitions(-DLIBRESSL_CRYPTO_INTERNAL)

include_directories(
	.
	../crypto/asn1
	../crypto/bio
	../crypto/bn
	../crypto/evp
	../crypto/modes
	../crypto/x509
	../ssl
	../apps/openssl
	../apps/openssl/compat
	../include
	../include/compat
)

add_definitions(-D_PATH_SSL_CA_FILE=\"${CMAKE_CURRENT_SOURCE_DIR}/../cert.pem\")

file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} TEST_SOURCE_DIR)

# aeadtest
add_executable(aeadtest aeadtest.c)
target_link_libraries(aeadtest ${OPENSSL_TEST_LIBS})
if(NOT WIN32)
	add_test(NAME aeadtest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/aeadtest.sh)
	set_tests_properties(aeadtest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
else()
	add_test(aeadtest aeadtest aead ${CMAKE_CURRENT_SOURCE_DIR}/aeadtests.txt)
endif()

# aes_wrap
add_executable(aes_wrap aes_wrap.c)
target_link_libraries(aes_wrap ${OPENSSL_TEST_LIBS})
add_test(aes_wrap aes_wrap)

# arc4randomforktest
100
101
102
103
104
105
106





107
108
109
110
111
112
113
114
115
116





117
118
119
120
121
122
123
endif()

# bnaddsub
add_executable(bnaddsub bnaddsub.c)
target_link_libraries(bnaddsub ${OPENSSL_TEST_LIBS})
add_test(bnaddsub bnaddsub)






# bn_mod_exp2_mont
add_executable(bn_mod_exp2_mont bn_mod_exp2_mont.c)
target_link_libraries(bn_mod_exp2_mont ${OPENSSL_TEST_LIBS})
add_test(bn_mod_exp2_mont bn_mod_exp2_mont)

# bn_mod_sqrt
add_executable(bn_mod_sqrt bn_mod_sqrt.c)
target_link_libraries(bn_mod_sqrt ${OPENSSL_TEST_LIBS})
add_test(bn_mod_sqrt bn_mod_sqrt)






# bn_rand_interval
add_executable(bn_rand_interval bn_rand_interval.c)
target_link_libraries(bn_rand_interval ${OPENSSL_TEST_LIBS})
add_test(bn_rand_interval bn_rand_interval)

# bntest
add_executable(bntest bntest.c)







>
>
>
>
>










>
>
>
>
>







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
endif()

# bnaddsub
add_executable(bnaddsub bnaddsub.c)
target_link_libraries(bnaddsub ${OPENSSL_TEST_LIBS})
add_test(bnaddsub bnaddsub)

# bn_isqrt
add_executable(bn_isqrt bn_isqrt.c)
target_link_libraries(bn_isqrt ${OPENSSL_TEST_LIBS})
add_test(bn_isqrt bn_isqrt)

# bn_mod_exp2_mont
add_executable(bn_mod_exp2_mont bn_mod_exp2_mont.c)
target_link_libraries(bn_mod_exp2_mont ${OPENSSL_TEST_LIBS})
add_test(bn_mod_exp2_mont bn_mod_exp2_mont)

# bn_mod_sqrt
add_executable(bn_mod_sqrt bn_mod_sqrt.c)
target_link_libraries(bn_mod_sqrt ${OPENSSL_TEST_LIBS})
add_test(bn_mod_sqrt bn_mod_sqrt)

# bn_primes
add_executable(bn_primes bn_primes.c)
target_link_libraries(bn_primes ${OPENSSL_TEST_LIBS})
add_test(bn_primes bn_primes)

# bn_rand_interval
add_executable(bn_rand_interval bn_rand_interval.c)
target_link_libraries(bn_rand_interval ${OPENSSL_TEST_LIBS})
add_test(bn_rand_interval bn_rand_interval)

# bntest
add_executable(bntest bntest.c)
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
target_link_libraries(keypairtest ${LIBTLS_TEST_LIBS})
target_include_directories(keypairtest BEFORE PUBLIC ../tls)
add_test(keypairtest keypairtest
	${CMAKE_CURRENT_SOURCE_DIR}/ca.pem
	${CMAKE_CURRENT_SOURCE_DIR}/server.pem
	${CMAKE_CURRENT_SOURCE_DIR}/server.pem)

# md4test
add_executable(md4test md4test.c)
target_link_libraries(md4test ${OPENSSL_TEST_LIBS})
add_test(md4test md4test)

# md5test
add_executable(md5test md5test.c)
target_link_libraries(md5test ${OPENSSL_TEST_LIBS})
add_test(md5test md5test)

# mont
add_executable(mont mont.c)
target_link_libraries(mont ${OPENSSL_TEST_LIBS})
add_test(mont mont)

# objectstest







|
|
|
|
<
<
<
<
<







338
339
340
341
342
343
344
345
346
347
348





349
350
351
352
353
354
355
target_link_libraries(keypairtest ${LIBTLS_TEST_LIBS})
target_include_directories(keypairtest BEFORE PUBLIC ../tls)
add_test(keypairtest keypairtest
	${CMAKE_CURRENT_SOURCE_DIR}/ca.pem
	${CMAKE_CURRENT_SOURCE_DIR}/server.pem
	${CMAKE_CURRENT_SOURCE_DIR}/server.pem)

# md_test
add_executable(md_test md_test.c)
target_link_libraries(md_test ${OPENSSL_TEST_LIBS})
add_test(md_test md_test)






# mont
add_executable(mont mont.c)
target_link_libraries(mont ${OPENSSL_TEST_LIBS})
add_test(mont mont)

# objectstest
393
394
395
396
397
398
399











400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
	add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.sh)
else()
	add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.bat
		$<TARGET_FILE:pq_test>)
endif()
set_tests_properties(pq_test PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")












# randtest
add_executable(randtest randtest.c)
target_link_libraries(randtest ${OPENSSL_TEST_LIBS})
add_test(randtest randtest)

# rc2test
add_executable(rc2test rc2test.c)
target_link_libraries(rc2test ${OPENSSL_TEST_LIBS})
add_test(rc2test rc2test)

# rc4test
add_executable(rc4test rc4test.c)
target_link_libraries(rc4test ${OPENSSL_TEST_LIBS})
add_test(rc4test rc4test)

# recordtest
add_executable(recordtest recordtest.c)
target_link_libraries(recordtest ${OPENSSL_TEST_LIBS})
add_test(recordtest recordtest)

# record_layer_test







>
>
>
>
>
>
>
>
>
>
>





|
|
|
|

|
|
|
|







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
	add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.sh)
else()
	add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.bat
		$<TARGET_FILE:pq_test>)
endif()
set_tests_properties(pq_test PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")

# quictest
set(QUICTEST_SRC quictest.c)
add_executable(quictest ${QUICTEST_SRC})
target_link_libraries(quictest ${OPENSSL_TEST_LIBS})
if(NOT MSVC)
	add_test(NAME quictest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/quictest.sh)
else()
	add_test(NAME quictest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/quictest.bat $<TARGET_FILE:quictest>)
endif()
set_tests_properties(quictest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")

# randtest
add_executable(randtest randtest.c)
target_link_libraries(randtest ${OPENSSL_TEST_LIBS})
add_test(randtest randtest)

# rc2_test
add_executable(rc2_test rc2_test.c)
target_link_libraries(rc2_test ${OPENSSL_TEST_LIBS})
add_test(rc2_test rc2_test)

# rc4_test
add_executable(rc4_test rc4_test.c)
target_link_libraries(rc4_test ${OPENSSL_TEST_LIBS})
add_test(rc4_test rc4_test)

# recordtest
add_executable(recordtest recordtest.c)
target_link_libraries(recordtest ${OPENSSL_TEST_LIBS})
add_test(recordtest recordtest)

# record_layer_test
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
target_link_libraries(rfc5280time ${OPENSSL_TEST_LIBS})
if(SMALL_TIME_T)
	add_test(rfc5280time ${CMAKE_CURRENT_SOURCE_DIR}/rfc5280time_small.test)
else()
	add_test(rfc5280time rfc5280time)
endif()

# rmdtest
add_executable(rmdtest rmdtest.c)
target_link_libraries(rmdtest ${OPENSSL_TEST_LIBS})
add_test(rmdtest rmdtest)

# rsa_test
add_executable(rsa_test rsa_test.c)
target_link_libraries(rsa_test ${OPENSSL_TEST_LIBS})
add_test(rsa_test rsa_test)

# servertest
add_executable(servertest servertest.c)
target_link_libraries(servertest ${OPENSSL_TEST_LIBS})
if(NOT MSVC)
	add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.sh)
else()
	add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.bat $<TARGET_FILE:servertest>)
endif()
set_tests_properties(servertest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")

# sha1test
add_executable(sha1test sha1test.c)
target_link_libraries(sha1test ${OPENSSL_TEST_LIBS})
add_test(sha1test sha1test)

# sha256test
add_executable(sha256test sha256test.c)
target_link_libraries(sha256test ${OPENSSL_TEST_LIBS})
add_test(sha256test sha256test)

# sha512test
add_executable(sha512test sha512test.c)
target_link_libraries(sha512test ${OPENSSL_TEST_LIBS})
add_test(sha512test sha512test)

# sm3test
add_executable(sm3test sm3test.c)
target_link_libraries(sm3test ${OPENSSL_TEST_LIBS})
add_test(sm3test sm3test)

# sm4test







|
|
|
|
















|
|
|
|
<
<
<
<
<
<
<
<
<
<







455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485










486
487
488
489
490
491
492
target_link_libraries(rfc5280time ${OPENSSL_TEST_LIBS})
if(SMALL_TIME_T)
	add_test(rfc5280time ${CMAKE_CURRENT_SOURCE_DIR}/rfc5280time_small.test)
else()
	add_test(rfc5280time rfc5280time)
endif()

# rmd_test
add_executable(rmd_test rmd_test.c)
target_link_libraries(rmd_test ${OPENSSL_TEST_LIBS})
add_test(rmd_test rmd_test)

# rsa_test
add_executable(rsa_test rsa_test.c)
target_link_libraries(rsa_test ${OPENSSL_TEST_LIBS})
add_test(rsa_test rsa_test)

# servertest
add_executable(servertest servertest.c)
target_link_libraries(servertest ${OPENSSL_TEST_LIBS})
if(NOT MSVC)
	add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.sh)
else()
	add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.bat $<TARGET_FILE:servertest>)
endif()
set_tests_properties(servertest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")

# sha_test
add_executable(sha_test sha_test.c)
target_link_libraries(sha_test ${OPENSSL_TEST_LIBS})
add_test(sha_test sha_test)











# sm3test
add_executable(sm3test sm3test.c)
target_link_libraries(sm3test ${OPENSSL_TEST_LIBS})
add_test(sm3test sm3test)

# sm4test
490
491
492
493
494
495
496





497
498
499
500
501
502
503
add_test(ssl_get_shared_ciphers ssl_get_shared_ciphers)

# ssl_methods
add_executable(ssl_methods ssl_methods.c)
target_link_libraries(ssl_methods ${OPENSSL_TEST_LIBS})
add_test(ssl_methods ssl_methods)






# ssl_versions
add_executable(ssl_versions ssl_versions.c)
target_link_libraries(ssl_versions ${OPENSSL_TEST_LIBS})
add_test(ssl_versions ssl_versions)

# ssltest
add_executable(ssltest ssltest.c)







>
>
>
>
>







502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
add_test(ssl_get_shared_ciphers ssl_get_shared_ciphers)

# ssl_methods
add_executable(ssl_methods ssl_methods.c)
target_link_libraries(ssl_methods ${OPENSSL_TEST_LIBS})
add_test(ssl_methods ssl_methods)

# ssl_set_alpn_protos
add_executable(ssl_set_alpn_protos ssl_set_alpn_protos.c)
target_link_libraries(ssl_set_alpn_protos ${OPENSSL_TEST_LIBS})
add_test(ssl_set_alpn_protos ssl_set_alpn_protos)

# ssl_versions
add_executable(ssl_versions ssl_versions.c)
target_link_libraries(ssl_versions ${OPENSSL_TEST_LIBS})
add_test(ssl_versions ssl_versions)

# ssltest
add_executable(ssltest ssltest.c)
Changes to jni/libressl/tests/Makefile.am.
1
2
3
4
5
6

7
8
9
10
11
12
13
include $(top_srcdir)/Makefile.am.common

AM_CPPFLAGS += -DLIBRESSL_CRYPTO_INTERNAL

AM_CPPFLAGS += -I $(top_srcdir)/crypto/asn1
AM_CPPFLAGS += -I $(top_srcdir)/crypto/bio

AM_CPPFLAGS += -I $(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I $(top_srcdir)/crypto/modes
AM_CPPFLAGS += -I $(top_srcdir)/crypto/x509
AM_CPPFLAGS += -I $(top_srcdir)/ssl
AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl
AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl/compat
AM_CPPFLAGS += -D_PATH_SSL_CA_FILE=\"$(top_srcdir)/cert.pem\"






>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
include $(top_srcdir)/Makefile.am.common

AM_CPPFLAGS += -DLIBRESSL_CRYPTO_INTERNAL

AM_CPPFLAGS += -I $(top_srcdir)/crypto/asn1
AM_CPPFLAGS += -I $(top_srcdir)/crypto/bio
AM_CPPFLAGS += -I $(top_srcdir)/crypto/bn
AM_CPPFLAGS += -I $(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I $(top_srcdir)/crypto/modes
AM_CPPFLAGS += -I $(top_srcdir)/crypto/x509
AM_CPPFLAGS += -I $(top_srcdir)/ssl
AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl
AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl/compat
AM_CPPFLAGS += -D_PATH_SSL_CA_FILE=\"$(top_srcdir)/cert.pem\"
29
30
31
32
33
34
35





36
37
38
39
40
41
42
43
44
45
46
47
48
49
50





51
52
53
54
55
56
57

# aeadtest
TESTS += aeadtest.sh
check_PROGRAMS += aeadtest
aeadtest_SOURCES = aeadtest.c
EXTRA_DIST += aeadtest.sh
EXTRA_DIST += aeadtests.txt






# aes_wrap
TESTS += aes_wrap
check_PROGRAMS += aes_wrap
aes_wrap_SOURCES = aes_wrap.c

# arc4randomforktest
# Windows/mingw does not have fork, but Cygwin does.
if !HOST_WIN
TESTS += arc4randomforktest.sh
check_PROGRAMS += arc4randomforktest
arc4randomforktest_SOURCES = arc4randomforktest.c
endif
EXTRA_DIST += arc4randomforktest.sh






# asn1api
TESTS += asn1api
check_PROGRAMS += asn1api
asn1api_SOURCES = asn1api.c

# asn1basic
TESTS += asn1basic







>
>
>
>
>















>
>
>
>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

# aeadtest
TESTS += aeadtest.sh
check_PROGRAMS += aeadtest
aeadtest_SOURCES = aeadtest.c
EXTRA_DIST += aeadtest.sh
EXTRA_DIST += aeadtests.txt
EXTRA_DIST += aes_128_gcm_tests.txt
EXTRA_DIST += aes_192_gcm_tests.txt
EXTRA_DIST += aes_256_gcm_tests.txt
EXTRA_DIST += chacha20_poly1305_tests.txt
EXTRA_DIST += xchacha20_poly1305_tests.txt

# aes_wrap
TESTS += aes_wrap
check_PROGRAMS += aes_wrap
aes_wrap_SOURCES = aes_wrap.c

# arc4randomforktest
# Windows/mingw does not have fork, but Cygwin does.
if !HOST_WIN
TESTS += arc4randomforktest.sh
check_PROGRAMS += arc4randomforktest
arc4randomforktest_SOURCES = arc4randomforktest.c
endif
EXTRA_DIST += arc4randomforktest.sh

# asn1_string_to_utf8
TESTS += asn1_string_to_utf8
check_PROGRAMS += asn1_string_to_utf8
asn1_string_to_utf8_SOURCES = asn1_string_to_utf8.c

# asn1api
TESTS += asn1api
check_PROGRAMS += asn1api
asn1api_SOURCES = asn1api.c

# asn1basic
TESTS += asn1basic
112
113
114
115
116
117
118





119
120
121
122
123
124
125
126
127
128





129
130
131
132
133
134
135
endif

# bnaddsub
TESTS += bnaddsub
check_PROGRAMS += bnaddsub
bnaddsub_SOURCES = bnaddsub.c






# bn_mod_exp2_mont
TESTS += bn_mod_exp2_mont
check_PROGRAMS += bn_mod_exp2_mont
bn_mod_exp2_mont_SOURCES = bn_mod_exp2_mont.c

# bn_mod_sqrt
TESTS += bn_mod_sqrt
check_PROGRAMS += bn_mod_sqrt
bn_mod_sqrt_SOURCES = bn_mod_sqrt.c






# bn_rand_interval
TESTS += bn_rand_interval
check_PROGRAMS += bn_rand_interval
bn_rand_interval_SOURCES = bn_rand_interval.c

# bntest
TESTS += bntest







>
>
>
>
>










>
>
>
>
>







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
endif

# bnaddsub
TESTS += bnaddsub
check_PROGRAMS += bnaddsub
bnaddsub_SOURCES = bnaddsub.c

# bn_isqrt
TESTS += bn_isqrt
check_PROGRAMS += bn_isqrt
bn_isqrt_SOURCES = bn_isqrt.c

# bn_mod_exp2_mont
TESTS += bn_mod_exp2_mont
check_PROGRAMS += bn_mod_exp2_mont
bn_mod_exp2_mont_SOURCES = bn_mod_exp2_mont.c

# bn_mod_sqrt
TESTS += bn_mod_sqrt
check_PROGRAMS += bn_mod_sqrt
bn_mod_sqrt_SOURCES = bn_mod_sqrt.c

# bn_primes
TESTS += bn_primes
check_PROGRAMS += bn_primes
bn_primes_SOURCES = bn_primes.c

# bn_rand_interval
TESTS += bn_rand_interval
check_PROGRAMS += bn_rand_interval
bn_rand_interval_SOURCES = bn_rand_interval.c

# bntest
TESTS += bntest
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# keypairtest
TESTS += keypairtest.sh
keypairtest_CPPFLAGS = -I $(top_srcdir)/tls $(AM_CPPFLAGS)
check_PROGRAMS += keypairtest
keypairtest_SOURCES = keypairtest.c
EXTRA_DIST += keypairtest.sh

# md4test
TESTS += md4test
check_PROGRAMS += md4test
md4test_SOURCES = md4test.c

# md5test
TESTS += md5test
check_PROGRAMS += md5test
md5test_SOURCES = md5test.c

# mont
TESTS += mont
check_PROGRAMS += mont
mont_SOURCES = mont.c

# objectstest







|
|
|
|
<
<
<
<
<







356
357
358
359
360
361
362
363
364
365
366





367
368
369
370
371
372
373
# keypairtest
TESTS += keypairtest.sh
keypairtest_CPPFLAGS = -I $(top_srcdir)/tls $(AM_CPPFLAGS)
check_PROGRAMS += keypairtest
keypairtest_SOURCES = keypairtest.c
EXTRA_DIST += keypairtest.sh

# md_test
TESTS += md_test
check_PROGRAMS += md_test
md_test_SOURCES = md_test.c






# mont
TESTS += mont
check_PROGRAMS += mont
mont_SOURCES = mont.c

# objectstest
400
401
402
403
404
405
406






407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# pq_test
TESTS += pq_test.sh
check_PROGRAMS += pq_test
pq_test_SOURCES = pq_test.c
EXTRA_DIST += pq_test.sh pq_test.bat
EXTRA_DIST += pq_expected.txt







# randtest
TESTS += randtest
check_PROGRAMS += randtest
randtest_SOURCES = randtest.c

# rc2test
TESTS += rc2test
check_PROGRAMS += rc2test
rc2test_SOURCES = rc2test.c

# rc4test
TESTS += rc4test
check_PROGRAMS += rc4test
rc4test_SOURCES = rc4test.c

# recordtest
TESTS += recordtest
check_PROGRAMS += recordtest
recordtest_SOURCES = recordtest.c

# record_layer_test







>
>
>
>
>
>





|
|
|
|

|
|
|
|







416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# pq_test
TESTS += pq_test.sh
check_PROGRAMS += pq_test
pq_test_SOURCES = pq_test.c
EXTRA_DIST += pq_test.sh pq_test.bat
EXTRA_DIST += pq_expected.txt

# quictest
TESTS += quictest.sh
check_PROGRAMS += quictest
quictest_SOURCES = quictest.c
EXTRA_DIST += quictest.sh quictest.bat

# randtest
TESTS += randtest
check_PROGRAMS += randtest
randtest_SOURCES = randtest.c

# rc2_test
TESTS += rc2_test
check_PROGRAMS += rc2_test
rc2_test_SOURCES = rc2_test.c

# rc4_test
TESTS += rc4_test
check_PROGRAMS += rc4_test
rc4_test_SOURCES = rc4_test.c

# recordtest
TESTS += recordtest
check_PROGRAMS += recordtest
recordtest_SOURCES = recordtest.c

# record_layer_test
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
if SMALL_TIME_T
TESTS += rfc5280time_small.test
else
TESTS += rfc5280time
endif
EXTRA_DIST += rfc5280time_small.test

# rmdtest
TESTS += rmdtest
check_PROGRAMS += rmdtest
rmdtest_SOURCES = rmdtest.c

# rsa_test
TESTS += rsa_test
check_PROGRAMS += rsa_test
rsa_test_SOURCES = rsa_test.c

# servertest
TESTS += servertest.sh
check_PROGRAMS += servertest
servertest_SOURCES = servertest.c
EXTRA_DIST += servertest.sh servertest.bat

# sha1test
TESTS += sha1test
check_PROGRAMS += sha1test
sha1test_SOURCES = sha1test.c

# sha256test
TESTS += sha256test
check_PROGRAMS += sha256test
sha256test_SOURCES = sha256test.c

# sha512test
TESTS += sha512test
check_PROGRAMS += sha512test
sha512test_SOURCES = sha512test.c

# sm3test
TESTS += sm3test
check_PROGRAMS += sm3test
sm3test_SOURCES = sm3test.c

# sm4test







|
|
|
|












|
|
|
|
<
<
<
<
<
<
<
<
<
<







463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489










490
491
492
493
494
495
496
if SMALL_TIME_T
TESTS += rfc5280time_small.test
else
TESTS += rfc5280time
endif
EXTRA_DIST += rfc5280time_small.test

# rmd_test
TESTS += rmd_test
check_PROGRAMS += rmd_test
rmd_test_SOURCES = rmd_test.c

# rsa_test
TESTS += rsa_test
check_PROGRAMS += rsa_test
rsa_test_SOURCES = rsa_test.c

# servertest
TESTS += servertest.sh
check_PROGRAMS += servertest
servertest_SOURCES = servertest.c
EXTRA_DIST += servertest.sh servertest.bat

# sha_test
TESTS += sha_test
check_PROGRAMS += sha_test
sha_test_SOURCES = sha_test.c











# sm3test
TESTS += sm3test
check_PROGRAMS += sm3test
sm3test_SOURCES = sm3test.c

# sm4test
493
494
495
496
497
498
499





500
501
502
503
504
505
506
507
508
509
510












511
512
513
514
515
516
517
ssl_get_shared_ciphers_SOURCES = ssl_get_shared_ciphers.c

# ssl_methods
TESTS += ssl_methods
check_PROGRAMS += ssl_methods
ssl_methods_SOURCES = ssl_methods.c






# ssl_versions
TESTS += ssl_versions
check_PROGRAMS += ssl_versions
ssl_versions_SOURCES = ssl_versions.c

# ssltest
TESTS += ssltest.sh
check_PROGRAMS += ssltest
ssltest_SOURCES = ssltest.c
EXTRA_DIST += ssltest.sh ssltest.bat
EXTRA_DIST += testssl testssl.bat ca.pem server.pem













# string_table
TESTS += string_table
check_PROGRAMS += string_table
string_table_SOURCES = string_table.c

# testdsa







>
>
>
>
>










|
>
>
>
>
>
>
>
>
>
>
>
>







505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
ssl_get_shared_ciphers_SOURCES = ssl_get_shared_ciphers.c

# ssl_methods
TESTS += ssl_methods
check_PROGRAMS += ssl_methods
ssl_methods_SOURCES = ssl_methods.c

# ssl_set_alpn_protos
TESTS += ssl_set_alpn_protos
check_PROGRAMS += ssl_set_alpn_protos
ssl_set_alpn_protos_SOURCES = ssl_set_alpn_protos.c

# ssl_versions
TESTS += ssl_versions
check_PROGRAMS += ssl_versions
ssl_versions_SOURCES = ssl_versions.c

# ssltest
TESTS += ssltest.sh
check_PROGRAMS += ssltest
ssltest_SOURCES = ssltest.c
EXTRA_DIST += ssltest.sh ssltest.bat
EXTRA_DIST += testssl testssl.bat
EXTRA_DIST += ca-int-ecdsa.crl ca-int-ecdsa.pem ca-int-rsa.crl ca-int-rsa.pem
EXTRA_DIST += ca-root-ecdsa.pem ca-root-rsa.pem ca.pem client.pem
EXTRA_DIST += client1-ecdsa-chain.pem client1-ecdsa.pem client1-rsa-chain.pem
EXTRA_DIST += client1-rsa.pem client2-ecdsa-chain.pem client2-ecdsa.pem
EXTRA_DIST += client2-rsa-chain.pem client2-rsa.pem client3-ecdsa-chain.pem
EXTRA_DIST += client3-ecdsa.pem client3-rsa-chain.pem client3-rsa.pem
EXTRA_DIST += server.pem server1-ecdsa-chain.pem server1-ecdsa.pem
EXTRA_DIST += server1-rsa-chain.pem server1-rsa.pem server2-ecdsa-chain.pem
EXTRA_DIST += server2-ecdsa.pem server2-rsa-chain.pem server2-rsa.pem
EXTRA_DIST += server3-ecdsa-chain.pem server3-ecdsa.pem server3-rsa-chain.pem
EXTRA_DIST += server3-rsa.pem


# string_table
TESTS += string_table
check_PROGRAMS += string_table
string_table_SOURCES = string_table.c

# testdsa
Changes to jni/libressl/tests/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
85
86
87
88
89
90
91
92

93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
129

130
131
132
133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@HOST_ASM_MACOSX_X86_64_TRUE@am__append_1 = $(abs_top_builddir)/crypto/.libs/libcrypto_la-cpuid-macosx-x86_64.o
TESTS = aeadtest.sh aes_wrap$(EXEEXT) $(am__append_2) asn1api$(EXEEXT) \

	asn1basic$(EXEEXT) asn1complex$(EXEEXT) asn1evp$(EXEEXT) \
	asn1object$(EXEEXT) asn1string_copy$(EXEEXT) asn1test$(EXEEXT) \
	asn1time$(EXEEXT) asn1x509$(EXEEXT) base64test$(EXEEXT) \
	bftest$(EXEEXT) $(am__EXEEXT_2) bnaddsub$(EXEEXT) \
	bn_mod_exp2_mont$(EXEEXT) bn_mod_sqrt$(EXEEXT) \

	bn_rand_interval$(EXEEXT) bntest$(EXEEXT) \
	bn_to_string$(EXEEXT) buffertest$(EXEEXT) \
	bytestringtest$(EXEEXT) casttest$(EXEEXT) chachatest$(EXEEXT) \
	cipher_list$(EXEEXT) cipherstest$(EXEEXT) clienttest$(EXEEXT) \
	cmstest$(EXEEXT) configtest$(EXEEXT) constraints$(EXEEXT) \
	cts128test$(EXEEXT) destest$(EXEEXT) dhtest$(EXEEXT) \
	dsatest$(EXEEXT) $(am__append_6) ec_asn1_test$(EXEEXT) \
	ec_point_conversion$(EXEEXT) ecdhtest$(EXEEXT) \
	ecdsatest$(EXEEXT) ectest$(EXEEXT) enginetest$(EXEEXT) \
	evp_pkey_check$(EXEEXT) evp_pkey_cleanup$(EXEEXT) evptest.sh \
	$(am__EXEEXT_4) exptest$(EXEEXT) freenull$(EXEEXT) \
	gcm128test$(EXEEXT) gost2814789t$(EXEEXT) \
	handshake_table$(EXEEXT) hkdftest$(EXEEXT) hmactest$(EXEEXT) \
	ideatest$(EXEEXT) igetest$(EXEEXT) key_schedule$(EXEEXT) \
	keypairtest.sh md4test$(EXEEXT) md5test$(EXEEXT) mont$(EXEEXT) \
	objectstest$(EXEEXT) $(am__append_11) optionstest$(EXEEXT) \
	pbkdf2$(EXEEXT) $(am__append_13) pkcs7test$(EXEEXT) \
	poly1305test$(EXEEXT) pq_test.sh randtest$(EXEEXT) \
	rc2test$(EXEEXT) rc4test$(EXEEXT) recordtest$(EXEEXT) \
	record_layer_test$(EXEEXT) rfc3779$(EXEEXT) $(am__append_15) \
	$(am__EXEEXT_7) rmdtest$(EXEEXT) rsa_test$(EXEEXT) \
	servertest.sh sha1test$(EXEEXT) sha256test$(EXEEXT) \
	sha512test$(EXEEXT) sm3test$(EXEEXT) sm4test$(EXEEXT) \
	ssl_get_shared_ciphers$(EXEEXT) ssl_methods$(EXEEXT) \

	ssl_versions$(EXEEXT) ssltest.sh string_table$(EXEEXT) \
	testdsa.sh testenc.sh testrsa.sh timingsafe$(EXEEXT) \
	tlsexttest$(EXEEXT) tlslegacytest$(EXEEXT) tlstest.sh \
	tls_ext_alpn$(EXEEXT) tls_prf$(EXEEXT) utf8test$(EXEEXT) \
	valid_handshakes_terminate$(EXEEXT) verifytest$(EXEEXT) \
	x25519test$(EXEEXT) x509attribute$(EXEEXT) x509_info$(EXEEXT) \
	x509name$(EXEEXT) x509req_ext$(EXEEXT)
check_PROGRAMS = aeadtest$(EXEEXT) aes_wrap$(EXEEXT) $(am__EXEEXT_1) \

	asn1api$(EXEEXT) asn1basic$(EXEEXT) asn1complex$(EXEEXT) \
	asn1evp$(EXEEXT) asn1object$(EXEEXT) asn1string_copy$(EXEEXT) \
	asn1test$(EXEEXT) asn1time$(EXEEXT) asn1x509$(EXEEXT) \
	base64test$(EXEEXT) bftest$(EXEEXT) $(am__EXEEXT_2) \
	bnaddsub$(EXEEXT) bn_mod_exp2_mont$(EXEEXT) \

	bn_mod_sqrt$(EXEEXT) bn_rand_interval$(EXEEXT) bntest$(EXEEXT) \
	bn_to_string$(EXEEXT) buffertest$(EXEEXT) \
	bytestringtest$(EXEEXT) casttest$(EXEEXT) chachatest$(EXEEXT) \
	cipher_list$(EXEEXT) cipherstest$(EXEEXT) clienttest$(EXEEXT) \
	cmstest$(EXEEXT) configtest$(EXEEXT) constraints$(EXEEXT) \
	cts128test$(EXEEXT) destest$(EXEEXT) dhtest$(EXEEXT) \
	dsatest$(EXEEXT) $(am__EXEEXT_3) ec_asn1_test$(EXEEXT) \
	ec_point_conversion$(EXEEXT) ecdhtest$(EXEEXT) \
	ecdsatest$(EXEEXT) ectest$(EXEEXT) enginetest$(EXEEXT) \
	evp_pkey_check$(EXEEXT) evp_pkey_cleanup$(EXEEXT) \
	evptest$(EXEEXT) $(am__EXEEXT_4) exptest$(EXEEXT) \
	freenull$(EXEEXT) gcm128test$(EXEEXT) gost2814789t$(EXEEXT) \
	handshake_table$(EXEEXT) hkdftest$(EXEEXT) hmactest$(EXEEXT) \
	ideatest$(EXEEXT) igetest$(EXEEXT) key_schedule$(EXEEXT) \
	keypairtest$(EXEEXT) md4test$(EXEEXT) md5test$(EXEEXT) \
	mont$(EXEEXT) objectstest$(EXEEXT) $(am__EXEEXT_5) \
	optionstest$(EXEEXT) pbkdf2$(EXEEXT) $(am__EXEEXT_6) \
	pkcs7test$(EXEEXT) poly1305test$(EXEEXT) pq_test$(EXEEXT) \
	randtest$(EXEEXT) rc2test$(EXEEXT) rc4test$(EXEEXT) \
	recordtest$(EXEEXT) record_layer_test$(EXEEXT) \
	rfc3779$(EXEEXT) rfc5280time$(EXEEXT) rmdtest$(EXEEXT) \
	rsa_test$(EXEEXT) servertest$(EXEEXT) sha1test$(EXEEXT) \
	sha256test$(EXEEXT) sha512test$(EXEEXT) sm3test$(EXEEXT) \
	sm4test$(EXEEXT) ssl_get_shared_ciphers$(EXEEXT) \
	ssl_methods$(EXEEXT) ssl_versions$(EXEEXT) ssltest$(EXEEXT) \
	string_table$(EXEEXT) timingsafe$(EXEEXT) tlsexttest$(EXEEXT) \
	tlslegacytest$(EXEEXT) tlstest$(EXEEXT) tls_ext_alpn$(EXEEXT) \
	tls_prf$(EXEEXT) utf8test$(EXEEXT) \
	valid_handshakes_terminate$(EXEEXT) verifytest$(EXEEXT) \
	x25519test$(EXEEXT) x509attribute$(EXEEXT) x509_info$(EXEEXT) \
	x509name$(EXEEXT) x509req_ext$(EXEEXT)

# arc4randomforktest
# Windows/mingw does not have fork, but Cygwin does.
@HOST_WIN_FALSE@am__append_2 = arc4randomforktest.sh







|
>




|
>














|


|
|

|
<
|
|
>








>
|
|
|
|
|
>
|













|
|
|
|
|

|
|
|
|
|
|
|
|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@HOST_ASM_MACOSX_X86_64_TRUE@am__append_1 = $(abs_top_builddir)/crypto/.libs/libcrypto_la-cpuid-macosx-x86_64.o
TESTS = aeadtest.sh aes_wrap$(EXEEXT) $(am__append_2) \
	asn1_string_to_utf8$(EXEEXT) asn1api$(EXEEXT) \
	asn1basic$(EXEEXT) asn1complex$(EXEEXT) asn1evp$(EXEEXT) \
	asn1object$(EXEEXT) asn1string_copy$(EXEEXT) asn1test$(EXEEXT) \
	asn1time$(EXEEXT) asn1x509$(EXEEXT) base64test$(EXEEXT) \
	bftest$(EXEEXT) $(am__EXEEXT_2) bnaddsub$(EXEEXT) \
	bn_isqrt$(EXEEXT) bn_mod_exp2_mont$(EXEEXT) \
	bn_mod_sqrt$(EXEEXT) bn_primes$(EXEEXT) \
	bn_rand_interval$(EXEEXT) bntest$(EXEEXT) \
	bn_to_string$(EXEEXT) buffertest$(EXEEXT) \
	bytestringtest$(EXEEXT) casttest$(EXEEXT) chachatest$(EXEEXT) \
	cipher_list$(EXEEXT) cipherstest$(EXEEXT) clienttest$(EXEEXT) \
	cmstest$(EXEEXT) configtest$(EXEEXT) constraints$(EXEEXT) \
	cts128test$(EXEEXT) destest$(EXEEXT) dhtest$(EXEEXT) \
	dsatest$(EXEEXT) $(am__append_6) ec_asn1_test$(EXEEXT) \
	ec_point_conversion$(EXEEXT) ecdhtest$(EXEEXT) \
	ecdsatest$(EXEEXT) ectest$(EXEEXT) enginetest$(EXEEXT) \
	evp_pkey_check$(EXEEXT) evp_pkey_cleanup$(EXEEXT) evptest.sh \
	$(am__EXEEXT_4) exptest$(EXEEXT) freenull$(EXEEXT) \
	gcm128test$(EXEEXT) gost2814789t$(EXEEXT) \
	handshake_table$(EXEEXT) hkdftest$(EXEEXT) hmactest$(EXEEXT) \
	ideatest$(EXEEXT) igetest$(EXEEXT) key_schedule$(EXEEXT) \
	keypairtest.sh md_test$(EXEEXT) mont$(EXEEXT) \
	objectstest$(EXEEXT) $(am__append_11) optionstest$(EXEEXT) \
	pbkdf2$(EXEEXT) $(am__append_13) pkcs7test$(EXEEXT) \
	poly1305test$(EXEEXT) pq_test.sh quictest.sh randtest$(EXEEXT) \
	rc2_test$(EXEEXT) rc4_test$(EXEEXT) recordtest$(EXEEXT) \
	record_layer_test$(EXEEXT) rfc3779$(EXEEXT) $(am__append_15) \
	$(am__EXEEXT_7) rmd_test$(EXEEXT) rsa_test$(EXEEXT) \

	servertest.sh sha_test$(EXEEXT) sm3test$(EXEEXT) \
	sm4test$(EXEEXT) ssl_get_shared_ciphers$(EXEEXT) \
	ssl_methods$(EXEEXT) ssl_set_alpn_protos$(EXEEXT) \
	ssl_versions$(EXEEXT) ssltest.sh string_table$(EXEEXT) \
	testdsa.sh testenc.sh testrsa.sh timingsafe$(EXEEXT) \
	tlsexttest$(EXEEXT) tlslegacytest$(EXEEXT) tlstest.sh \
	tls_ext_alpn$(EXEEXT) tls_prf$(EXEEXT) utf8test$(EXEEXT) \
	valid_handshakes_terminate$(EXEEXT) verifytest$(EXEEXT) \
	x25519test$(EXEEXT) x509attribute$(EXEEXT) x509_info$(EXEEXT) \
	x509name$(EXEEXT) x509req_ext$(EXEEXT)
check_PROGRAMS = aeadtest$(EXEEXT) aes_wrap$(EXEEXT) $(am__EXEEXT_1) \
	asn1_string_to_utf8$(EXEEXT) asn1api$(EXEEXT) \
	asn1basic$(EXEEXT) asn1complex$(EXEEXT) asn1evp$(EXEEXT) \
	asn1object$(EXEEXT) asn1string_copy$(EXEEXT) asn1test$(EXEEXT) \
	asn1time$(EXEEXT) asn1x509$(EXEEXT) base64test$(EXEEXT) \
	bftest$(EXEEXT) $(am__EXEEXT_2) bnaddsub$(EXEEXT) \
	bn_isqrt$(EXEEXT) bn_mod_exp2_mont$(EXEEXT) \
	bn_mod_sqrt$(EXEEXT) bn_primes$(EXEEXT) \
	bn_rand_interval$(EXEEXT) bntest$(EXEEXT) \
	bn_to_string$(EXEEXT) buffertest$(EXEEXT) \
	bytestringtest$(EXEEXT) casttest$(EXEEXT) chachatest$(EXEEXT) \
	cipher_list$(EXEEXT) cipherstest$(EXEEXT) clienttest$(EXEEXT) \
	cmstest$(EXEEXT) configtest$(EXEEXT) constraints$(EXEEXT) \
	cts128test$(EXEEXT) destest$(EXEEXT) dhtest$(EXEEXT) \
	dsatest$(EXEEXT) $(am__EXEEXT_3) ec_asn1_test$(EXEEXT) \
	ec_point_conversion$(EXEEXT) ecdhtest$(EXEEXT) \
	ecdsatest$(EXEEXT) ectest$(EXEEXT) enginetest$(EXEEXT) \
	evp_pkey_check$(EXEEXT) evp_pkey_cleanup$(EXEEXT) \
	evptest$(EXEEXT) $(am__EXEEXT_4) exptest$(EXEEXT) \
	freenull$(EXEEXT) gcm128test$(EXEEXT) gost2814789t$(EXEEXT) \
	handshake_table$(EXEEXT) hkdftest$(EXEEXT) hmactest$(EXEEXT) \
	ideatest$(EXEEXT) igetest$(EXEEXT) key_schedule$(EXEEXT) \
	keypairtest$(EXEEXT) md_test$(EXEEXT) mont$(EXEEXT) \
	objectstest$(EXEEXT) $(am__EXEEXT_5) optionstest$(EXEEXT) \
	pbkdf2$(EXEEXT) $(am__EXEEXT_6) pkcs7test$(EXEEXT) \
	poly1305test$(EXEEXT) pq_test$(EXEEXT) quictest$(EXEEXT) \
	randtest$(EXEEXT) rc2_test$(EXEEXT) rc4_test$(EXEEXT) \
	recordtest$(EXEEXT) record_layer_test$(EXEEXT) \
	rfc3779$(EXEEXT) rfc5280time$(EXEEXT) rmd_test$(EXEEXT) \
	rsa_test$(EXEEXT) servertest$(EXEEXT) sha_test$(EXEEXT) \
	sm3test$(EXEEXT) sm4test$(EXEEXT) \
	ssl_get_shared_ciphers$(EXEEXT) ssl_methods$(EXEEXT) \
	ssl_set_alpn_protos$(EXEEXT) ssl_versions$(EXEEXT) \
	ssltest$(EXEEXT) string_table$(EXEEXT) timingsafe$(EXEEXT) \
	tlsexttest$(EXEEXT) tlslegacytest$(EXEEXT) tlstest$(EXEEXT) \
	tls_ext_alpn$(EXEEXT) tls_prf$(EXEEXT) utf8test$(EXEEXT) \
	valid_handshakes_terminate$(EXEEXT) verifytest$(EXEEXT) \
	x25519test$(EXEEXT) x509attribute$(EXEEXT) x509_info$(EXEEXT) \
	x509name$(EXEEXT) x509req_ext$(EXEEXT)

# arc4randomforktest
# Windows/mingw does not have fork, but Cygwin does.
@HOST_WIN_FALSE@am__append_2 = arc4randomforktest.sh
246
247
248
249
250
251
252








253
254
255
256
257
258
259
arc4randomforktest_OBJECTS = $(am_arc4randomforktest_OBJECTS)
arc4randomforktest_LDADD = $(LDADD)
arc4randomforktest_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)








am_asn1api_OBJECTS = asn1api.$(OBJEXT)
asn1api_OBJECTS = $(am_asn1api_OBJECTS)
asn1api_LDADD = $(LDADD)
asn1api_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)







>
>
>
>
>
>
>
>







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
arc4randomforktest_OBJECTS = $(am_arc4randomforktest_OBJECTS)
arc4randomforktest_LDADD = $(LDADD)
arc4randomforktest_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_asn1_string_to_utf8_OBJECTS = asn1_string_to_utf8.$(OBJEXT)
asn1_string_to_utf8_OBJECTS = $(am_asn1_string_to_utf8_OBJECTS)
asn1_string_to_utf8_LDADD = $(LDADD)
asn1_string_to_utf8_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_asn1api_OBJECTS = asn1api.$(OBJEXT)
asn1api_OBJECTS = $(am_asn1api_OBJECTS)
asn1api_LDADD = $(LDADD)
asn1api_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
329
330
331
332
333
334
335







336
337
338
339
340
341
342
343
344
345
346
347
348
349
350







351
352
353
354
355
356
357
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am__biotest_SOURCES_DIST = biotest.c
@ENABLE_EXTRATESTS_TRUE@am_biotest_OBJECTS = biotest.$(OBJEXT)
biotest_OBJECTS = $(am_biotest_OBJECTS)
biotest_LDADD = $(LDADD)
biotest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \







	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_mod_exp2_mont_OBJECTS = bn_mod_exp2_mont.$(OBJEXT)
bn_mod_exp2_mont_OBJECTS = $(am_bn_mod_exp2_mont_OBJECTS)
bn_mod_exp2_mont_LDADD = $(LDADD)
bn_mod_exp2_mont_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_mod_sqrt_OBJECTS = bn_mod_sqrt.$(OBJEXT)
bn_mod_sqrt_OBJECTS = $(am_bn_mod_sqrt_OBJECTS)
bn_mod_sqrt_LDADD = $(LDADD)
bn_mod_sqrt_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \







	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_rand_interval_OBJECTS = bn_rand_interval.$(OBJEXT)
bn_rand_interval_OBJECTS = $(am_bn_rand_interval_OBJECTS)
bn_rand_interval_LDADD = $(LDADD)
bn_rand_interval_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \







>
>
>
>
>
>
>















>
>
>
>
>
>
>







341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am__biotest_SOURCES_DIST = biotest.c
@ENABLE_EXTRATESTS_TRUE@am_biotest_OBJECTS = biotest.$(OBJEXT)
biotest_OBJECTS = $(am_biotest_OBJECTS)
biotest_LDADD = $(LDADD)
biotest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_isqrt_OBJECTS = bn_isqrt.$(OBJEXT)
bn_isqrt_OBJECTS = $(am_bn_isqrt_OBJECTS)
bn_isqrt_LDADD = $(LDADD)
bn_isqrt_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_mod_exp2_mont_OBJECTS = bn_mod_exp2_mont.$(OBJEXT)
bn_mod_exp2_mont_OBJECTS = $(am_bn_mod_exp2_mont_OBJECTS)
bn_mod_exp2_mont_LDADD = $(LDADD)
bn_mod_exp2_mont_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_mod_sqrt_OBJECTS = bn_mod_sqrt.$(OBJEXT)
bn_mod_sqrt_OBJECTS = $(am_bn_mod_sqrt_OBJECTS)
bn_mod_sqrt_LDADD = $(LDADD)
bn_mod_sqrt_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_primes_OBJECTS = bn_primes.$(OBJEXT)
bn_primes_OBJECTS = $(am_bn_primes_OBJECTS)
bn_primes_LDADD = $(LDADD)
bn_primes_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_bn_rand_interval_OBJECTS = bn_rand_interval.$(OBJEXT)
bn_rand_interval_OBJECTS = $(am_bn_rand_interval_OBJECTS)
bn_rand_interval_LDADD = $(LDADD)
bn_rand_interval_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
am_keypairtest_OBJECTS = keypairtest-keypairtest.$(OBJEXT)
keypairtest_OBJECTS = $(am_keypairtest_OBJECTS)
keypairtest_LDADD = $(LDADD)
keypairtest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_md4test_OBJECTS = md4test.$(OBJEXT)
md4test_OBJECTS = $(am_md4test_OBJECTS)
md4test_LDADD = $(LDADD)
md4test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_md5test_OBJECTS = md5test.$(OBJEXT)
md5test_OBJECTS = $(am_md5test_OBJECTS)
md5test_LDADD = $(LDADD)
md5test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_mont_OBJECTS = mont.$(OBJEXT)
mont_OBJECTS = $(am_mont_OBJECTS)
mont_LDADD = $(LDADD)
mont_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \







|
|
|
|
<
<
<
<
<
<
<







661
662
663
664
665
666
667
668
669
670
671







672
673
674
675
676
677
678
am_keypairtest_OBJECTS = keypairtest-keypairtest.$(OBJEXT)
keypairtest_OBJECTS = $(am_keypairtest_OBJECTS)
keypairtest_LDADD = $(LDADD)
keypairtest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_md_test_OBJECTS = md_test.$(OBJEXT)
md_test_OBJECTS = $(am_md_test_OBJECTS)
md_test_LDADD = $(LDADD)
md_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \







	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_mont_OBJECTS = mont.$(OBJEXT)
mont_OBJECTS = $(am_mont_OBJECTS)
mont_LDADD = $(LDADD)
mont_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
715
716
717
718
719
720
721







722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
am_pq_test_OBJECTS = pq_test.$(OBJEXT)
pq_test_OBJECTS = $(am_pq_test_OBJECTS)
pq_test_LDADD = $(LDADD)
pq_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)







am_randtest_OBJECTS = randtest.$(OBJEXT)
randtest_OBJECTS = $(am_randtest_OBJECTS)
randtest_LDADD = $(LDADD)
randtest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rc2test_OBJECTS = rc2test.$(OBJEXT)
rc2test_OBJECTS = $(am_rc2test_OBJECTS)
rc2test_LDADD = $(LDADD)
rc2test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rc4test_OBJECTS = rc4test.$(OBJEXT)
rc4test_OBJECTS = $(am_rc4test_OBJECTS)
rc4test_LDADD = $(LDADD)
rc4test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_record_layer_test_OBJECTS = record_layer_test.$(OBJEXT)
record_layer_test_OBJECTS = $(am_record_layer_test_OBJECTS)
record_layer_test_LDADD = $(LDADD)
record_layer_test_DEPENDENCIES =  \







>
>
>
>
>
>
>







|
|
|
|



|
|
|
|







734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
am_pq_test_OBJECTS = pq_test.$(OBJEXT)
pq_test_OBJECTS = $(am_pq_test_OBJECTS)
pq_test_LDADD = $(LDADD)
pq_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_quictest_OBJECTS = quictest.$(OBJEXT)
quictest_OBJECTS = $(am_quictest_OBJECTS)
quictest_LDADD = $(LDADD)
quictest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_randtest_OBJECTS = randtest.$(OBJEXT)
randtest_OBJECTS = $(am_randtest_OBJECTS)
randtest_LDADD = $(LDADD)
randtest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rc2_test_OBJECTS = rc2_test.$(OBJEXT)
rc2_test_OBJECTS = $(am_rc2_test_OBJECTS)
rc2_test_LDADD = $(LDADD)
rc2_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rc4_test_OBJECTS = rc4_test.$(OBJEXT)
rc4_test_OBJECTS = $(am_rc4_test_OBJECTS)
rc4_test_LDADD = $(LDADD)
rc4_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_record_layer_test_OBJECTS = record_layer_test.$(OBJEXT)
record_layer_test_OBJECTS = $(am_record_layer_test_OBJECTS)
record_layer_test_LDADD = $(LDADD)
record_layer_test_DEPENDENCIES =  \
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
am_rfc5280time_OBJECTS = rfc5280time.$(OBJEXT)
rfc5280time_OBJECTS = $(am_rfc5280time_OBJECTS)
rfc5280time_LDADD = $(LDADD)
rfc5280time_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rmdtest_OBJECTS = rmdtest.$(OBJEXT)
rmdtest_OBJECTS = $(am_rmdtest_OBJECTS)
rmdtest_LDADD = $(LDADD)
rmdtest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rsa_test_OBJECTS = rsa_test.$(OBJEXT)
rsa_test_OBJECTS = $(am_rsa_test_OBJECTS)
rsa_test_LDADD = $(LDADD)
rsa_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_servertest_OBJECTS = servertest.$(OBJEXT)
servertest_OBJECTS = $(am_servertest_OBJECTS)
servertest_LDADD = $(LDADD)
servertest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_sha1test_OBJECTS = sha1test.$(OBJEXT)
sha1test_OBJECTS = $(am_sha1test_OBJECTS)
sha1test_LDADD = $(LDADD)
sha1test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_sha256test_OBJECTS = sha256test.$(OBJEXT)
sha256test_OBJECTS = $(am_sha256test_OBJECTS)
sha256test_LDADD = $(LDADD)
sha256test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_sha512test_OBJECTS = sha512test.$(OBJEXT)
sha512test_OBJECTS = $(am_sha512test_OBJECTS)
sha512test_LDADD = $(LDADD)
sha512test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_sm3test_OBJECTS = sm3test.$(OBJEXT)
sm3test_OBJECTS = $(am_sm3test_OBJECTS)
sm3test_LDADD = $(LDADD)
sm3test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \







|
|
|
|

















|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<







791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822














823
824
825
826
827
828
829
am_rfc5280time_OBJECTS = rfc5280time.$(OBJEXT)
rfc5280time_OBJECTS = $(am_rfc5280time_OBJECTS)
rfc5280time_LDADD = $(LDADD)
rfc5280time_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rmd_test_OBJECTS = rmd_test.$(OBJEXT)
rmd_test_OBJECTS = $(am_rmd_test_OBJECTS)
rmd_test_LDADD = $(LDADD)
rmd_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_rsa_test_OBJECTS = rsa_test.$(OBJEXT)
rsa_test_OBJECTS = $(am_rsa_test_OBJECTS)
rsa_test_LDADD = $(LDADD)
rsa_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_servertest_OBJECTS = servertest.$(OBJEXT)
servertest_OBJECTS = $(am_servertest_OBJECTS)
servertest_LDADD = $(LDADD)
servertest_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_sha_test_OBJECTS = sha_test.$(OBJEXT)
sha_test_OBJECTS = $(am_sha_test_OBJECTS)
sha_test_LDADD = $(LDADD)
sha_test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \














	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_sm3test_OBJECTS = sm3test.$(OBJEXT)
sm3test_OBJECTS = $(am_sm3test_OBJECTS)
sm3test_LDADD = $(LDADD)
sm3test_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
834
835
836
837
838
839
840








841
842
843
844
845
846
847
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_ssl_methods_OBJECTS = ssl_methods.$(OBJEXT)
ssl_methods_OBJECTS = $(am_ssl_methods_OBJECTS)
ssl_methods_LDADD = $(LDADD)
ssl_methods_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \








	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_ssl_versions_OBJECTS = ssl_versions.$(OBJEXT)
ssl_versions_OBJECTS = $(am_ssl_versions_OBJECTS)
ssl_versions_LDADD = $(LDADD)
ssl_versions_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \







>
>
>
>
>
>
>
>







846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_ssl_methods_OBJECTS = ssl_methods.$(OBJEXT)
ssl_methods_OBJECTS = $(am_ssl_methods_OBJECTS)
ssl_methods_LDADD = $(LDADD)
ssl_methods_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_ssl_set_alpn_protos_OBJECTS = ssl_set_alpn_protos.$(OBJEXT)
ssl_set_alpn_protos_OBJECTS = $(am_ssl_set_alpn_protos_OBJECTS)
ssl_set_alpn_protos_LDADD = $(LDADD)
ssl_set_alpn_protos_DEPENDENCIES =  \
	$(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a \
	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1)
am_ssl_versions_OBJECTS = ssl_versions.$(OBJEXT)
ssl_versions_OBJECTS = $(am_ssl_versions_OBJECTS)
ssl_versions_LDADD = $(LDADD)
ssl_versions_DEPENDENCIES = $(abs_top_builddir)/tls/.libs/libtls.a \
977
978
979
980
981
982
983
984

985
986
987
988
989
990

991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026

1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 = 
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/aeadtest.Po ./$(DEPDIR)/aes_wrap.Po \
	./$(DEPDIR)/arc4randomforktest.Po ./$(DEPDIR)/asn1api.Po \

	./$(DEPDIR)/asn1basic.Po ./$(DEPDIR)/asn1complex.Po \
	./$(DEPDIR)/asn1evp.Po ./$(DEPDIR)/asn1object.Po \
	./$(DEPDIR)/asn1string_copy.Po ./$(DEPDIR)/asn1test.Po \
	./$(DEPDIR)/asn1time.Po ./$(DEPDIR)/asn1x509.Po \
	./$(DEPDIR)/base64test.Po ./$(DEPDIR)/bftest.Po \
	./$(DEPDIR)/biotest.Po ./$(DEPDIR)/bn_mod_exp2_mont.Po \

	./$(DEPDIR)/bn_mod_sqrt.Po ./$(DEPDIR)/bn_rand_interval.Po \
	./$(DEPDIR)/bn_to_string.Po ./$(DEPDIR)/bnaddsub.Po \
	./$(DEPDIR)/bntest-bntest.Po ./$(DEPDIR)/buffertest.Po \
	./$(DEPDIR)/bytestringtest.Po ./$(DEPDIR)/casttest.Po \
	./$(DEPDIR)/chachatest.Po ./$(DEPDIR)/cipher_list.Po \
	./$(DEPDIR)/cipherstest.Po ./$(DEPDIR)/clienttest.Po \
	./$(DEPDIR)/cmstest.Po ./$(DEPDIR)/configtest.Po \
	./$(DEPDIR)/constraints.Po ./$(DEPDIR)/cts128test.Po \
	./$(DEPDIR)/destest.Po ./$(DEPDIR)/dhtest.Po \
	./$(DEPDIR)/dsatest.Po ./$(DEPDIR)/dtlstest.Po \
	./$(DEPDIR)/ec_asn1_test.Po ./$(DEPDIR)/ec_point_conversion.Po \
	./$(DEPDIR)/ecdhtest.Po ./$(DEPDIR)/ecdsatest.Po \
	./$(DEPDIR)/ectest.Po ./$(DEPDIR)/enginetest.Po \
	./$(DEPDIR)/evp_pkey_check.Po ./$(DEPDIR)/evp_pkey_cleanup.Po \
	./$(DEPDIR)/evptest.Po ./$(DEPDIR)/explicit_bzero.Po \
	./$(DEPDIR)/exptest-exptest.Po ./$(DEPDIR)/freenull.Po \
	./$(DEPDIR)/gcm128test.Po ./$(DEPDIR)/gost2814789t.Po \
	./$(DEPDIR)/handshake_table.Po ./$(DEPDIR)/hkdf_test.Po \
	./$(DEPDIR)/hmactest.Po ./$(DEPDIR)/ideatest.Po \
	./$(DEPDIR)/igetest.Po ./$(DEPDIR)/key_schedule.Po \
	./$(DEPDIR)/keypairtest-keypairtest.Po ./$(DEPDIR)/md4test.Po \
	./$(DEPDIR)/md5test.Po ./$(DEPDIR)/mont.Po \
	./$(DEPDIR)/objectstest.Po ./$(DEPDIR)/ocsp_test.Po \
	./$(DEPDIR)/optionstest.Po ./$(DEPDIR)/pbkdf2.Po \
	./$(DEPDIR)/pidwraptest.Po ./$(DEPDIR)/pkcs7test.Po \
	./$(DEPDIR)/poly1305test.Po ./$(DEPDIR)/pq_test.Po \
	./$(DEPDIR)/randtest.Po ./$(DEPDIR)/rc2test.Po \
	./$(DEPDIR)/rc4test.Po ./$(DEPDIR)/record_layer_test.Po \
	./$(DEPDIR)/recordtest.Po ./$(DEPDIR)/rfc3779-rfc3779.Po \
	./$(DEPDIR)/rfc5280time.Po ./$(DEPDIR)/rmdtest.Po \
	./$(DEPDIR)/rsa_test.Po ./$(DEPDIR)/servertest.Po \
	./$(DEPDIR)/sha1test.Po ./$(DEPDIR)/sha256test.Po \
	./$(DEPDIR)/sha512test.Po ./$(DEPDIR)/sm3test.Po \
	./$(DEPDIR)/sm4test.Po \
	./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po \
	./$(DEPDIR)/ssl_methods.Po ./$(DEPDIR)/ssl_versions.Po \

	./$(DEPDIR)/ssltest.Po ./$(DEPDIR)/string_table.Po \
	./$(DEPDIR)/timingsafe.Po ./$(DEPDIR)/tls_ext_alpn.Po \
	./$(DEPDIR)/tls_prf.Po ./$(DEPDIR)/tlsexttest.Po \
	./$(DEPDIR)/tlslegacytest.Po ./$(DEPDIR)/tlstest.Po \
	./$(DEPDIR)/utf8test.Po \
	./$(DEPDIR)/valid_handshakes_terminate.Po \
	./$(DEPDIR)/verifytest.Po ./$(DEPDIR)/x25519test.Po \
	./$(DEPDIR)/x509_info.Po ./$(DEPDIR)/x509attribute.Po \
	./$(DEPDIR)/x509name.Po ./$(DEPDIR)/x509req_ext.Po \
	compat/$(DEPDIR)/memmem.Po compat/$(DEPDIR)/pipe2.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \







|
>





|
>
|



















|
|
|
|
|
|
|
|

|

<
|


|
>
|
|
|
|
<







997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043

1044
1045
1046
1047
1048
1049
1050
1051
1052

1053
1054
1055
1056
1057
1058
1059
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 = 
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/aeadtest.Po ./$(DEPDIR)/aes_wrap.Po \
	./$(DEPDIR)/arc4randomforktest.Po \
	./$(DEPDIR)/asn1_string_to_utf8.Po ./$(DEPDIR)/asn1api.Po \
	./$(DEPDIR)/asn1basic.Po ./$(DEPDIR)/asn1complex.Po \
	./$(DEPDIR)/asn1evp.Po ./$(DEPDIR)/asn1object.Po \
	./$(DEPDIR)/asn1string_copy.Po ./$(DEPDIR)/asn1test.Po \
	./$(DEPDIR)/asn1time.Po ./$(DEPDIR)/asn1x509.Po \
	./$(DEPDIR)/base64test.Po ./$(DEPDIR)/bftest.Po \
	./$(DEPDIR)/biotest.Po ./$(DEPDIR)/bn_isqrt.Po \
	./$(DEPDIR)/bn_mod_exp2_mont.Po ./$(DEPDIR)/bn_mod_sqrt.Po \
	./$(DEPDIR)/bn_primes.Po ./$(DEPDIR)/bn_rand_interval.Po \
	./$(DEPDIR)/bn_to_string.Po ./$(DEPDIR)/bnaddsub.Po \
	./$(DEPDIR)/bntest-bntest.Po ./$(DEPDIR)/buffertest.Po \
	./$(DEPDIR)/bytestringtest.Po ./$(DEPDIR)/casttest.Po \
	./$(DEPDIR)/chachatest.Po ./$(DEPDIR)/cipher_list.Po \
	./$(DEPDIR)/cipherstest.Po ./$(DEPDIR)/clienttest.Po \
	./$(DEPDIR)/cmstest.Po ./$(DEPDIR)/configtest.Po \
	./$(DEPDIR)/constraints.Po ./$(DEPDIR)/cts128test.Po \
	./$(DEPDIR)/destest.Po ./$(DEPDIR)/dhtest.Po \
	./$(DEPDIR)/dsatest.Po ./$(DEPDIR)/dtlstest.Po \
	./$(DEPDIR)/ec_asn1_test.Po ./$(DEPDIR)/ec_point_conversion.Po \
	./$(DEPDIR)/ecdhtest.Po ./$(DEPDIR)/ecdsatest.Po \
	./$(DEPDIR)/ectest.Po ./$(DEPDIR)/enginetest.Po \
	./$(DEPDIR)/evp_pkey_check.Po ./$(DEPDIR)/evp_pkey_cleanup.Po \
	./$(DEPDIR)/evptest.Po ./$(DEPDIR)/explicit_bzero.Po \
	./$(DEPDIR)/exptest-exptest.Po ./$(DEPDIR)/freenull.Po \
	./$(DEPDIR)/gcm128test.Po ./$(DEPDIR)/gost2814789t.Po \
	./$(DEPDIR)/handshake_table.Po ./$(DEPDIR)/hkdf_test.Po \
	./$(DEPDIR)/hmactest.Po ./$(DEPDIR)/ideatest.Po \
	./$(DEPDIR)/igetest.Po ./$(DEPDIR)/key_schedule.Po \
	./$(DEPDIR)/keypairtest-keypairtest.Po ./$(DEPDIR)/md_test.Po \
	./$(DEPDIR)/mont.Po ./$(DEPDIR)/objectstest.Po \
	./$(DEPDIR)/ocsp_test.Po ./$(DEPDIR)/optionstest.Po \
	./$(DEPDIR)/pbkdf2.Po ./$(DEPDIR)/pidwraptest.Po \
	./$(DEPDIR)/pkcs7test.Po ./$(DEPDIR)/poly1305test.Po \
	./$(DEPDIR)/pq_test.Po ./$(DEPDIR)/quictest.Po \
	./$(DEPDIR)/randtest.Po ./$(DEPDIR)/rc2_test.Po \
	./$(DEPDIR)/rc4_test.Po ./$(DEPDIR)/record_layer_test.Po \
	./$(DEPDIR)/recordtest.Po ./$(DEPDIR)/rfc3779-rfc3779.Po \
	./$(DEPDIR)/rfc5280time.Po ./$(DEPDIR)/rmd_test.Po \
	./$(DEPDIR)/rsa_test.Po ./$(DEPDIR)/servertest.Po \

	./$(DEPDIR)/sha_test.Po ./$(DEPDIR)/sm3test.Po \
	./$(DEPDIR)/sm4test.Po \
	./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po \
	./$(DEPDIR)/ssl_methods.Po ./$(DEPDIR)/ssl_set_alpn_protos.Po \
	./$(DEPDIR)/ssl_versions.Po ./$(DEPDIR)/ssltest.Po \
	./$(DEPDIR)/string_table.Po ./$(DEPDIR)/timingsafe.Po \
	./$(DEPDIR)/tls_ext_alpn.Po ./$(DEPDIR)/tls_prf.Po \
	./$(DEPDIR)/tlsexttest.Po ./$(DEPDIR)/tlslegacytest.Po \
	./$(DEPDIR)/tlstest.Po ./$(DEPDIR)/utf8test.Po \

	./$(DEPDIR)/valid_handshakes_terminate.Po \
	./$(DEPDIR)/verifytest.Po ./$(DEPDIR)/x25519test.Po \
	./$(DEPDIR)/x509_info.Po ./$(DEPDIR)/x509attribute.Po \
	./$(DEPDIR)/x509name.Po ./$(DEPDIR)/x509req_ext.Po \
	compat/$(DEPDIR)/memmem.Po compat/$(DEPDIR)/pipe2.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
1050
1051
1052
1053
1054
1055
1056
1057
1058

1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101

1102
1103
1104
1105
1106

1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo "  CCLD    " $@;
am__v_CCLD_1 = 
SOURCES = $(aeadtest_SOURCES) $(aes_wrap_SOURCES) \
	$(arc4randomforktest_SOURCES) $(asn1api_SOURCES) \
	$(asn1basic_SOURCES) $(asn1complex_SOURCES) $(asn1evp_SOURCES) \

	$(asn1object_SOURCES) $(asn1string_copy_SOURCES) \
	$(asn1test_SOURCES) $(asn1time_SOURCES) $(asn1x509_SOURCES) \
	$(base64test_SOURCES) $(bftest_SOURCES) $(biotest_SOURCES) \
	$(bn_mod_exp2_mont_SOURCES) $(bn_mod_sqrt_SOURCES) \
	$(bn_rand_interval_SOURCES) $(bn_to_string_SOURCES) \
	$(bnaddsub_SOURCES) $(bntest_SOURCES) $(buffertest_SOURCES) \
	$(bytestringtest_SOURCES) $(casttest_SOURCES) \
	$(chachatest_SOURCES) $(cipher_list_SOURCES) \
	$(cipherstest_SOURCES) $(clienttest_SOURCES) \
	$(cmstest_SOURCES) $(configtest_SOURCES) \
	$(constraints_SOURCES) $(cts128test_SOURCES) \
	$(destest_SOURCES) $(dhtest_SOURCES) $(dsatest_SOURCES) \
	$(dtlstest_SOURCES) $(ec_asn1_test_SOURCES) \
	$(ec_point_conversion_SOURCES) $(ecdhtest_SOURCES) \
	$(ecdsatest_SOURCES) $(ectest_SOURCES) $(enginetest_SOURCES) \
	$(evp_pkey_check_SOURCES) $(evp_pkey_cleanup_SOURCES) \
	$(evptest_SOURCES) $(explicit_bzero_SOURCES) \
	$(exptest_SOURCES) $(freenull_SOURCES) $(gcm128test_SOURCES) \
	$(gost2814789t_SOURCES) $(handshake_table_SOURCES) \
	$(hkdftest_SOURCES) $(hmactest_SOURCES) $(ideatest_SOURCES) \
	$(igetest_SOURCES) $(key_schedule_SOURCES) \
	$(keypairtest_SOURCES) $(md4test_SOURCES) $(md5test_SOURCES) \
	$(mont_SOURCES) $(objectstest_SOURCES) $(ocsp_test_SOURCES) \
	$(optionstest_SOURCES) $(pbkdf2_SOURCES) \
	$(pidwraptest_SOURCES) $(pkcs7test_SOURCES) \
	$(poly1305test_SOURCES) $(pq_test_SOURCES) $(randtest_SOURCES) \
	$(rc2test_SOURCES) $(rc4test_SOURCES) \
	$(record_layer_test_SOURCES) $(recordtest_SOURCES) \
	$(rfc3779_SOURCES) $(rfc5280time_SOURCES) $(rmdtest_SOURCES) \
	$(rsa_test_SOURCES) $(servertest_SOURCES) $(sha1test_SOURCES) \
	$(sha256test_SOURCES) $(sha512test_SOURCES) $(sm3test_SOURCES) \
	$(sm4test_SOURCES) $(ssl_get_shared_ciphers_SOURCES) \
	$(ssl_methods_SOURCES) $(ssl_versions_SOURCES) \
	$(ssltest_SOURCES) $(string_table_SOURCES) \
	$(timingsafe_SOURCES) $(tls_ext_alpn_SOURCES) \
	$(tls_prf_SOURCES) $(tlsexttest_SOURCES) \
	$(tlslegacytest_SOURCES) $(tlstest_SOURCES) \
	$(utf8test_SOURCES) $(valid_handshakes_terminate_SOURCES) \
	$(verifytest_SOURCES) $(x25519test_SOURCES) \
	$(x509_info_SOURCES) $(x509attribute_SOURCES) \
	$(x509name_SOURCES) $(x509req_ext_SOURCES)
DIST_SOURCES = $(aeadtest_SOURCES) $(aes_wrap_SOURCES) \
	$(am__arc4randomforktest_SOURCES_DIST) $(asn1api_SOURCES) \

	$(asn1basic_SOURCES) $(asn1complex_SOURCES) $(asn1evp_SOURCES) \
	$(asn1object_SOURCES) $(asn1string_copy_SOURCES) \
	$(asn1test_SOURCES) $(asn1time_SOURCES) $(asn1x509_SOURCES) \
	$(base64test_SOURCES) $(bftest_SOURCES) \
	$(am__biotest_SOURCES_DIST) $(bn_mod_exp2_mont_SOURCES) \

	$(bn_mod_sqrt_SOURCES) $(bn_rand_interval_SOURCES) \
	$(bn_to_string_SOURCES) $(bnaddsub_SOURCES) $(bntest_SOURCES) \
	$(buffertest_SOURCES) $(bytestringtest_SOURCES) \
	$(casttest_SOURCES) $(chachatest_SOURCES) \
	$(cipher_list_SOURCES) $(cipherstest_SOURCES) \
	$(clienttest_SOURCES) $(cmstest_SOURCES) $(configtest_SOURCES) \
	$(constraints_SOURCES) $(cts128test_SOURCES) \
	$(destest_SOURCES) $(dhtest_SOURCES) $(dsatest_SOURCES) \
	$(am__dtlstest_SOURCES_DIST) $(ec_asn1_test_SOURCES) \
	$(ec_point_conversion_SOURCES) $(ecdhtest_SOURCES) \
	$(ecdsatest_SOURCES) $(ectest_SOURCES) $(enginetest_SOURCES) \
	$(evp_pkey_check_SOURCES) $(evp_pkey_cleanup_SOURCES) \
	$(evptest_SOURCES) $(am__explicit_bzero_SOURCES_DIST) \
	$(exptest_SOURCES) $(freenull_SOURCES) $(gcm128test_SOURCES) \
	$(gost2814789t_SOURCES) $(handshake_table_SOURCES) \
	$(hkdftest_SOURCES) $(hmactest_SOURCES) $(ideatest_SOURCES) \
	$(igetest_SOURCES) $(key_schedule_SOURCES) \
	$(keypairtest_SOURCES) $(md4test_SOURCES) $(md5test_SOURCES) \
	$(mont_SOURCES) $(objectstest_SOURCES) \
	$(am__ocsp_test_SOURCES_DIST) $(optionstest_SOURCES) \
	$(pbkdf2_SOURCES) $(am__pidwraptest_SOURCES_DIST) \
	$(pkcs7test_SOURCES) $(poly1305test_SOURCES) \
	$(pq_test_SOURCES) $(randtest_SOURCES) $(rc2test_SOURCES) \
	$(rc4test_SOURCES) $(record_layer_test_SOURCES) \
	$(recordtest_SOURCES) $(rfc3779_SOURCES) \
	$(rfc5280time_SOURCES) $(rmdtest_SOURCES) $(rsa_test_SOURCES) \
	$(servertest_SOURCES) $(sha1test_SOURCES) \
	$(sha256test_SOURCES) $(sha512test_SOURCES) $(sm3test_SOURCES) \
	$(sm4test_SOURCES) $(ssl_get_shared_ciphers_SOURCES) \
	$(ssl_methods_SOURCES) $(ssl_versions_SOURCES) \
	$(ssltest_SOURCES) $(string_table_SOURCES) \
	$(timingsafe_SOURCES) $(tls_ext_alpn_SOURCES) \
	$(tls_prf_SOURCES) $(tlsexttest_SOURCES) \
	$(tlslegacytest_SOURCES) $(am__tlstest_SOURCES_DIST) \
	$(utf8test_SOURCES) $(valid_handshakes_terminate_SOURCES) \
	$(verifytest_SOURCES) $(x25519test_SOURCES) \
	$(x509_info_SOURCES) $(x509attribute_SOURCES) \







|
|
>
|
|
|

|
|
|
|
|
|











|
|


|
|

|
|
|
|
|









|
>




|
>
|
















|
|
|
|
|
|
|
<
|
|
|
|
|







1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154

1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo "  CCLD    " $@;
am__v_CCLD_1 = 
SOURCES = $(aeadtest_SOURCES) $(aes_wrap_SOURCES) \
	$(arc4randomforktest_SOURCES) $(asn1_string_to_utf8_SOURCES) \
	$(asn1api_SOURCES) $(asn1basic_SOURCES) $(asn1complex_SOURCES) \
	$(asn1evp_SOURCES) $(asn1object_SOURCES) \
	$(asn1string_copy_SOURCES) $(asn1test_SOURCES) \
	$(asn1time_SOURCES) $(asn1x509_SOURCES) $(base64test_SOURCES) \
	$(bftest_SOURCES) $(biotest_SOURCES) $(bn_isqrt_SOURCES) \
	$(bn_mod_exp2_mont_SOURCES) $(bn_mod_sqrt_SOURCES) \
	$(bn_primes_SOURCES) $(bn_rand_interval_SOURCES) \
	$(bn_to_string_SOURCES) $(bnaddsub_SOURCES) $(bntest_SOURCES) \
	$(buffertest_SOURCES) $(bytestringtest_SOURCES) \
	$(casttest_SOURCES) $(chachatest_SOURCES) \
	$(cipher_list_SOURCES) $(cipherstest_SOURCES) \
	$(clienttest_SOURCES) $(cmstest_SOURCES) $(configtest_SOURCES) \
	$(constraints_SOURCES) $(cts128test_SOURCES) \
	$(destest_SOURCES) $(dhtest_SOURCES) $(dsatest_SOURCES) \
	$(dtlstest_SOURCES) $(ec_asn1_test_SOURCES) \
	$(ec_point_conversion_SOURCES) $(ecdhtest_SOURCES) \
	$(ecdsatest_SOURCES) $(ectest_SOURCES) $(enginetest_SOURCES) \
	$(evp_pkey_check_SOURCES) $(evp_pkey_cleanup_SOURCES) \
	$(evptest_SOURCES) $(explicit_bzero_SOURCES) \
	$(exptest_SOURCES) $(freenull_SOURCES) $(gcm128test_SOURCES) \
	$(gost2814789t_SOURCES) $(handshake_table_SOURCES) \
	$(hkdftest_SOURCES) $(hmactest_SOURCES) $(ideatest_SOURCES) \
	$(igetest_SOURCES) $(key_schedule_SOURCES) \
	$(keypairtest_SOURCES) $(md_test_SOURCES) $(mont_SOURCES) \
	$(objectstest_SOURCES) $(ocsp_test_SOURCES) \
	$(optionstest_SOURCES) $(pbkdf2_SOURCES) \
	$(pidwraptest_SOURCES) $(pkcs7test_SOURCES) \
	$(poly1305test_SOURCES) $(pq_test_SOURCES) $(quictest_SOURCES) \
	$(randtest_SOURCES) $(rc2_test_SOURCES) $(rc4_test_SOURCES) \
	$(record_layer_test_SOURCES) $(recordtest_SOURCES) \
	$(rfc3779_SOURCES) $(rfc5280time_SOURCES) $(rmd_test_SOURCES) \
	$(rsa_test_SOURCES) $(servertest_SOURCES) $(sha_test_SOURCES) \
	$(sm3test_SOURCES) $(sm4test_SOURCES) \
	$(ssl_get_shared_ciphers_SOURCES) $(ssl_methods_SOURCES) \
	$(ssl_set_alpn_protos_SOURCES) $(ssl_versions_SOURCES) \
	$(ssltest_SOURCES) $(string_table_SOURCES) \
	$(timingsafe_SOURCES) $(tls_ext_alpn_SOURCES) \
	$(tls_prf_SOURCES) $(tlsexttest_SOURCES) \
	$(tlslegacytest_SOURCES) $(tlstest_SOURCES) \
	$(utf8test_SOURCES) $(valid_handshakes_terminate_SOURCES) \
	$(verifytest_SOURCES) $(x25519test_SOURCES) \
	$(x509_info_SOURCES) $(x509attribute_SOURCES) \
	$(x509name_SOURCES) $(x509req_ext_SOURCES)
DIST_SOURCES = $(aeadtest_SOURCES) $(aes_wrap_SOURCES) \
	$(am__arc4randomforktest_SOURCES_DIST) \
	$(asn1_string_to_utf8_SOURCES) $(asn1api_SOURCES) \
	$(asn1basic_SOURCES) $(asn1complex_SOURCES) $(asn1evp_SOURCES) \
	$(asn1object_SOURCES) $(asn1string_copy_SOURCES) \
	$(asn1test_SOURCES) $(asn1time_SOURCES) $(asn1x509_SOURCES) \
	$(base64test_SOURCES) $(bftest_SOURCES) \
	$(am__biotest_SOURCES_DIST) $(bn_isqrt_SOURCES) \
	$(bn_mod_exp2_mont_SOURCES) $(bn_mod_sqrt_SOURCES) \
	$(bn_primes_SOURCES) $(bn_rand_interval_SOURCES) \
	$(bn_to_string_SOURCES) $(bnaddsub_SOURCES) $(bntest_SOURCES) \
	$(buffertest_SOURCES) $(bytestringtest_SOURCES) \
	$(casttest_SOURCES) $(chachatest_SOURCES) \
	$(cipher_list_SOURCES) $(cipherstest_SOURCES) \
	$(clienttest_SOURCES) $(cmstest_SOURCES) $(configtest_SOURCES) \
	$(constraints_SOURCES) $(cts128test_SOURCES) \
	$(destest_SOURCES) $(dhtest_SOURCES) $(dsatest_SOURCES) \
	$(am__dtlstest_SOURCES_DIST) $(ec_asn1_test_SOURCES) \
	$(ec_point_conversion_SOURCES) $(ecdhtest_SOURCES) \
	$(ecdsatest_SOURCES) $(ectest_SOURCES) $(enginetest_SOURCES) \
	$(evp_pkey_check_SOURCES) $(evp_pkey_cleanup_SOURCES) \
	$(evptest_SOURCES) $(am__explicit_bzero_SOURCES_DIST) \
	$(exptest_SOURCES) $(freenull_SOURCES) $(gcm128test_SOURCES) \
	$(gost2814789t_SOURCES) $(handshake_table_SOURCES) \
	$(hkdftest_SOURCES) $(hmactest_SOURCES) $(ideatest_SOURCES) \
	$(igetest_SOURCES) $(key_schedule_SOURCES) \
	$(keypairtest_SOURCES) $(md_test_SOURCES) $(mont_SOURCES) \
	$(objectstest_SOURCES) $(am__ocsp_test_SOURCES_DIST) \
	$(optionstest_SOURCES) $(pbkdf2_SOURCES) \
	$(am__pidwraptest_SOURCES_DIST) $(pkcs7test_SOURCES) \
	$(poly1305test_SOURCES) $(pq_test_SOURCES) $(quictest_SOURCES) \
	$(randtest_SOURCES) $(rc2_test_SOURCES) $(rc4_test_SOURCES) \
	$(record_layer_test_SOURCES) $(recordtest_SOURCES) \

	$(rfc3779_SOURCES) $(rfc5280time_SOURCES) $(rmd_test_SOURCES) \
	$(rsa_test_SOURCES) $(servertest_SOURCES) $(sha_test_SOURCES) \
	$(sm3test_SOURCES) $(sm4test_SOURCES) \
	$(ssl_get_shared_ciphers_SOURCES) $(ssl_methods_SOURCES) \
	$(ssl_set_alpn_protos_SOURCES) $(ssl_versions_SOURCES) \
	$(ssltest_SOURCES) $(string_table_SOURCES) \
	$(timingsafe_SOURCES) $(tls_ext_alpn_SOURCES) \
	$(tls_prf_SOURCES) $(tlsexttest_SOURCES) \
	$(tlslegacytest_SOURCES) $(am__tlstest_SOURCES_DIST) \
	$(utf8test_SOURCES) $(valid_handshakes_terminate_SOURCES) \
	$(verifytest_SOURCES) $(x25519test_SOURCES) \
	$(x509_info_SOURCES) $(x509attribute_SOURCES) \
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__tty_colors_dummy = \
  mgn= red= grn= lgn= blu= brg= std=; \
  am__color_tests=no
am__tty_colors = { \
  $(am__tty_colors_dummy); \
  if test "X$(AM_COLOR_TESTS)" = Xno; then \
    am__color_tests=no; \







<
<







1184
1185
1186
1187
1188
1189
1190


1191
1192
1193
1194
1195
1196
1197
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__tty_colors_dummy = \
  mgn= red= grn= lgn= blu= brg= std=; \
  am__color_tests=no
am__tty_colors = { \
  $(am__tty_colors_dummy); \
  if test "X$(AM_COLOR_TESTS)" = Xno; then \
    am__color_tests=no; \
1388
1389
1390
1391
1392
1393
1394


1395
1396
1397
1398
1399
1400
1401
1402
1403
1404

1405
1406
1407
1408
1409
1410
1411
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







>
>










>







1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518


1519
1520
1521

1522












1523
1524
1525
1526
1527
1528
1529

1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542

1543
1544

1545
1546
1547
1548
1549
1550
1551
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = 
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat \
	-DLIBRESSL_INTERNAL -D__BEGIN_HIDDEN_DECLS= \
	-D__END_HIDDEN_DECLS= -DLIBRESSL_CRYPTO_INTERNAL -I \
	$(top_srcdir)/crypto/asn1 -I $(top_srcdir)/crypto/bio -I \
	$(top_srcdir)/crypto/evp -I $(top_srcdir)/crypto/modes -I \
	$(top_srcdir)/crypto/x509 -I $(top_srcdir)/ssl -I \
	$(top_srcdir)/apps/openssl -I \
	$(top_srcdir)/apps/openssl/compat \
	-D_PATH_SSL_CA_FILE=\"$(top_srcdir)/cert.pem\"
LDADD = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a $(PLATFORM_LDADD) \
	$(PROG_LDADD) $(am__append_1)
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
EXTRA_DIST = CMakeLists.txt aeadtest.sh aeadtests.txt \


	arc4randomforktest.sh dtlstest.sh evptest.sh evptests.txt \
	keypairtest.sh ocsptest.sh ocsptest.bat pidwraptest.sh \
	pq_test.sh pq_test.bat pq_expected.txt rfc5280time_small.test \

	servertest.sh servertest.bat ssltest.sh ssltest.bat testssl \












	testssl.bat ca.pem server.pem testdsa.sh testdsa.bat \
	openssl.cnf testenc.sh testenc.bat testrsa.sh testrsa.bat \
	tlstest.sh tlstest.bat
DISTCLEANFILES = pidwraptest.txt
aeadtest_SOURCES = aeadtest.c
aes_wrap_SOURCES = aes_wrap.c
@HOST_WIN_FALSE@arc4randomforktest_SOURCES = arc4randomforktest.c

asn1api_SOURCES = asn1api.c
asn1basic_SOURCES = asn1basic.c
asn1complex_SOURCES = asn1complex.c
asn1evp_SOURCES = asn1evp.c
asn1object_SOURCES = asn1object.c
asn1string_copy_SOURCES = asn1string_copy.c
asn1test_SOURCES = asn1test.c
asn1time_SOURCES = asn1time.c
asn1x509_SOURCES = asn1x509.c
base64test_SOURCES = base64test.c
bftest_SOURCES = bftest.c
@ENABLE_EXTRATESTS_TRUE@biotest_SOURCES = biotest.c
bnaddsub_SOURCES = bnaddsub.c

bn_mod_exp2_mont_SOURCES = bn_mod_exp2_mont.c
bn_mod_sqrt_SOURCES = bn_mod_sqrt.c

bn_rand_interval_SOURCES = bn_rand_interval.c
bntest_CPPFLAGS = $(AM_CPPFLAGS) -ULIBRESSL_INTERNAL
bntest_SOURCES = bntest.c
bn_to_string_SOURCES = bn_to_string.c
buffertest_SOURCES = buffertest.c
bytestringtest_SOURCES = bytestringtest.c
casttest_SOURCES = casttest.c







|
|
|








>
>
|
|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|






>













>


>







1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = 
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat \
	-DLIBRESSL_INTERNAL -D__BEGIN_HIDDEN_DECLS= \
	-D__END_HIDDEN_DECLS= -DLIBRESSL_CRYPTO_INTERNAL -I \
	$(top_srcdir)/crypto/asn1 -I $(top_srcdir)/crypto/bio -I \
	$(top_srcdir)/crypto/bn -I $(top_srcdir)/crypto/evp -I \
	$(top_srcdir)/crypto/modes -I $(top_srcdir)/crypto/x509 -I \
	$(top_srcdir)/ssl -I $(top_srcdir)/apps/openssl -I \
	$(top_srcdir)/apps/openssl/compat \
	-D_PATH_SSL_CA_FILE=\"$(top_srcdir)/cert.pem\"
LDADD = $(abs_top_builddir)/tls/.libs/libtls.a \
	$(abs_top_builddir)/ssl/.libs/libssl.a \
	$(abs_top_builddir)/crypto/.libs/libcrypto.a $(PLATFORM_LDADD) \
	$(PROG_LDADD) $(am__append_1)
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
EXTRA_DIST = CMakeLists.txt aeadtest.sh aeadtests.txt \
	aes_128_gcm_tests.txt aes_192_gcm_tests.txt \
	aes_256_gcm_tests.txt chacha20_poly1305_tests.txt \
	xchacha20_poly1305_tests.txt arc4randomforktest.sh dtlstest.sh \
	evptest.sh evptests.txt keypairtest.sh ocsptest.sh \
	ocsptest.bat pidwraptest.sh pq_test.sh pq_test.bat \
	pq_expected.txt quictest.sh quictest.bat \
	rfc5280time_small.test servertest.sh servertest.bat ssltest.sh \
	ssltest.bat testssl testssl.bat ca-int-ecdsa.crl \
	ca-int-ecdsa.pem ca-int-rsa.crl ca-int-rsa.pem \
	ca-root-ecdsa.pem ca-root-rsa.pem ca.pem client.pem \
	client1-ecdsa-chain.pem client1-ecdsa.pem \
	client1-rsa-chain.pem client1-rsa.pem client2-ecdsa-chain.pem \
	client2-ecdsa.pem client2-rsa-chain.pem client2-rsa.pem \
	client3-ecdsa-chain.pem client3-ecdsa.pem \
	client3-rsa-chain.pem client3-rsa.pem server.pem \
	server1-ecdsa-chain.pem server1-ecdsa.pem \
	server1-rsa-chain.pem server1-rsa.pem server2-ecdsa-chain.pem \
	server2-ecdsa.pem server2-rsa-chain.pem server2-rsa.pem \
	server3-ecdsa-chain.pem server3-ecdsa.pem \
	server3-rsa-chain.pem server3-rsa.pem testdsa.sh testdsa.bat \
	openssl.cnf testenc.sh testenc.bat testrsa.sh testrsa.bat \
	tlstest.sh tlstest.bat
DISTCLEANFILES = pidwraptest.txt
aeadtest_SOURCES = aeadtest.c
aes_wrap_SOURCES = aes_wrap.c
@HOST_WIN_FALSE@arc4randomforktest_SOURCES = arc4randomforktest.c
asn1_string_to_utf8_SOURCES = asn1_string_to_utf8.c
asn1api_SOURCES = asn1api.c
asn1basic_SOURCES = asn1basic.c
asn1complex_SOURCES = asn1complex.c
asn1evp_SOURCES = asn1evp.c
asn1object_SOURCES = asn1object.c
asn1string_copy_SOURCES = asn1string_copy.c
asn1test_SOURCES = asn1test.c
asn1time_SOURCES = asn1time.c
asn1x509_SOURCES = asn1x509.c
base64test_SOURCES = base64test.c
bftest_SOURCES = bftest.c
@ENABLE_EXTRATESTS_TRUE@biotest_SOURCES = biotest.c
bnaddsub_SOURCES = bnaddsub.c
bn_isqrt_SOURCES = bn_isqrt.c
bn_mod_exp2_mont_SOURCES = bn_mod_exp2_mont.c
bn_mod_sqrt_SOURCES = bn_mod_sqrt.c
bn_primes_SOURCES = bn_primes.c
bn_rand_interval_SOURCES = bn_rand_interval.c
bntest_CPPFLAGS = $(AM_CPPFLAGS) -ULIBRESSL_INTERNAL
bntest_SOURCES = bntest.c
bn_to_string_SOURCES = bn_to_string.c
buffertest_SOURCES = buffertest.c
bytestringtest_SOURCES = bytestringtest.c
casttest_SOURCES = casttest.c
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600

1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619

1620
1621
1622
1623
1624
1625
1626
hkdftest_SOURCES = hkdf_test.c
hmactest_SOURCES = hmactest.c
ideatest_SOURCES = ideatest.c
igetest_SOURCES = igetest.c
key_schedule_SOURCES = key_schedule.c
keypairtest_CPPFLAGS = -I $(top_srcdir)/tls $(AM_CPPFLAGS)
keypairtest_SOURCES = keypairtest.c
md4test_SOURCES = md4test.c
md5test_SOURCES = md5test.c
mont_SOURCES = mont.c
objectstest_SOURCES = objectstest.c
@ENABLE_EXTRATESTS_TRUE@ocsp_test_SOURCES = ocsp_test.c
optionstest_SOURCES = optionstest.c
pbkdf2_SOURCES = pbkdf2.c
@ENABLE_EXTRATESTS_TRUE@pidwraptest_SOURCES = pidwraptest.c
pkcs7test_SOURCES = pkcs7test.c
poly1305test_SOURCES = poly1305test.c
pq_test_SOURCES = pq_test.c

randtest_SOURCES = randtest.c
rc2test_SOURCES = rc2test.c
rc4test_SOURCES = rc4test.c
recordtest_SOURCES = recordtest.c
record_layer_test_SOURCES = record_layer_test.c
rfc3779_CPPFLAGS = $(AM_CPPFLAGS) -D__unused=
rfc3779_SOURCES = rfc3779.c
rfc5280time_SOURCES = rfc5280time.c
rmdtest_SOURCES = rmdtest.c
rsa_test_SOURCES = rsa_test.c
servertest_SOURCES = servertest.c
sha1test_SOURCES = sha1test.c
sha256test_SOURCES = sha256test.c
sha512test_SOURCES = sha512test.c
sm3test_SOURCES = sm3test.c
sm4test_SOURCES = sm4test.c
ssl_get_shared_ciphers_CPPFLAGS = $(AM_CPPFLAGS) -DCERTSDIR=\"$(srcdir)\"
ssl_get_shared_ciphers_SOURCES = ssl_get_shared_ciphers.c
ssl_methods_SOURCES = ssl_methods.c

ssl_versions_SOURCES = ssl_versions.c
ssltest_SOURCES = ssltest.c
string_table_SOURCES = string_table.c
timingsafe_SOURCES = timingsafe.c
tlsexttest_SOURCES = tlsexttest.c
tlslegacytest_SOURCES = tlslegacytest.c
tlstest_SOURCES = tlstest.c $(am__append_17)







|
<









>

|
|





|


|
<
<





>







1625
1626
1627
1628
1629
1630
1631
1632

1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654


1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
hkdftest_SOURCES = hkdf_test.c
hmactest_SOURCES = hmactest.c
ideatest_SOURCES = ideatest.c
igetest_SOURCES = igetest.c
key_schedule_SOURCES = key_schedule.c
keypairtest_CPPFLAGS = -I $(top_srcdir)/tls $(AM_CPPFLAGS)
keypairtest_SOURCES = keypairtest.c
md_test_SOURCES = md_test.c

mont_SOURCES = mont.c
objectstest_SOURCES = objectstest.c
@ENABLE_EXTRATESTS_TRUE@ocsp_test_SOURCES = ocsp_test.c
optionstest_SOURCES = optionstest.c
pbkdf2_SOURCES = pbkdf2.c
@ENABLE_EXTRATESTS_TRUE@pidwraptest_SOURCES = pidwraptest.c
pkcs7test_SOURCES = pkcs7test.c
poly1305test_SOURCES = poly1305test.c
pq_test_SOURCES = pq_test.c
quictest_SOURCES = quictest.c
randtest_SOURCES = randtest.c
rc2_test_SOURCES = rc2_test.c
rc4_test_SOURCES = rc4_test.c
recordtest_SOURCES = recordtest.c
record_layer_test_SOURCES = record_layer_test.c
rfc3779_CPPFLAGS = $(AM_CPPFLAGS) -D__unused=
rfc3779_SOURCES = rfc3779.c
rfc5280time_SOURCES = rfc5280time.c
rmd_test_SOURCES = rmd_test.c
rsa_test_SOURCES = rsa_test.c
servertest_SOURCES = servertest.c
sha_test_SOURCES = sha_test.c


sm3test_SOURCES = sm3test.c
sm4test_SOURCES = sm4test.c
ssl_get_shared_ciphers_CPPFLAGS = $(AM_CPPFLAGS) -DCERTSDIR=\"$(srcdir)\"
ssl_get_shared_ciphers_SOURCES = ssl_get_shared_ciphers.c
ssl_methods_SOURCES = ssl_methods.c
ssl_set_alpn_protos_SOURCES = ssl_set_alpn_protos.c
ssl_versions_SOURCES = ssl_versions.c
ssltest_SOURCES = ssltest.c
string_table_SOURCES = string_table.c
timingsafe_SOURCES = timingsafe.c
tlsexttest_SOURCES = tlsexttest.c
tlslegacytest_SOURCES = tlslegacytest.c
tlstest_SOURCES = tlstest.c $(am__append_17)
1685
1686
1687
1688
1689
1690
1691




1692
1693
1694
1695
1696
1697
1698
aes_wrap$(EXEEXT): $(aes_wrap_OBJECTS) $(aes_wrap_DEPENDENCIES) $(EXTRA_aes_wrap_DEPENDENCIES) 
	@rm -f aes_wrap$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(aes_wrap_OBJECTS) $(aes_wrap_LDADD) $(LIBS)

arc4randomforktest$(EXEEXT): $(arc4randomforktest_OBJECTS) $(arc4randomforktest_DEPENDENCIES) $(EXTRA_arc4randomforktest_DEPENDENCIES) 
	@rm -f arc4randomforktest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(arc4randomforktest_OBJECTS) $(arc4randomforktest_LDADD) $(LIBS)





asn1api$(EXEEXT): $(asn1api_OBJECTS) $(asn1api_DEPENDENCIES) $(EXTRA_asn1api_DEPENDENCIES) 
	@rm -f asn1api$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(asn1api_OBJECTS) $(asn1api_LDADD) $(LIBS)

asn1basic$(EXEEXT): $(asn1basic_OBJECTS) $(asn1basic_DEPENDENCIES) $(EXTRA_asn1basic_DEPENDENCIES) 
	@rm -f asn1basic$(EXEEXT)







>
>
>
>







1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
aes_wrap$(EXEEXT): $(aes_wrap_OBJECTS) $(aes_wrap_DEPENDENCIES) $(EXTRA_aes_wrap_DEPENDENCIES) 
	@rm -f aes_wrap$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(aes_wrap_OBJECTS) $(aes_wrap_LDADD) $(LIBS)

arc4randomforktest$(EXEEXT): $(arc4randomforktest_OBJECTS) $(arc4randomforktest_DEPENDENCIES) $(EXTRA_arc4randomforktest_DEPENDENCIES) 
	@rm -f arc4randomforktest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(arc4randomforktest_OBJECTS) $(arc4randomforktest_LDADD) $(LIBS)

asn1_string_to_utf8$(EXEEXT): $(asn1_string_to_utf8_OBJECTS) $(asn1_string_to_utf8_DEPENDENCIES) $(EXTRA_asn1_string_to_utf8_DEPENDENCIES) 
	@rm -f asn1_string_to_utf8$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(asn1_string_to_utf8_OBJECTS) $(asn1_string_to_utf8_LDADD) $(LIBS)

asn1api$(EXEEXT): $(asn1api_OBJECTS) $(asn1api_DEPENDENCIES) $(EXTRA_asn1api_DEPENDENCIES) 
	@rm -f asn1api$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(asn1api_OBJECTS) $(asn1api_LDADD) $(LIBS)

asn1basic$(EXEEXT): $(asn1basic_OBJECTS) $(asn1basic_DEPENDENCIES) $(EXTRA_asn1basic_DEPENDENCIES) 
	@rm -f asn1basic$(EXEEXT)
1733
1734
1735
1736
1737
1738
1739




1740
1741
1742
1743
1744
1745
1746
1747




1748
1749
1750
1751
1752
1753
1754
bftest$(EXEEXT): $(bftest_OBJECTS) $(bftest_DEPENDENCIES) $(EXTRA_bftest_DEPENDENCIES) 
	@rm -f bftest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bftest_OBJECTS) $(bftest_LDADD) $(LIBS)

biotest$(EXEEXT): $(biotest_OBJECTS) $(biotest_DEPENDENCIES) $(EXTRA_biotest_DEPENDENCIES) 
	@rm -f biotest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(biotest_OBJECTS) $(biotest_LDADD) $(LIBS)





bn_mod_exp2_mont$(EXEEXT): $(bn_mod_exp2_mont_OBJECTS) $(bn_mod_exp2_mont_DEPENDENCIES) $(EXTRA_bn_mod_exp2_mont_DEPENDENCIES) 
	@rm -f bn_mod_exp2_mont$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_mod_exp2_mont_OBJECTS) $(bn_mod_exp2_mont_LDADD) $(LIBS)

bn_mod_sqrt$(EXEEXT): $(bn_mod_sqrt_OBJECTS) $(bn_mod_sqrt_DEPENDENCIES) $(EXTRA_bn_mod_sqrt_DEPENDENCIES) 
	@rm -f bn_mod_sqrt$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_mod_sqrt_OBJECTS) $(bn_mod_sqrt_LDADD) $(LIBS)





bn_rand_interval$(EXEEXT): $(bn_rand_interval_OBJECTS) $(bn_rand_interval_DEPENDENCIES) $(EXTRA_bn_rand_interval_DEPENDENCIES) 
	@rm -f bn_rand_interval$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_rand_interval_OBJECTS) $(bn_rand_interval_LDADD) $(LIBS)

bn_to_string$(EXEEXT): $(bn_to_string_OBJECTS) $(bn_to_string_DEPENDENCIES) $(EXTRA_bn_to_string_DEPENDENCIES) 
	@rm -f bn_to_string$(EXEEXT)







>
>
>
>








>
>
>
>







1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
bftest$(EXEEXT): $(bftest_OBJECTS) $(bftest_DEPENDENCIES) $(EXTRA_bftest_DEPENDENCIES) 
	@rm -f bftest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bftest_OBJECTS) $(bftest_LDADD) $(LIBS)

biotest$(EXEEXT): $(biotest_OBJECTS) $(biotest_DEPENDENCIES) $(EXTRA_biotest_DEPENDENCIES) 
	@rm -f biotest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(biotest_OBJECTS) $(biotest_LDADD) $(LIBS)

bn_isqrt$(EXEEXT): $(bn_isqrt_OBJECTS) $(bn_isqrt_DEPENDENCIES) $(EXTRA_bn_isqrt_DEPENDENCIES) 
	@rm -f bn_isqrt$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_isqrt_OBJECTS) $(bn_isqrt_LDADD) $(LIBS)

bn_mod_exp2_mont$(EXEEXT): $(bn_mod_exp2_mont_OBJECTS) $(bn_mod_exp2_mont_DEPENDENCIES) $(EXTRA_bn_mod_exp2_mont_DEPENDENCIES) 
	@rm -f bn_mod_exp2_mont$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_mod_exp2_mont_OBJECTS) $(bn_mod_exp2_mont_LDADD) $(LIBS)

bn_mod_sqrt$(EXEEXT): $(bn_mod_sqrt_OBJECTS) $(bn_mod_sqrt_DEPENDENCIES) $(EXTRA_bn_mod_sqrt_DEPENDENCIES) 
	@rm -f bn_mod_sqrt$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_mod_sqrt_OBJECTS) $(bn_mod_sqrt_LDADD) $(LIBS)

bn_primes$(EXEEXT): $(bn_primes_OBJECTS) $(bn_primes_DEPENDENCIES) $(EXTRA_bn_primes_DEPENDENCIES) 
	@rm -f bn_primes$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_primes_OBJECTS) $(bn_primes_LDADD) $(LIBS)

bn_rand_interval$(EXEEXT): $(bn_rand_interval_OBJECTS) $(bn_rand_interval_DEPENDENCIES) $(EXTRA_bn_rand_interval_DEPENDENCIES) 
	@rm -f bn_rand_interval$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(bn_rand_interval_OBJECTS) $(bn_rand_interval_LDADD) $(LIBS)

bn_to_string$(EXEEXT): $(bn_to_string_OBJECTS) $(bn_to_string_DEPENDENCIES) $(EXTRA_bn_to_string_DEPENDENCIES) 
	@rm -f bn_to_string$(EXEEXT)
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
	@rm -f key_schedule$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(key_schedule_OBJECTS) $(key_schedule_LDADD) $(LIBS)

keypairtest$(EXEEXT): $(keypairtest_OBJECTS) $(keypairtest_DEPENDENCIES) $(EXTRA_keypairtest_DEPENDENCIES) 
	@rm -f keypairtest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(keypairtest_OBJECTS) $(keypairtest_LDADD) $(LIBS)

md4test$(EXEEXT): $(md4test_OBJECTS) $(md4test_DEPENDENCIES) $(EXTRA_md4test_DEPENDENCIES) 
	@rm -f md4test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(md4test_OBJECTS) $(md4test_LDADD) $(LIBS)

md5test$(EXEEXT): $(md5test_OBJECTS) $(md5test_DEPENDENCIES) $(EXTRA_md5test_DEPENDENCIES) 
	@rm -f md5test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(md5test_OBJECTS) $(md5test_LDADD) $(LIBS)

mont$(EXEEXT): $(mont_OBJECTS) $(mont_DEPENDENCIES) $(EXTRA_mont_DEPENDENCIES) 
	@rm -f mont$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(mont_OBJECTS) $(mont_LDADD) $(LIBS)

objectstest$(EXEEXT): $(objectstest_OBJECTS) $(objectstest_DEPENDENCIES) $(EXTRA_objectstest_DEPENDENCIES) 
	@rm -f objectstest$(EXEEXT)







<
<
<
|
<
|
|







1963
1964
1965
1966
1967
1968
1969



1970

1971
1972
1973
1974
1975
1976
1977
1978
1979
	@rm -f key_schedule$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(key_schedule_OBJECTS) $(key_schedule_LDADD) $(LIBS)

keypairtest$(EXEEXT): $(keypairtest_OBJECTS) $(keypairtest_DEPENDENCIES) $(EXTRA_keypairtest_DEPENDENCIES) 
	@rm -f keypairtest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(keypairtest_OBJECTS) $(keypairtest_LDADD) $(LIBS)




md_test$(EXEEXT): $(md_test_OBJECTS) $(md_test_DEPENDENCIES) $(EXTRA_md_test_DEPENDENCIES) 

	@rm -f md_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(md_test_OBJECTS) $(md_test_LDADD) $(LIBS)

mont$(EXEEXT): $(mont_OBJECTS) $(mont_DEPENDENCIES) $(EXTRA_mont_DEPENDENCIES) 
	@rm -f mont$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(mont_OBJECTS) $(mont_LDADD) $(LIBS)

objectstest$(EXEEXT): $(objectstest_OBJECTS) $(objectstest_DEPENDENCIES) $(EXTRA_objectstest_DEPENDENCIES) 
	@rm -f objectstest$(EXEEXT)
1953
1954
1955
1956
1957
1958
1959




1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027




2028
2029
2030
2031
2032
2033
2034
poly1305test$(EXEEXT): $(poly1305test_OBJECTS) $(poly1305test_DEPENDENCIES) $(EXTRA_poly1305test_DEPENDENCIES) 
	@rm -f poly1305test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(poly1305test_OBJECTS) $(poly1305test_LDADD) $(LIBS)

pq_test$(EXEEXT): $(pq_test_OBJECTS) $(pq_test_DEPENDENCIES) $(EXTRA_pq_test_DEPENDENCIES) 
	@rm -f pq_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(pq_test_OBJECTS) $(pq_test_LDADD) $(LIBS)





randtest$(EXEEXT): $(randtest_OBJECTS) $(randtest_DEPENDENCIES) $(EXTRA_randtest_DEPENDENCIES) 
	@rm -f randtest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(randtest_OBJECTS) $(randtest_LDADD) $(LIBS)

rc2test$(EXEEXT): $(rc2test_OBJECTS) $(rc2test_DEPENDENCIES) $(EXTRA_rc2test_DEPENDENCIES) 
	@rm -f rc2test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rc2test_OBJECTS) $(rc2test_LDADD) $(LIBS)

rc4test$(EXEEXT): $(rc4test_OBJECTS) $(rc4test_DEPENDENCIES) $(EXTRA_rc4test_DEPENDENCIES) 
	@rm -f rc4test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rc4test_OBJECTS) $(rc4test_LDADD) $(LIBS)

record_layer_test$(EXEEXT): $(record_layer_test_OBJECTS) $(record_layer_test_DEPENDENCIES) $(EXTRA_record_layer_test_DEPENDENCIES) 
	@rm -f record_layer_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(record_layer_test_OBJECTS) $(record_layer_test_LDADD) $(LIBS)

recordtest$(EXEEXT): $(recordtest_OBJECTS) $(recordtest_DEPENDENCIES) $(EXTRA_recordtest_DEPENDENCIES) 
	@rm -f recordtest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(recordtest_OBJECTS) $(recordtest_LDADD) $(LIBS)

rfc3779$(EXEEXT): $(rfc3779_OBJECTS) $(rfc3779_DEPENDENCIES) $(EXTRA_rfc3779_DEPENDENCIES) 
	@rm -f rfc3779$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rfc3779_OBJECTS) $(rfc3779_LDADD) $(LIBS)

rfc5280time$(EXEEXT): $(rfc5280time_OBJECTS) $(rfc5280time_DEPENDENCIES) $(EXTRA_rfc5280time_DEPENDENCIES) 
	@rm -f rfc5280time$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rfc5280time_OBJECTS) $(rfc5280time_LDADD) $(LIBS)

rmdtest$(EXEEXT): $(rmdtest_OBJECTS) $(rmdtest_DEPENDENCIES) $(EXTRA_rmdtest_DEPENDENCIES) 
	@rm -f rmdtest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rmdtest_OBJECTS) $(rmdtest_LDADD) $(LIBS)

rsa_test$(EXEEXT): $(rsa_test_OBJECTS) $(rsa_test_DEPENDENCIES) $(EXTRA_rsa_test_DEPENDENCIES) 
	@rm -f rsa_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rsa_test_OBJECTS) $(rsa_test_LDADD) $(LIBS)

servertest$(EXEEXT): $(servertest_OBJECTS) $(servertest_DEPENDENCIES) $(EXTRA_servertest_DEPENDENCIES) 
	@rm -f servertest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(servertest_OBJECTS) $(servertest_LDADD) $(LIBS)

sha1test$(EXEEXT): $(sha1test_OBJECTS) $(sha1test_DEPENDENCIES) $(EXTRA_sha1test_DEPENDENCIES) 
	@rm -f sha1test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sha1test_OBJECTS) $(sha1test_LDADD) $(LIBS)

sha256test$(EXEEXT): $(sha256test_OBJECTS) $(sha256test_DEPENDENCIES) $(EXTRA_sha256test_DEPENDENCIES) 
	@rm -f sha256test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sha256test_OBJECTS) $(sha256test_LDADD) $(LIBS)

sha512test$(EXEEXT): $(sha512test_OBJECTS) $(sha512test_DEPENDENCIES) $(EXTRA_sha512test_DEPENDENCIES) 
	@rm -f sha512test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sha512test_OBJECTS) $(sha512test_LDADD) $(LIBS)

sm3test$(EXEEXT): $(sm3test_OBJECTS) $(sm3test_DEPENDENCIES) $(EXTRA_sm3test_DEPENDENCIES) 
	@rm -f sm3test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sm3test_OBJECTS) $(sm3test_LDADD) $(LIBS)

sm4test$(EXEEXT): $(sm4test_OBJECTS) $(sm4test_DEPENDENCIES) $(EXTRA_sm4test_DEPENDENCIES) 
	@rm -f sm4test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sm4test_OBJECTS) $(sm4test_LDADD) $(LIBS)

ssl_get_shared_ciphers$(EXEEXT): $(ssl_get_shared_ciphers_OBJECTS) $(ssl_get_shared_ciphers_DEPENDENCIES) $(EXTRA_ssl_get_shared_ciphers_DEPENDENCIES) 
	@rm -f ssl_get_shared_ciphers$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(ssl_get_shared_ciphers_OBJECTS) $(ssl_get_shared_ciphers_LDADD) $(LIBS)

ssl_methods$(EXEEXT): $(ssl_methods_OBJECTS) $(ssl_methods_DEPENDENCIES) $(EXTRA_ssl_methods_DEPENDENCIES) 
	@rm -f ssl_methods$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(ssl_methods_OBJECTS) $(ssl_methods_LDADD) $(LIBS)





ssl_versions$(EXEEXT): $(ssl_versions_OBJECTS) $(ssl_versions_DEPENDENCIES) $(EXTRA_ssl_versions_DEPENDENCIES) 
	@rm -f ssl_versions$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(ssl_versions_OBJECTS) $(ssl_versions_LDADD) $(LIBS)

ssltest$(EXEEXT): $(ssltest_OBJECTS) $(ssltest_DEPENDENCIES) $(EXTRA_ssltest_DEPENDENCIES) 
	@rm -f ssltest$(EXEEXT)







>
>
>
>





|
|
|

|
|
|

















|
|
|









<
<
<
|
<
|
|
<
<
<
<
















>
>
>
>







2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053



2054

2055
2056




2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
poly1305test$(EXEEXT): $(poly1305test_OBJECTS) $(poly1305test_DEPENDENCIES) $(EXTRA_poly1305test_DEPENDENCIES) 
	@rm -f poly1305test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(poly1305test_OBJECTS) $(poly1305test_LDADD) $(LIBS)

pq_test$(EXEEXT): $(pq_test_OBJECTS) $(pq_test_DEPENDENCIES) $(EXTRA_pq_test_DEPENDENCIES) 
	@rm -f pq_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(pq_test_OBJECTS) $(pq_test_LDADD) $(LIBS)

quictest$(EXEEXT): $(quictest_OBJECTS) $(quictest_DEPENDENCIES) $(EXTRA_quictest_DEPENDENCIES) 
	@rm -f quictest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(quictest_OBJECTS) $(quictest_LDADD) $(LIBS)

randtest$(EXEEXT): $(randtest_OBJECTS) $(randtest_DEPENDENCIES) $(EXTRA_randtest_DEPENDENCIES) 
	@rm -f randtest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(randtest_OBJECTS) $(randtest_LDADD) $(LIBS)

rc2_test$(EXEEXT): $(rc2_test_OBJECTS) $(rc2_test_DEPENDENCIES) $(EXTRA_rc2_test_DEPENDENCIES) 
	@rm -f rc2_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rc2_test_OBJECTS) $(rc2_test_LDADD) $(LIBS)

rc4_test$(EXEEXT): $(rc4_test_OBJECTS) $(rc4_test_DEPENDENCIES) $(EXTRA_rc4_test_DEPENDENCIES) 
	@rm -f rc4_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rc4_test_OBJECTS) $(rc4_test_LDADD) $(LIBS)

record_layer_test$(EXEEXT): $(record_layer_test_OBJECTS) $(record_layer_test_DEPENDENCIES) $(EXTRA_record_layer_test_DEPENDENCIES) 
	@rm -f record_layer_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(record_layer_test_OBJECTS) $(record_layer_test_LDADD) $(LIBS)

recordtest$(EXEEXT): $(recordtest_OBJECTS) $(recordtest_DEPENDENCIES) $(EXTRA_recordtest_DEPENDENCIES) 
	@rm -f recordtest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(recordtest_OBJECTS) $(recordtest_LDADD) $(LIBS)

rfc3779$(EXEEXT): $(rfc3779_OBJECTS) $(rfc3779_DEPENDENCIES) $(EXTRA_rfc3779_DEPENDENCIES) 
	@rm -f rfc3779$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rfc3779_OBJECTS) $(rfc3779_LDADD) $(LIBS)

rfc5280time$(EXEEXT): $(rfc5280time_OBJECTS) $(rfc5280time_DEPENDENCIES) $(EXTRA_rfc5280time_DEPENDENCIES) 
	@rm -f rfc5280time$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rfc5280time_OBJECTS) $(rfc5280time_LDADD) $(LIBS)

rmd_test$(EXEEXT): $(rmd_test_OBJECTS) $(rmd_test_DEPENDENCIES) $(EXTRA_rmd_test_DEPENDENCIES) 
	@rm -f rmd_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rmd_test_OBJECTS) $(rmd_test_LDADD) $(LIBS)

rsa_test$(EXEEXT): $(rsa_test_OBJECTS) $(rsa_test_DEPENDENCIES) $(EXTRA_rsa_test_DEPENDENCIES) 
	@rm -f rsa_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(rsa_test_OBJECTS) $(rsa_test_LDADD) $(LIBS)

servertest$(EXEEXT): $(servertest_OBJECTS) $(servertest_DEPENDENCIES) $(EXTRA_servertest_DEPENDENCIES) 
	@rm -f servertest$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(servertest_OBJECTS) $(servertest_LDADD) $(LIBS)




sha_test$(EXEEXT): $(sha_test_OBJECTS) $(sha_test_DEPENDENCIES) $(EXTRA_sha_test_DEPENDENCIES) 

	@rm -f sha_test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sha_test_OBJECTS) $(sha_test_LDADD) $(LIBS)





sm3test$(EXEEXT): $(sm3test_OBJECTS) $(sm3test_DEPENDENCIES) $(EXTRA_sm3test_DEPENDENCIES) 
	@rm -f sm3test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sm3test_OBJECTS) $(sm3test_LDADD) $(LIBS)

sm4test$(EXEEXT): $(sm4test_OBJECTS) $(sm4test_DEPENDENCIES) $(EXTRA_sm4test_DEPENDENCIES) 
	@rm -f sm4test$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(sm4test_OBJECTS) $(sm4test_LDADD) $(LIBS)

ssl_get_shared_ciphers$(EXEEXT): $(ssl_get_shared_ciphers_OBJECTS) $(ssl_get_shared_ciphers_DEPENDENCIES) $(EXTRA_ssl_get_shared_ciphers_DEPENDENCIES) 
	@rm -f ssl_get_shared_ciphers$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(ssl_get_shared_ciphers_OBJECTS) $(ssl_get_shared_ciphers_LDADD) $(LIBS)

ssl_methods$(EXEEXT): $(ssl_methods_OBJECTS) $(ssl_methods_DEPENDENCIES) $(EXTRA_ssl_methods_DEPENDENCIES) 
	@rm -f ssl_methods$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(ssl_methods_OBJECTS) $(ssl_methods_LDADD) $(LIBS)

ssl_set_alpn_protos$(EXEEXT): $(ssl_set_alpn_protos_OBJECTS) $(ssl_set_alpn_protos_DEPENDENCIES) $(EXTRA_ssl_set_alpn_protos_DEPENDENCIES) 
	@rm -f ssl_set_alpn_protos$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(ssl_set_alpn_protos_OBJECTS) $(ssl_set_alpn_protos_LDADD) $(LIBS)

ssl_versions$(EXEEXT): $(ssl_versions_OBJECTS) $(ssl_versions_DEPENDENCIES) $(EXTRA_ssl_versions_DEPENDENCIES) 
	@rm -f ssl_versions$(EXEEXT)
	$(AM_V_CCLD)$(LINK) $(ssl_versions_OBJECTS) $(ssl_versions_LDADD) $(LIBS)

ssltest$(EXEEXT): $(ssltest_OBJECTS) $(ssltest_DEPENDENCIES) $(EXTRA_ssltest_DEPENDENCIES) 
	@rm -f ssltest$(EXEEXT)
2102
2103
2104
2105
2106
2107
2108

2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120

2121
2122

2123
2124
2125
2126
2127
2128
2129

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aeadtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aes_wrap.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc4randomforktest.Po@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1api.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1basic.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1complex.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1evp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1object.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1string_copy.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1time.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1x509.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bftest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/biotest.Po@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_mod_exp2_mont.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_mod_sqrt.Po@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_rand_interval.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_to_string.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bnaddsub.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bntest-bntest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffertest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytestringtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/casttest.Po@am__quote@ # am--include-marker







>












>


>







2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aeadtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aes_wrap.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc4randomforktest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1_string_to_utf8.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1api.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1basic.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1complex.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1evp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1object.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1string_copy.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1time.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1x509.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bftest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/biotest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_isqrt.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_mod_exp2_mont.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_mod_sqrt.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_primes.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_rand_interval.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bn_to_string.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bnaddsub.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bntest-bntest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffertest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytestringtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/casttest.Po@am__quote@ # am--include-marker
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173

2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190

2191
2192
2193
2194
2195
2196
2197
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handshake_table.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hkdf_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hmactest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ideatest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/igetest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key_schedule.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keypairtest-keypairtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md4test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mont.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objectstest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocsp_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optionstest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pbkdf2.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pidwraptest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkcs7test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poly1305test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pq_test.Po@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rc2test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rc4test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/record_layer_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recordtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc3779-rfc3779.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc5280time.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsa_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/servertest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha256test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha512test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sm3test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sm4test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_methods.Po@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_versions.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssltest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string_table.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timingsafe.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_ext_alpn.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_prf.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlsexttest.Po@am__quote@ # am--include-marker







|
<









>

|
|




|


|
<
<




>







2208
2209
2210
2211
2212
2213
2214
2215

2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236


2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handshake_table.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hkdf_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hmactest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ideatest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/igetest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key_schedule.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keypairtest-keypairtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md_test.Po@am__quote@ # am--include-marker

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mont.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objectstest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocsp_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optionstest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pbkdf2.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pidwraptest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkcs7test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poly1305test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pq_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quictest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rc2_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rc4_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/record_layer_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recordtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc3779-rfc3779.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc5280time.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmd_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsa_test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/servertest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha_test.Po@am__quote@ # am--include-marker


@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sm3test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sm4test.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_methods.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_set_alpn_protos.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_versions.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssltest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string_table.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timingsafe.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_ext_alpn.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_prf.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlsexttest.Po@am__quote@ # am--include-marker
2524
2525
2526
2527
2528
2529
2530







2531
2532
2533
2534
2535
2536
2537
arc4randomforktest.sh.log: arc4randomforktest.sh
	@p='arc4randomforktest.sh'; \
	b='arc4randomforktest.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)







asn1api.log: asn1api$(EXEEXT)
	@p='asn1api$(EXEEXT)'; \
	b='asn1api'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)







>
>
>
>
>
>
>







2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
arc4randomforktest.sh.log: arc4randomforktest.sh
	@p='arc4randomforktest.sh'; \
	b='arc4randomforktest.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
asn1_string_to_utf8.log: asn1_string_to_utf8$(EXEEXT)
	@p='asn1_string_to_utf8$(EXEEXT)'; \
	b='asn1_string_to_utf8'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
asn1api.log: asn1api$(EXEEXT)
	@p='asn1api$(EXEEXT)'; \
	b='asn1api'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
2615
2616
2617
2618
2619
2620
2621







2622
2623
2624
2625
2626
2627
2628
2629
2630
2631







2632
2633
2634
2635
2636
2637
2638
bnaddsub.log: bnaddsub$(EXEEXT)
	@p='bnaddsub$(EXEEXT)'; \
	b='bnaddsub'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)







bn_mod_exp2_mont.log: bn_mod_exp2_mont$(EXEEXT)
	@p='bn_mod_exp2_mont$(EXEEXT)'; \
	b='bn_mod_exp2_mont'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
bn_mod_sqrt.log: bn_mod_sqrt$(EXEEXT)
	@p='bn_mod_sqrt$(EXEEXT)'; \
	b='bn_mod_sqrt'; \







	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
bn_rand_interval.log: bn_rand_interval$(EXEEXT)
	@p='bn_rand_interval$(EXEEXT)'; \
	b='bn_rand_interval'; \







>
>
>
>
>
>
>










>
>
>
>
>
>
>







2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
bnaddsub.log: bnaddsub$(EXEEXT)
	@p='bnaddsub$(EXEEXT)'; \
	b='bnaddsub'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
bn_isqrt.log: bn_isqrt$(EXEEXT)
	@p='bn_isqrt$(EXEEXT)'; \
	b='bn_isqrt'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
bn_mod_exp2_mont.log: bn_mod_exp2_mont$(EXEEXT)
	@p='bn_mod_exp2_mont$(EXEEXT)'; \
	b='bn_mod_exp2_mont'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
bn_mod_sqrt.log: bn_mod_sqrt$(EXEEXT)
	@p='bn_mod_sqrt$(EXEEXT)'; \
	b='bn_mod_sqrt'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
bn_primes.log: bn_primes$(EXEEXT)
	@p='bn_primes$(EXEEXT)'; \
	b='bn_primes'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
bn_rand_interval.log: bn_rand_interval$(EXEEXT)
	@p='bn_rand_interval$(EXEEXT)'; \
	b='bn_rand_interval'; \
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
keypairtest.sh.log: keypairtest.sh
	@p='keypairtest.sh'; \
	b='keypairtest.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
md4test.log: md4test$(EXEEXT)
	@p='md4test$(EXEEXT)'; \
	b='md4test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
md5test.log: md5test$(EXEEXT)
	@p='md5test$(EXEEXT)'; \
	b='md5test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
mont.log: mont$(EXEEXT)
	@p='mont$(EXEEXT)'; \
	b='mont'; \







|
|
|
<
<
<
<
<
<
<







2974
2975
2976
2977
2978
2979
2980
2981
2982
2983







2984
2985
2986
2987
2988
2989
2990
keypairtest.sh.log: keypairtest.sh
	@p='keypairtest.sh'; \
	b='keypairtest.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
md_test.log: md_test$(EXEEXT)
	@p='md_test$(EXEEXT)'; \
	b='md_test'; \







	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
mont.log: mont$(EXEEXT)
	@p='mont$(EXEEXT)'; \
	b='mont'; \
2979
2980
2981
2982
2983
2984
2985







2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
pq_test.sh.log: pq_test.sh
	@p='pq_test.sh'; \
	b='pq_test.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)







randtest.log: randtest$(EXEEXT)
	@p='randtest$(EXEEXT)'; \
	b='randtest'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rc2test.log: rc2test$(EXEEXT)
	@p='rc2test$(EXEEXT)'; \
	b='rc2test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rc4test.log: rc4test$(EXEEXT)
	@p='rc4test$(EXEEXT)'; \
	b='rc4test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
recordtest.log: recordtest$(EXEEXT)
	@p='recordtest$(EXEEXT)'; \
	b='recordtest'; \







>
>
>
>
>
>
>







|
|
|




|
|
|







3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
pq_test.sh.log: pq_test.sh
	@p='pq_test.sh'; \
	b='pq_test.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
quictest.sh.log: quictest.sh
	@p='quictest.sh'; \
	b='quictest.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
randtest.log: randtest$(EXEEXT)
	@p='randtest$(EXEEXT)'; \
	b='randtest'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rc2_test.log: rc2_test$(EXEEXT)
	@p='rc2_test$(EXEEXT)'; \
	b='rc2_test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rc4_test.log: rc4_test$(EXEEXT)
	@p='rc4_test$(EXEEXT)'; \
	b='rc4_test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
recordtest.log: recordtest$(EXEEXT)
	@p='recordtest$(EXEEXT)'; \
	b='recordtest'; \
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
rfc5280time.log: rfc5280time$(EXEEXT)
	@p='rfc5280time$(EXEEXT)'; \
	b='rfc5280time'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rmdtest.log: rmdtest$(EXEEXT)
	@p='rmdtest$(EXEEXT)'; \
	b='rmdtest'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rsa_test.log: rsa_test$(EXEEXT)
	@p='rsa_test$(EXEEXT)'; \
	b='rsa_test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
servertest.sh.log: servertest.sh
	@p='servertest.sh'; \
	b='servertest.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
sha1test.log: sha1test$(EXEEXT)
	@p='sha1test$(EXEEXT)'; \
	b='sha1test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
sha256test.log: sha256test$(EXEEXT)
	@p='sha256test$(EXEEXT)'; \
	b='sha256test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
sha512test.log: sha512test$(EXEEXT)
	@p='sha512test$(EXEEXT)'; \
	b='sha512test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
sm3test.log: sm3test$(EXEEXT)
	@p='sm3test$(EXEEXT)'; \
	b='sm3test'; \







|
|
|


















|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<







3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130














3131
3132
3133
3134
3135
3136
3137
rfc5280time.log: rfc5280time$(EXEEXT)
	@p='rfc5280time$(EXEEXT)'; \
	b='rfc5280time'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rmd_test.log: rmd_test$(EXEEXT)
	@p='rmd_test$(EXEEXT)'; \
	b='rmd_test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
rsa_test.log: rsa_test$(EXEEXT)
	@p='rsa_test$(EXEEXT)'; \
	b='rsa_test'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
servertest.sh.log: servertest.sh
	@p='servertest.sh'; \
	b='servertest.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
sha_test.log: sha_test$(EXEEXT)
	@p='sha_test$(EXEEXT)'; \
	b='sha_test'; \














	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
sm3test.log: sm3test$(EXEEXT)
	@p='sm3test$(EXEEXT)'; \
	b='sm3test'; \
3094
3095
3096
3097
3098
3099
3100







3101
3102
3103
3104
3105
3106
3107
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
ssl_methods.log: ssl_methods$(EXEEXT)
	@p='ssl_methods$(EXEEXT)'; \
	b='ssl_methods'; \







	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
ssl_versions.log: ssl_versions$(EXEEXT)
	@p='ssl_versions$(EXEEXT)'; \
	b='ssl_versions'; \







>
>
>
>
>
>
>







3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
ssl_methods.log: ssl_methods$(EXEEXT)
	@p='ssl_methods$(EXEEXT)'; \
	b='ssl_methods'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
ssl_set_alpn_protos.log: ssl_set_alpn_protos$(EXEEXT)
	@p='ssl_set_alpn_protos$(EXEEXT)'; \
	b='ssl_set_alpn_protos'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
ssl_versions.log: ssl_versions$(EXEEXT)
	@p='ssl_versions$(EXEEXT)'; \
	b='ssl_versions'; \
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
@am__EXEEXT_TRUE@	@p='$<'; \
@am__EXEEXT_TRUE@	$(am__set_b); \
@am__EXEEXT_TRUE@	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
@am__EXEEXT_TRUE@	--log-file $$b.log --trs-file $$b.trs \
@am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
@am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







3317
3318
3319
3320
3321
3322
3323

3324
3325
3326
3327
3328
3329
3330
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
@am__EXEEXT_TRUE@	@p='$<'; \
@am__EXEEXT_TRUE@	$(am__set_b); \
@am__EXEEXT_TRUE@	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
@am__EXEEXT_TRUE@	--log-file $$b.log --trs-file $$b.trs \
@am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
@am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
3337
3338
3339
3340
3341
3342
3343

3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355

3356
3357

3358
3359
3360
3361
3362
3363
3364
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
	mostlyclean-am

distclean: distclean-am
		-rm -f ./$(DEPDIR)/aeadtest.Po
	-rm -f ./$(DEPDIR)/aes_wrap.Po
	-rm -f ./$(DEPDIR)/arc4randomforktest.Po

	-rm -f ./$(DEPDIR)/asn1api.Po
	-rm -f ./$(DEPDIR)/asn1basic.Po
	-rm -f ./$(DEPDIR)/asn1complex.Po
	-rm -f ./$(DEPDIR)/asn1evp.Po
	-rm -f ./$(DEPDIR)/asn1object.Po
	-rm -f ./$(DEPDIR)/asn1string_copy.Po
	-rm -f ./$(DEPDIR)/asn1test.Po
	-rm -f ./$(DEPDIR)/asn1time.Po
	-rm -f ./$(DEPDIR)/asn1x509.Po
	-rm -f ./$(DEPDIR)/base64test.Po
	-rm -f ./$(DEPDIR)/bftest.Po
	-rm -f ./$(DEPDIR)/biotest.Po

	-rm -f ./$(DEPDIR)/bn_mod_exp2_mont.Po
	-rm -f ./$(DEPDIR)/bn_mod_sqrt.Po

	-rm -f ./$(DEPDIR)/bn_rand_interval.Po
	-rm -f ./$(DEPDIR)/bn_to_string.Po
	-rm -f ./$(DEPDIR)/bnaddsub.Po
	-rm -f ./$(DEPDIR)/bntest-bntest.Po
	-rm -f ./$(DEPDIR)/buffertest.Po
	-rm -f ./$(DEPDIR)/bytestringtest.Po
	-rm -f ./$(DEPDIR)/casttest.Po







>












>


>







3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
	mostlyclean-am

distclean: distclean-am
		-rm -f ./$(DEPDIR)/aeadtest.Po
	-rm -f ./$(DEPDIR)/aes_wrap.Po
	-rm -f ./$(DEPDIR)/arc4randomforktest.Po
	-rm -f ./$(DEPDIR)/asn1_string_to_utf8.Po
	-rm -f ./$(DEPDIR)/asn1api.Po
	-rm -f ./$(DEPDIR)/asn1basic.Po
	-rm -f ./$(DEPDIR)/asn1complex.Po
	-rm -f ./$(DEPDIR)/asn1evp.Po
	-rm -f ./$(DEPDIR)/asn1object.Po
	-rm -f ./$(DEPDIR)/asn1string_copy.Po
	-rm -f ./$(DEPDIR)/asn1test.Po
	-rm -f ./$(DEPDIR)/asn1time.Po
	-rm -f ./$(DEPDIR)/asn1x509.Po
	-rm -f ./$(DEPDIR)/base64test.Po
	-rm -f ./$(DEPDIR)/bftest.Po
	-rm -f ./$(DEPDIR)/biotest.Po
	-rm -f ./$(DEPDIR)/bn_isqrt.Po
	-rm -f ./$(DEPDIR)/bn_mod_exp2_mont.Po
	-rm -f ./$(DEPDIR)/bn_mod_sqrt.Po
	-rm -f ./$(DEPDIR)/bn_primes.Po
	-rm -f ./$(DEPDIR)/bn_rand_interval.Po
	-rm -f ./$(DEPDIR)/bn_to_string.Po
	-rm -f ./$(DEPDIR)/bnaddsub.Po
	-rm -f ./$(DEPDIR)/bntest-bntest.Po
	-rm -f ./$(DEPDIR)/buffertest.Po
	-rm -f ./$(DEPDIR)/bytestringtest.Po
	-rm -f ./$(DEPDIR)/casttest.Po
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408

3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425

3426
3427
3428
3429
3430
3431
3432
	-rm -f ./$(DEPDIR)/handshake_table.Po
	-rm -f ./$(DEPDIR)/hkdf_test.Po
	-rm -f ./$(DEPDIR)/hmactest.Po
	-rm -f ./$(DEPDIR)/ideatest.Po
	-rm -f ./$(DEPDIR)/igetest.Po
	-rm -f ./$(DEPDIR)/key_schedule.Po
	-rm -f ./$(DEPDIR)/keypairtest-keypairtest.Po
	-rm -f ./$(DEPDIR)/md4test.Po
	-rm -f ./$(DEPDIR)/md5test.Po
	-rm -f ./$(DEPDIR)/mont.Po
	-rm -f ./$(DEPDIR)/objectstest.Po
	-rm -f ./$(DEPDIR)/ocsp_test.Po
	-rm -f ./$(DEPDIR)/optionstest.Po
	-rm -f ./$(DEPDIR)/pbkdf2.Po
	-rm -f ./$(DEPDIR)/pidwraptest.Po
	-rm -f ./$(DEPDIR)/pkcs7test.Po
	-rm -f ./$(DEPDIR)/poly1305test.Po
	-rm -f ./$(DEPDIR)/pq_test.Po

	-rm -f ./$(DEPDIR)/randtest.Po
	-rm -f ./$(DEPDIR)/rc2test.Po
	-rm -f ./$(DEPDIR)/rc4test.Po
	-rm -f ./$(DEPDIR)/record_layer_test.Po
	-rm -f ./$(DEPDIR)/recordtest.Po
	-rm -f ./$(DEPDIR)/rfc3779-rfc3779.Po
	-rm -f ./$(DEPDIR)/rfc5280time.Po
	-rm -f ./$(DEPDIR)/rmdtest.Po
	-rm -f ./$(DEPDIR)/rsa_test.Po
	-rm -f ./$(DEPDIR)/servertest.Po
	-rm -f ./$(DEPDIR)/sha1test.Po
	-rm -f ./$(DEPDIR)/sha256test.Po
	-rm -f ./$(DEPDIR)/sha512test.Po
	-rm -f ./$(DEPDIR)/sm3test.Po
	-rm -f ./$(DEPDIR)/sm4test.Po
	-rm -f ./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po
	-rm -f ./$(DEPDIR)/ssl_methods.Po

	-rm -f ./$(DEPDIR)/ssl_versions.Po
	-rm -f ./$(DEPDIR)/ssltest.Po
	-rm -f ./$(DEPDIR)/string_table.Po
	-rm -f ./$(DEPDIR)/timingsafe.Po
	-rm -f ./$(DEPDIR)/tls_ext_alpn.Po
	-rm -f ./$(DEPDIR)/tls_prf.Po
	-rm -f ./$(DEPDIR)/tlsexttest.Po







|
<









>

|
|




|


|
<
<




>







3458
3459
3460
3461
3462
3463
3464
3465

3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486


3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
	-rm -f ./$(DEPDIR)/handshake_table.Po
	-rm -f ./$(DEPDIR)/hkdf_test.Po
	-rm -f ./$(DEPDIR)/hmactest.Po
	-rm -f ./$(DEPDIR)/ideatest.Po
	-rm -f ./$(DEPDIR)/igetest.Po
	-rm -f ./$(DEPDIR)/key_schedule.Po
	-rm -f ./$(DEPDIR)/keypairtest-keypairtest.Po
	-rm -f ./$(DEPDIR)/md_test.Po

	-rm -f ./$(DEPDIR)/mont.Po
	-rm -f ./$(DEPDIR)/objectstest.Po
	-rm -f ./$(DEPDIR)/ocsp_test.Po
	-rm -f ./$(DEPDIR)/optionstest.Po
	-rm -f ./$(DEPDIR)/pbkdf2.Po
	-rm -f ./$(DEPDIR)/pidwraptest.Po
	-rm -f ./$(DEPDIR)/pkcs7test.Po
	-rm -f ./$(DEPDIR)/poly1305test.Po
	-rm -f ./$(DEPDIR)/pq_test.Po
	-rm -f ./$(DEPDIR)/quictest.Po
	-rm -f ./$(DEPDIR)/randtest.Po
	-rm -f ./$(DEPDIR)/rc2_test.Po
	-rm -f ./$(DEPDIR)/rc4_test.Po
	-rm -f ./$(DEPDIR)/record_layer_test.Po
	-rm -f ./$(DEPDIR)/recordtest.Po
	-rm -f ./$(DEPDIR)/rfc3779-rfc3779.Po
	-rm -f ./$(DEPDIR)/rfc5280time.Po
	-rm -f ./$(DEPDIR)/rmd_test.Po
	-rm -f ./$(DEPDIR)/rsa_test.Po
	-rm -f ./$(DEPDIR)/servertest.Po
	-rm -f ./$(DEPDIR)/sha_test.Po


	-rm -f ./$(DEPDIR)/sm3test.Po
	-rm -f ./$(DEPDIR)/sm4test.Po
	-rm -f ./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po
	-rm -f ./$(DEPDIR)/ssl_methods.Po
	-rm -f ./$(DEPDIR)/ssl_set_alpn_protos.Po
	-rm -f ./$(DEPDIR)/ssl_versions.Po
	-rm -f ./$(DEPDIR)/ssltest.Po
	-rm -f ./$(DEPDIR)/string_table.Po
	-rm -f ./$(DEPDIR)/timingsafe.Po
	-rm -f ./$(DEPDIR)/tls_ext_alpn.Po
	-rm -f ./$(DEPDIR)/tls_prf.Po
	-rm -f ./$(DEPDIR)/tlsexttest.Po
3486
3487
3488
3489
3490
3491
3492

3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504

3505
3506

3507
3508
3509
3510
3511
3512
3513

installcheck-am:

maintainer-clean: maintainer-clean-am
		-rm -f ./$(DEPDIR)/aeadtest.Po
	-rm -f ./$(DEPDIR)/aes_wrap.Po
	-rm -f ./$(DEPDIR)/arc4randomforktest.Po

	-rm -f ./$(DEPDIR)/asn1api.Po
	-rm -f ./$(DEPDIR)/asn1basic.Po
	-rm -f ./$(DEPDIR)/asn1complex.Po
	-rm -f ./$(DEPDIR)/asn1evp.Po
	-rm -f ./$(DEPDIR)/asn1object.Po
	-rm -f ./$(DEPDIR)/asn1string_copy.Po
	-rm -f ./$(DEPDIR)/asn1test.Po
	-rm -f ./$(DEPDIR)/asn1time.Po
	-rm -f ./$(DEPDIR)/asn1x509.Po
	-rm -f ./$(DEPDIR)/base64test.Po
	-rm -f ./$(DEPDIR)/bftest.Po
	-rm -f ./$(DEPDIR)/biotest.Po

	-rm -f ./$(DEPDIR)/bn_mod_exp2_mont.Po
	-rm -f ./$(DEPDIR)/bn_mod_sqrt.Po

	-rm -f ./$(DEPDIR)/bn_rand_interval.Po
	-rm -f ./$(DEPDIR)/bn_to_string.Po
	-rm -f ./$(DEPDIR)/bnaddsub.Po
	-rm -f ./$(DEPDIR)/bntest-bntest.Po
	-rm -f ./$(DEPDIR)/buffertest.Po
	-rm -f ./$(DEPDIR)/bytestringtest.Po
	-rm -f ./$(DEPDIR)/casttest.Po







>












>


>







3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582

installcheck-am:

maintainer-clean: maintainer-clean-am
		-rm -f ./$(DEPDIR)/aeadtest.Po
	-rm -f ./$(DEPDIR)/aes_wrap.Po
	-rm -f ./$(DEPDIR)/arc4randomforktest.Po
	-rm -f ./$(DEPDIR)/asn1_string_to_utf8.Po
	-rm -f ./$(DEPDIR)/asn1api.Po
	-rm -f ./$(DEPDIR)/asn1basic.Po
	-rm -f ./$(DEPDIR)/asn1complex.Po
	-rm -f ./$(DEPDIR)/asn1evp.Po
	-rm -f ./$(DEPDIR)/asn1object.Po
	-rm -f ./$(DEPDIR)/asn1string_copy.Po
	-rm -f ./$(DEPDIR)/asn1test.Po
	-rm -f ./$(DEPDIR)/asn1time.Po
	-rm -f ./$(DEPDIR)/asn1x509.Po
	-rm -f ./$(DEPDIR)/base64test.Po
	-rm -f ./$(DEPDIR)/bftest.Po
	-rm -f ./$(DEPDIR)/biotest.Po
	-rm -f ./$(DEPDIR)/bn_isqrt.Po
	-rm -f ./$(DEPDIR)/bn_mod_exp2_mont.Po
	-rm -f ./$(DEPDIR)/bn_mod_sqrt.Po
	-rm -f ./$(DEPDIR)/bn_primes.Po
	-rm -f ./$(DEPDIR)/bn_rand_interval.Po
	-rm -f ./$(DEPDIR)/bn_to_string.Po
	-rm -f ./$(DEPDIR)/bnaddsub.Po
	-rm -f ./$(DEPDIR)/bntest-bntest.Po
	-rm -f ./$(DEPDIR)/buffertest.Po
	-rm -f ./$(DEPDIR)/bytestringtest.Po
	-rm -f ./$(DEPDIR)/casttest.Po
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557

3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574

3575
3576
3577
3578
3579
3580
3581
	-rm -f ./$(DEPDIR)/handshake_table.Po
	-rm -f ./$(DEPDIR)/hkdf_test.Po
	-rm -f ./$(DEPDIR)/hmactest.Po
	-rm -f ./$(DEPDIR)/ideatest.Po
	-rm -f ./$(DEPDIR)/igetest.Po
	-rm -f ./$(DEPDIR)/key_schedule.Po
	-rm -f ./$(DEPDIR)/keypairtest-keypairtest.Po
	-rm -f ./$(DEPDIR)/md4test.Po
	-rm -f ./$(DEPDIR)/md5test.Po
	-rm -f ./$(DEPDIR)/mont.Po
	-rm -f ./$(DEPDIR)/objectstest.Po
	-rm -f ./$(DEPDIR)/ocsp_test.Po
	-rm -f ./$(DEPDIR)/optionstest.Po
	-rm -f ./$(DEPDIR)/pbkdf2.Po
	-rm -f ./$(DEPDIR)/pidwraptest.Po
	-rm -f ./$(DEPDIR)/pkcs7test.Po
	-rm -f ./$(DEPDIR)/poly1305test.Po
	-rm -f ./$(DEPDIR)/pq_test.Po

	-rm -f ./$(DEPDIR)/randtest.Po
	-rm -f ./$(DEPDIR)/rc2test.Po
	-rm -f ./$(DEPDIR)/rc4test.Po
	-rm -f ./$(DEPDIR)/record_layer_test.Po
	-rm -f ./$(DEPDIR)/recordtest.Po
	-rm -f ./$(DEPDIR)/rfc3779-rfc3779.Po
	-rm -f ./$(DEPDIR)/rfc5280time.Po
	-rm -f ./$(DEPDIR)/rmdtest.Po
	-rm -f ./$(DEPDIR)/rsa_test.Po
	-rm -f ./$(DEPDIR)/servertest.Po
	-rm -f ./$(DEPDIR)/sha1test.Po
	-rm -f ./$(DEPDIR)/sha256test.Po
	-rm -f ./$(DEPDIR)/sha512test.Po
	-rm -f ./$(DEPDIR)/sm3test.Po
	-rm -f ./$(DEPDIR)/sm4test.Po
	-rm -f ./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po
	-rm -f ./$(DEPDIR)/ssl_methods.Po

	-rm -f ./$(DEPDIR)/ssl_versions.Po
	-rm -f ./$(DEPDIR)/ssltest.Po
	-rm -f ./$(DEPDIR)/string_table.Po
	-rm -f ./$(DEPDIR)/timingsafe.Po
	-rm -f ./$(DEPDIR)/tls_ext_alpn.Po
	-rm -f ./$(DEPDIR)/tls_prf.Po
	-rm -f ./$(DEPDIR)/tlsexttest.Po







|
<









>

|
|




|


|
<
<




>







3609
3610
3611
3612
3613
3614
3615
3616

3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637


3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
	-rm -f ./$(DEPDIR)/handshake_table.Po
	-rm -f ./$(DEPDIR)/hkdf_test.Po
	-rm -f ./$(DEPDIR)/hmactest.Po
	-rm -f ./$(DEPDIR)/ideatest.Po
	-rm -f ./$(DEPDIR)/igetest.Po
	-rm -f ./$(DEPDIR)/key_schedule.Po
	-rm -f ./$(DEPDIR)/keypairtest-keypairtest.Po
	-rm -f ./$(DEPDIR)/md_test.Po

	-rm -f ./$(DEPDIR)/mont.Po
	-rm -f ./$(DEPDIR)/objectstest.Po
	-rm -f ./$(DEPDIR)/ocsp_test.Po
	-rm -f ./$(DEPDIR)/optionstest.Po
	-rm -f ./$(DEPDIR)/pbkdf2.Po
	-rm -f ./$(DEPDIR)/pidwraptest.Po
	-rm -f ./$(DEPDIR)/pkcs7test.Po
	-rm -f ./$(DEPDIR)/poly1305test.Po
	-rm -f ./$(DEPDIR)/pq_test.Po
	-rm -f ./$(DEPDIR)/quictest.Po
	-rm -f ./$(DEPDIR)/randtest.Po
	-rm -f ./$(DEPDIR)/rc2_test.Po
	-rm -f ./$(DEPDIR)/rc4_test.Po
	-rm -f ./$(DEPDIR)/record_layer_test.Po
	-rm -f ./$(DEPDIR)/recordtest.Po
	-rm -f ./$(DEPDIR)/rfc3779-rfc3779.Po
	-rm -f ./$(DEPDIR)/rfc5280time.Po
	-rm -f ./$(DEPDIR)/rmd_test.Po
	-rm -f ./$(DEPDIR)/rsa_test.Po
	-rm -f ./$(DEPDIR)/servertest.Po
	-rm -f ./$(DEPDIR)/sha_test.Po


	-rm -f ./$(DEPDIR)/sm3test.Po
	-rm -f ./$(DEPDIR)/sm4test.Po
	-rm -f ./$(DEPDIR)/ssl_get_shared_ciphers-ssl_get_shared_ciphers.Po
	-rm -f ./$(DEPDIR)/ssl_methods.Po
	-rm -f ./$(DEPDIR)/ssl_set_alpn_protos.Po
	-rm -f ./$(DEPDIR)/ssl_versions.Po
	-rm -f ./$(DEPDIR)/ssltest.Po
	-rm -f ./$(DEPDIR)/string_table.Po
	-rm -f ./$(DEPDIR)/timingsafe.Po
	-rm -f ./$(DEPDIR)/tls_ext_alpn.Po
	-rm -f ./$(DEPDIR)/tls_prf.Po
	-rm -f ./$(DEPDIR)/tlsexttest.Po
Changes to jni/libressl/tests/aeadtest.c.
1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50


51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
/*	$OpenBSD: aeadtest.c,v 1.13 2022/01/12 08:54:23 tb Exp $	*/
/* ====================================================================

 * Copyright (c) 2011-2013 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licensing@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================

 */



#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <ctype.h>

#include <openssl/evp.h>
#include <openssl/err.h>


/* This program tests an AEAD against a series of test vectors from a file. The
 * test vector file consists of key-value lines where the key and value are
 * separated by a colon and optional whitespace. The keys are listed in
 * NAMES, below. The values are hex-encoded data.
 *
 * After a number of key-value lines, a blank line indicates the end of the
 * test case.
 *
|
|
>
|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
|
|

<
<
<
<
<
|
|
|
<
<
|
<
|
<
|
<
<
<
>


>
>



<

<

|
|

>
|







1
2
3
4
5


















6




7
8
9





10
11
12


13

14

15



16
17
18
19
20
21
22
23

24

25
26
27
28
29
30
31
32
33
34
35
36
37
/*	$OpenBSD: aeadtest.c,v 1.23 2022/08/20 19:25:14 jsing Exp $	*/
/*
 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2014, Google Inc.
 *


















 * Permission to use, copy, modify, and/or distribute this software for any




 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *





 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY


 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES

 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION

 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN



 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <unistd.h>


#include <openssl/err.h>
#include <openssl/evp.h>

/*
 * This program tests an AEAD against a series of test vectors from a file. The
 * test vector file consists of key-value lines where the key and value are
 * separated by a colon and optional whitespace. The keys are listed in
 * NAMES, below. The values are hex-encoded data.
 *
 * After a number of key-value lines, a blank line indicates the end of the
 * test case.
 *
118
119
120
121
122
123
124
125

126
127

128
129
130
131

132
133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
	else if (h >= 'A' && h <= 'F')
		return h - 'A' + 10;
	else
		return 16;
}

static int
aead_from_name(const EVP_AEAD **aead, const char *name)

{
	*aead = NULL;


	if (strcmp(name, "aes-128-gcm") == 0) {
#ifndef OPENSSL_NO_AES
		*aead = EVP_aead_aes_128_gcm();

#else
		fprintf(stderr, "No AES support.\n");
#endif

	} else if (strcmp(name, "aes-256-gcm") == 0) {
#ifndef OPENSSL_NO_AES
		*aead = EVP_aead_aes_256_gcm();
#else
		fprintf(stderr, "No AES support.\n");
#endif
	} else if (strcmp(name, "chacha20-poly1305") == 0) {
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
		*aead = EVP_aead_chacha20_poly1305();
#else
		fprintf(stderr, "No chacha20-poly1305 support.\n");
#endif
	} else if (strcmp(name, "xchacha20-poly1305") == 0) {
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
		*aead = EVP_aead_xchacha20_poly1305();
#else
		fprintf(stderr, "No xchacha20-poly1305 support.\n");
#endif
	} else {
		fprintf(stderr, "Unknown AEAD: %s\n", name);
		return -1;
	}

	if (*aead == NULL)
		return 0;

	return 1;
}

static int
run_test_case(const EVP_AEAD* aead, unsigned char bufs[NUM_TYPES][BUF_MAX],
    const unsigned int lengths[NUM_TYPES], unsigned int line_no)
{
	EVP_AEAD_CTX *ctx;
	unsigned char out[BUF_MAX + EVP_AEAD_MAX_TAG_LENGTH], out2[BUF_MAX];
	size_t out_len, out_len2;
	int ret = 0;








|
>


>


<

>
|
<
<
>

<

|
<
<

<

<
|
<

<

<
<
<


|

<
<
<





|







87
88
89
90
91
92
93
94
95
96
97
98
99
100

101
102
103


104
105

106
107


108

109

110

111

112



113
114
115
116



117
118
119
120
121
122
123
124
125
126
127
128
129
	else if (h >= 'A' && h <= 'F')
		return h - 'A' + 10;
	else
		return 16;
}

static int
aead_from_name(const EVP_AEAD **aead, const EVP_CIPHER **cipher,
    const char *name)
{
	*aead = NULL;
	*cipher = NULL;

	if (strcmp(name, "aes-128-gcm") == 0) {

		*aead = EVP_aead_aes_128_gcm();
		*cipher = EVP_aes_128_gcm();
	} else if (strcmp(name, "aes-192-gcm") == 0) {


		*cipher = EVP_aes_192_gcm();
	} else if (strcmp(name, "aes-256-gcm") == 0) {

		*aead = EVP_aead_aes_256_gcm();
		*cipher = EVP_aes_256_gcm();


	} else if (strcmp(name, "chacha20-poly1305") == 0) {

		*aead = EVP_aead_chacha20_poly1305();

		*cipher = EVP_chacha20_poly1305();

	} else if (strcmp(name, "xchacha20-poly1305") == 0) {

		*aead = EVP_aead_xchacha20_poly1305();



	} else {
		fprintf(stderr, "Unknown AEAD: %s\n", name);
		return 0;
	}




	return 1;
}

static int
run_aead_test(const EVP_AEAD *aead, unsigned char bufs[NUM_TYPES][BUF_MAX],
    const unsigned int lengths[NUM_TYPES], unsigned int line_no)
{
	EVP_AEAD_CTX *ctx;
	unsigned char out[BUF_MAX + EVP_AEAD_MAX_TAG_LENGTH], out2[BUF_MAX];
	size_t out_len, out_len2;
	int ret = 0;

231
232
233
234
235
236
237








































































































































































































238
239
240
241
242
243

244
245
246
247

248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
	ret = 1;

 err:
	EVP_AEAD_CTX_free(ctx);

	return ret;
}









































































































































































































int
main(int argc, char **argv)
{
	FILE *f;
	const EVP_AEAD *aead = NULL;

	unsigned int line_no = 0, num_tests = 0, j;

	unsigned char bufs[NUM_TYPES][BUF_MAX];
	unsigned int lengths[NUM_TYPES];


	if (argc != 2) {
		fprintf(stderr, "%s <test file.txt>\n", argv[0]);
		return 1;
	}

	f = fopen(argv[1], "r");
	if (f == NULL) {
		perror("failed to open input");
		return 1;
	}

	for (j = 0; j < NUM_TYPES; j++)
		lengths[j] = 0;








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






>

<


>

|
|



|
<







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402

403
404
405
406
407
408
409
410
411
412

413
414
415
416
417
418
419
	ret = 1;

 err:
	EVP_AEAD_CTX_free(ctx);

	return ret;
}

static int
run_cipher_aead_encrypt_test(const EVP_CIPHER *cipher,
    unsigned char bufs[NUM_TYPES][BUF_MAX],
    const unsigned int lengths[NUM_TYPES], unsigned int line_no)
{
	unsigned char out[BUF_MAX + EVP_AEAD_MAX_TAG_LENGTH];
	EVP_CIPHER_CTX *ctx;
	size_t out_len;
	int len;
	int ret = 0;

	if ((ctx = EVP_CIPHER_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL: EVP_CIPHER_CTX_new\n");
		goto err;
	}

	if (!EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL)) {
		fprintf(stderr, "FAIL: EVP_EncryptInit_ex with cipher\n");
		goto err;
	}

	if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, lengths[NONCE], NULL)) {
		fprintf(stderr, "FAIL: EVP_CTRL_AEAD_SET_IVLEN\n");
		goto err;
	}

	if (!EVP_EncryptInit_ex(ctx, NULL, NULL, bufs[KEY], NULL)) {
		fprintf(stderr, "FAIL: EVP_EncryptInit_ex with key\n");
		goto err;
	}
	if (!EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, bufs[NONCE])) {
		fprintf(stderr, "FAIL: EVP_EncryptInit_ex with nonce\n");
		goto err;
	}

	if (!EVP_EncryptUpdate(ctx, NULL, &len, bufs[AD], lengths[AD])) {
		fprintf(stderr, "FAIL: EVP_EncryptUpdate with AD\n");
		goto err;
	}
	if ((unsigned int)len != lengths[AD]) {
		fprintf(stderr, "FAIL: EVP_EncryptUpdate with AD length = %u, "
		    "want %u\n", len, lengths[AD]);
		goto err;
	}
	if (!EVP_EncryptUpdate(ctx, out, &len, bufs[IN], lengths[IN])) {
		fprintf(stderr, "FAIL: EVP_EncryptUpdate with plaintext\n");
		goto err;
	}
	out_len = len;
	if (!EVP_EncryptFinal_ex(ctx, out + out_len, &len)) {
		fprintf(stderr, "FAIL: EVP_EncryptFinal_ex\n");
		goto err;
	}
	out_len += len;
	if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, lengths[TAG],
	    out + out_len)) {
		fprintf(stderr, "FAIL: EVP_EncryptInit_ex with cipher\n");
		goto err;
	}
	out_len += lengths[TAG];

	if (out_len != lengths[CT] + lengths[TAG]) {
		fprintf(stderr, "Bad output length on line %u: %zu vs %u\n",
		    line_no, out_len, (unsigned)(lengths[CT] + lengths[TAG]));
		goto err;
	}

	if (memcmp(out, bufs[CT], lengths[CT]) != 0) {
		fprintf(stderr, "Bad output on line %u\n", line_no);
		goto err;
	}

	if (memcmp(out + lengths[CT], bufs[TAG], lengths[TAG]) != 0) {
		fprintf(stderr, "Bad tag on line %u\n", line_no);
		goto err;
	}

	ret = 1;

 err:
	EVP_CIPHER_CTX_free(ctx);

	return ret;
}

static int
run_cipher_aead_decrypt_test(const EVP_CIPHER *cipher, int invalid,
    unsigned char bufs[NUM_TYPES][BUF_MAX],
    const unsigned int lengths[NUM_TYPES], unsigned int line_no)
{
	unsigned char in[BUF_MAX], out[BUF_MAX + EVP_AEAD_MAX_TAG_LENGTH];
	EVP_CIPHER_CTX *ctx;
	size_t out_len;
	int len;
	int ret = 0;

	if ((ctx = EVP_CIPHER_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL: EVP_CIPHER_CTX_new\n");
		goto err;
	}

	if (!EVP_DecryptInit_ex(ctx, cipher, NULL, NULL, NULL)) {
		fprintf(stderr, "FAIL: EVP_DecryptInit_ex with cipher\n");
		goto err;
	}

	if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, lengths[NONCE],
	    NULL)) {
		fprintf(stderr, "FAIL: EVP_CTRL_AEAD_SET_IVLEN\n");
		goto err;
	}

	memcpy(in, bufs[TAG], lengths[TAG]);
	if (invalid && lengths[CT] == 0)
		in[0] ^= 0x80;

	if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, lengths[TAG], in)) {
		fprintf(stderr, "FAIL: EVP_CTRL_AEAD_SET_TAG\n");
		goto err;
	}

	if (!EVP_DecryptInit_ex(ctx, NULL, NULL, bufs[KEY], NULL)) {
		fprintf(stderr, "FAIL: EVP_DecryptInit_ex with key\n");
		goto err;
	}
	if (!EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, bufs[NONCE])) {
		fprintf(stderr, "FAIL: EVP_DecryptInit_ex with nonce\n");
		goto err;
	}

	if (!EVP_DecryptUpdate(ctx, NULL, &len, bufs[AD], lengths[AD])) {
		fprintf(stderr, "FAIL: EVP_DecryptUpdate with AD\n");
		goto err;
	}
	if ((unsigned int)len != lengths[AD]) {
		fprintf(stderr, "FAIL: EVP_EncryptUpdate with AD length = %u, "
		    "want %u\n", len, lengths[AD]);
		goto err;
	}

	memcpy(in, bufs[CT], lengths[CT]);
	if (invalid && lengths[CT] > 0)
		in[0] ^= 0x80;

	if (!EVP_DecryptUpdate(ctx, out, &len, in, lengths[CT])) {
		fprintf(stderr, "FAIL: EVP_DecryptUpdate with ciphertext\n");
		goto err;
	}
	out_len = len;

	if (invalid) {
		if (EVP_DecryptFinal_ex(ctx, out + out_len, &len)) {
			fprintf(stderr, "FAIL: EVP_DecryptFinal_ex succeeded "
			    "with invalid ciphertext on line %u\n", line_no);
			goto err;
		}
		goto done;
	}

	if (!EVP_DecryptFinal_ex(ctx, out + out_len, &len)) {
		fprintf(stderr, "FAIL: EVP_DecryptFinal_ex\n");
		goto err;
	}
	out_len += len;

	if (out_len != lengths[IN]) {
		fprintf(stderr, "Bad decrypt on line %u: %zu\n",
		    line_no, out_len);
		goto err;
	}

	if (memcmp(out, bufs[IN], out_len) != 0) {
		fprintf(stderr, "Plaintext mismatch on line %u\n", line_no);
		goto err;
	}

 done:
	ret = 1;

 err:
	EVP_CIPHER_CTX_free(ctx);

	return ret;
}

static int
run_cipher_aead_test(const EVP_CIPHER *cipher,
    unsigned char bufs[NUM_TYPES][BUF_MAX],
    const unsigned int lengths[NUM_TYPES], unsigned int line_no)
{
	if (!run_cipher_aead_encrypt_test(cipher, bufs, lengths, line_no))
		return 0;
	if (!run_cipher_aead_decrypt_test(cipher, 0, bufs, lengths, line_no))
		return 0;
	if (!run_cipher_aead_decrypt_test(cipher, 1, bufs, lengths, line_no))
		return 0;

	return 1;
}

int
main(int argc, char **argv)
{
	FILE *f;
	const EVP_AEAD *aead = NULL;
	const EVP_CIPHER *cipher = NULL;
	unsigned int line_no = 0, num_tests = 0, j;

	unsigned char bufs[NUM_TYPES][BUF_MAX];
	unsigned int lengths[NUM_TYPES];
	const char *aeadname;

	if (argc != 3) {
		fprintf(stderr, "%s <aead> <test file.txt>\n", argv[0]);
		return 1;
	}

	if ((f = fopen(argv[2], "r")) == NULL) {

		perror("failed to open input");
		return 1;
	}

	for (j = 0; j < NUM_TYPES; j++)
		lengths[j] = 0;

283
284
285
286
287
288
289

290
291
292
293
294
295
296
297
298

299

300






301
302
303
304
305
306
307
308

309
310
311
312

313
314
315
316
317
318
319
					break;
				}
			}

			if (!any_values_set)
				continue;


			switch (aead_from_name(&aead, bufs[AEAD])) {
			case 0:
				fprintf(stderr, "Skipping test...\n");
				continue;
			case -1:
				fprintf(stderr, "Aborting...\n");
				return 4;
			}


			if (!run_test_case(aead, bufs, lengths, line_no))

				return 4;







			for (j = 0; j < NUM_TYPES; j++)
				lengths[j] = 0;

			num_tests++;
			continue;
		}


		/* Each line looks like:
		 *   TYPE: 0123abc
		 * Where "TYPE" is the type of the data on the line,
		 * e.g. "KEY". */

		for (i = 0; line[i] != 0 && line[i] != '\n'; i++) {
			if (line[i] == ':') {
				type_len = i;
				break;
			}
		}
		i++;







>
|
|
|
<
|




>
|
>
|
>
>
>
>
>
>








>
|


|
>







440
441
442
443
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
					break;
				}
			}

			if (!any_values_set)
				continue;

			aeadname = argv[1];
			if (lengths[AEAD] != 0)
				aeadname = bufs[AEAD];


			if (!aead_from_name(&aead, &cipher, aeadname)) {
				fprintf(stderr, "Aborting...\n");
				return 4;
			}

			if (aead != NULL) {
				if (!run_aead_test(aead, bufs, lengths,
				    line_no))
					return 4;
			}
			if (cipher != NULL) {
				if (!run_cipher_aead_test(cipher, bufs, lengths,
				    line_no))
					return 4;
			}

			for (j = 0; j < NUM_TYPES; j++)
				lengths[j] = 0;

			num_tests++;
			continue;
		}

		/*
		 * Each line looks like:
		 *   TYPE: 0123abc
		 * Where "TYPE" is the type of the data on the line,
		 * e.g. "KEY".
		 */
		for (i = 0; line[i] != 0 && line[i] != '\n'; i++) {
			if (line[i] == ':') {
				type_len = i;
				break;
			}
		}
		i++;
354
355
356
357
358
359
360


361


















362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385

386
387
388
389
390
391
392
393
394
			for (j = 0; j < BUF_MAX; j++) {
				if (buf[j] == '\n')
					buf[j] = '\0';
			}
			continue;
		}



		for (j = 0; line[i] != 0 && line[i] != '\n'; i++) {


















			unsigned char v, v2;
			v = hex_digit(line[i++]);
			if (line[i] == 0 || line[i] == '\n') {
				fprintf(stderr, "Odd-length hex data on "
				    "line %u\n", line_no);
				return 3;
			}
			v2 = hex_digit(line[i]);
			if (v > 15 || v2 > 15) {
				fprintf(stderr, "Invalid hex char on line %u\n",
				    line_no);
				return 3;
			}
			v <<= 4;
			v |= v2;

			if (j == BUF_MAX) {
				fprintf(stderr, "Too much hex data on line %u "
				    "(max is %u bytes)\n",
				    line_no, (unsigned) BUF_MAX);
				return 3;
			}
			buf[j++] = v;
			*buf_len = *buf_len + 1;

		}
	}

	printf("Completed %u test cases\n", num_tests);
	printf("PASS\n");
	fclose(f);

	return 0;
}







>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
>









521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
			for (j = 0; j < BUF_MAX; j++) {
				if (buf[j] == '\n')
					buf[j] = '\0';
			}
			continue;
		}

		if (line[i] == '"') {
			i++;
			for (j = 0; line[i] != 0 && line[i] != '\n'; i++) {
				if (line[i] == '"')
					break;
				if (j == BUF_MAX) {
					fprintf(stderr, "Too much data on "
					    "line %u (max is %u bytes)\n",
					    line_no, (unsigned) BUF_MAX);
					return 3;
				}
				buf[j++] = line[i];
				*buf_len = *buf_len + 1;
			}
			if (line[i + 1] != 0 && line[i + 1] != '\n') {
				fprintf(stderr, "Trailing data on line %u\n",
				    line_no);
				return 3;
			}
		} else {
			for (j = 0; line[i] != 0 && line[i] != '\n'; i++) {
				unsigned char v, v2;
				v = hex_digit(line[i++]);
				if (line[i] == 0 || line[i] == '\n') {
					fprintf(stderr, "Odd-length hex data "
					    "on line %u\n", line_no);
					return 3;
				}
				v2 = hex_digit(line[i]);
				if (v > 15 || v2 > 15) {
					fprintf(stderr, "Invalid hex char on "
					    "line %u\n", line_no);
					return 3;
				}
				v <<= 4;
				v |= v2;

				if (j == BUF_MAX) {
					fprintf(stderr, "Too much hex data on "
					    "line %u (max is %u bytes)\n",
					    line_no, (unsigned) BUF_MAX);
					return 3;
				}
				buf[j++] = v;
				*buf_len = *buf_len + 1;
			}
		}
	}

	printf("Completed %u test cases\n", num_tests);
	printf("PASS\n");
	fclose(f);

	return 0;
}
Changes to jni/libressl/tests/aeadtest.sh.
1
2
3
4
5
6
7






#!/bin/sh
set -e
TEST=./aeadtest
if [ -e ./aeadtest.exe ]; then
	TEST=./aeadtest.exe
fi
$TEST $srcdir/aeadtests.txt












|
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
set -e
TEST=./aeadtest
if [ -e ./aeadtest.exe ]; then
	TEST=./aeadtest.exe
fi
$TEST aead $srcdir/aeadtests.txt
$TEST aes-128-gcm $srcdir/aes_128_gcm_tests.txt
$TEST aes-192-gcm $srcdir/aes_192_gcm_tests.txt
$TEST aes-256-gcm $srcdir/aes_256_gcm_tests.txt
$TEST chacha20-poly1305 $srcdir/chacha20_poly1305_tests.txt
$TEST xchacha20-poly1305 $srcdir/xchacha20_poly1305_tests.txt

Added jni/libressl/tests/aes_128_gcm_tests.txt.








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# The AES-128-GCM test cases from cipher_tests.txt have been merged into this
# file.

KEY: d480429666d48b400633921c5407d1d1
NONCE: 3388c676dc754acfa66e172a
IN: 
AD: 
CT: 
TAG: 7d7daf44850921a34e636b01adeb104f

KEY: 3881e7be1bb3bbcaff20bdb78e5d1b67
NONCE: dcf5b7ae2d7552e2297fcfa9
IN: 0a2714aa7d
AD: c60c64bbf7
CT: 5626f96ecb
TAG: ff4c4f1d92b0abb1d0820833d9eb83c7

KEY: ea4f6f3c2fed2b9dd9708c2e721ae00f
NONCE: f975809ddb5172382745634f
IN: 8d6c08446cb10d9a2075
AD: 5c65d4f261d2c54ffe6a
CT: 0f51f7a83c5b5aa796b9
TAG: 70259cddfe8f9a15a5c5eb485af578fb

KEY: cdbc90e60aab7905bdffdfd8d13c0138
NONCE: 9d987184c4b4e873d4774931
IN: cb75a0f9134c579bebbd27fe4a3011
AD: 7dc79f38e1df9383e5d3a1378b56ef
CT: c6a899758b6c11208241627c8a0096
TAG: 7525125e650d397d0e176fa21315f09a

KEY: 819bc8d2f41996baca697441f982ad37
NONCE: 08b7a15f388fafb16711ce19
IN: 9b1ddd177d2842a701b794450e3c81f151f195a1
AD: 277c372784559784b0e047c6f8b7e9efb6f7491e
CT: de9b9c8fe09f705f558c62dc6d40b75e3aa625b6
TAG: 52e2d2f153a4235eb6fac87ff6b96926

KEY: 682769d52fa0bfeaebe0d0c898d3cda7
NONCE: 6af0738b249d09547837883c
IN: 3461523cd98a6e8bdddd01150812e6c58d5cfa25d385cdbbc4
AD: abe8302d7d5595698d9f31011c24d4d180a637597098361354
CT: aa3ecb46b9330554b36d0cf6f6ac4cf5e27bfd5f602da1b3c9
TAG: 0ba547961eba5c58726c418f51d31311

KEY: e2b30b9b040bce7902c54ca7eec00d09
NONCE: 28ccf218e8de56ea91422a25
IN: 483080d7e2fb42580dfb862d2d266fad9fdce7cdcdb1158d415f84b6e269
AD: 9f06fbe67eb2ace15c8011032feeaf72fdf6d316e1e08ef4cc0a176588af
CT: 67e1980ced4cd232ce893938e40b0798b17a1692476342e520b480a18570
TAG: 9994185d4329cfa5f4bbeb170ef3a54b

KEY: eaafa992ef6dbcc29cc58b6b8684f7c7
NONCE: 1ded022dbc56e9ad733e880f
IN: 900951f487221c7125aa140104b776ba77e7b656194933fa4b94a6d7f9722aad51b2fe
AD: 863ceb297cb90c445dbcf2fcffe85b71db88d8c935158f697023e2cea103ec39766679
CT: e0b3aaa890e45f1c39ad4f13ba7592f5251d6a02ca40fe3633651b35fba74a579f48c5
TAG: 5c95fd941b272bafbd757553f394991b

KEY: a43859049b2702e8807ac55b0ad27b0e
NONCE: bbe8c571342cac7fcc5d66cd
IN: 8673d6ee2903265c92446ce110d5bb30aa2dd1b1ac5558029f23974acb8a2fbf4c74858fc73d6104
AD: f77c998ad3ace0839a8657e350bed15ffbd58f152a0dc04ffc227d6beb5738ad061d0f83c2a26999
CT: 40e201a513979b093637445275b2db5ed4cb1fa050af0e20e43b21af6bc56dec654541e55b295b72
TAG: 41bbef45727d19ee544fba5b360312f0

KEY: 68fd608c8697243d30bd3f1f028c5b74
NONCE: 319a210b33c523d8bc39fbea
IN: 2c088f38f7a58e68bdd92632da84770303cd1ff115d6364479fb0aa706571f68d51be745f5c1d1b44fa1501cd5
AD: 1417a65249b85a918622472a49df50bdb2766aae7bc74a6230b056549851b3c2f0cef727dc805ba2160727fbb2
CT: 9d376b147620c2ac6a5eaa8ee44f82f179f61c9bc8acdd21680a7ff03acec953437a3cc9660c7ecb1204563944
TAG: 05a4fb5be11e3edd89e34d0b7132d0fa

KEY: 6edd3bd2aa318f78b4a51103cb08d489
NONCE: ef0027b144691bc9716fbeca
IN: e98f2f99680dc748fe0b57390df38a99950faaf555a888d463d005ef4e4b1c22663d3d3daa812b20ae35ac934c2e187cbba7
AD: 97337902507391de0f15c88462aa5ffc5e4760543850719ccd8a0cfef89484d8095c23ff8c1d06eae4ff6d758c95e65cc3b5
CT: 3c54842c2099b73daa9c3f1cb64bb913c0527955d923510f3f3046df471c1365db97333bc5a86dc7c5f23047e938fac976c0
TAG: 375b2a25421434e5e3a021d434fb2d04

KEY: f70482d53d3ef70cdc3cd3c4a37aeb2b
NONCE: e69d3de363e225749cb1666f
IN: 4cb68874e69125e1a6f6e68669b48317e1b361d0f7f95ec4cf613b7da2c835832010e8f95eaef4e6800b79bd86cd7cda869d2df258c267
AD: d72975f15721bd0957f5cb1edecaad2d1ef047afb0e779035f777f94cd7ed1bdf8ca9d4f357d2a1e195f195e7483dea1476133235f7e6b
CT: caa1e48decbda18e314057c5ec32f8733a5cf03ed0d05c3654531bf56faa70751a6c7f70fbd7d39f7e9775a772aba8fe7731cd0230beab
TAG: 47d909cbdd1c7f8b485fc3232bb7185f

KEY: 98a12fe16a02ec2a4b3a45c82138ae82
NONCE: 4b3404684825dfcf81966e96
IN: 899710fc8333c0d2d87f4496436349259cf57c592e98ec1e3c54c037bc7ef24d039a8c573ec7868e8ce9610b0404ea1b553ae10cc8cec26468cc975c
AD: ea1a99cee666bf56c8c3667ef4c73c2e1e6534800d6e39a97de3bd5d39068bb3e2f74f96c03463afa18f1ee88c21209bae87f37e5d0269b68db370fe
CT: 0431b7fc4889ae401eab5edba07a60f9682fe58419d4140cbf4f20c62d79d8a3cc1f23fabead0e96e1c8c90929756ea1efab508336e1d0ed552eafd0
TAG: 01053ceeb4f9c797eef9426930573d23

KEY: 6538e8c8753928960ffc9356d43306b6
NONCE: eee386a2b1e310665e335746
IN: a92eb9a93a90fdbb2c74dea91d273a48efe9582f8af7a4e3a377b114770a69ca45421959fcf36107815e53dc61b7bf018fc42965fb71d1eafce0961d7698fabbd4
AD: c5e572e464718398374c8b45ff8749cd9f517bbd97767f77a96cd021176c49c0acec8b055ef761f49aa6d910375a45b2f572cd5420b99153971a682b377ac88f09
CT: f36353de609d0b5246f64a519d89a4dfcd9d53325a2d2cf910e7692e68391b0357b056b944e0b53e41568f304bea8822f9ff7a0375a5a8087509799226862f707f
TAG: f7f9b891089d02cac1181337d95b6725

KEY: cabdcf541aebf917bac019f13925d267
NONCE: 2c34c00c42dae382279d7974
IN: 88cc1e07dfde8e08082e6766e0a88103384742af378d7b6b8a87fce036af7441c13961c25afea7f6e56193f54bee0011cb78642c3ab9e6d5b2e35833ec16cd355515af1a190f
AD: dd10e371b22e15671c31afee552bf1dea07cbbf685e2caa0e0363716a276e120c6c0eb4acb1a4d1ba73fde6615f708aaa46bc76c7ff345a4f76bda117fe56f0dc9b939040ddd
CT: 049453baf1578787d68ed5478726c0b8a636337a0b8a82b86836f91cde25e6e44c345940e819a0c505751e603cb8f8c4fe98719185562794a185e5dec415c81f2f162cdcd650
TAG: dce7198728bfc1b5f949b9b5374199c6

KEY: fd1dd6a237a12d7f64f68eb96890c872
NONCE: 459ced97ebc385ab3a8da8d5
IN: 04a9709fdc0a4edb423fe8cf61c33a40043f1a585d5458c7512ec8e4e066a0f95e2e6609abf3c95a5d3ae2c738269533855daedd92eca20bdedbbd5677cd4eee84b7a1efae0904364f1e54
AD: d253b829a2fbc5877b0fbe92e7b79f38886a49ca889ae72b91f2c3aebe257a3ffe0d390b5d320bea22d6a5536cd9213612f5ed6e3b0ea33ac91cfee284cb25eaaf6b85b15f7ca894317182
CT: 4a565d3ba4f2ec461c9bd8dd0f96bc00d2a561bfb56443c8cf47681bdf1c61f55854bea060c4219696cac79c09aa9400a7e5c59c6b6ca556f38c619a662905fc5f0e8437b906af6138e3fb
TAG: be5f93201d7980af4c5bceb24ac1d238

KEY: b09a4d99112e1637d7f89a058988b417
NONCE: 74348f7126c0cac836e9de5d
IN: 6b3c4cfd1eb139b62d91ed5d1d8b0f3b52278d5c48787ce46f12b9f026e3eed1bfbc8c6684c6662f06614c69440b3d7cff7c46b2e4aebaa4b5b89236a3cc75535bc600104f240d01de91e0fb3bcad02c
AD: 7883ad259fa5d856ce283419f6da371b444b9b64ea0ddb371b17ec0a9ada27b0eb61b53bd3605f21a848b1e7ed91162f3d51f25481f32d61ec902a7f2cbd6938a7ce466a37e4467e4ec2b2c82b4e66ca
CT: 5e1b783b20fd740310333eddde99a06b5740428cb1a910812219fabd394b72a22a6e3ca31df0afae0a965f0bc0ae631feeaa5ce4c9a38cd5233140b8557bde9f878e65e8932b9e3c3f6e57a73cda36cc
TAG: 784b73ee7824adf7279c0a18e46d9a2b

KEY: 284bd8c4b5d7b16aebce1b12988fa1d3
NONCE: 7ff05007c5d018b17562f803
IN: 903416331583dcbd31420906c64dc76e14d0c5044d728cd9b605b531ddc350fdaadeabe67d08f0b4c7179f82a1044696716cd96459506453141e9ec3130e893d8c2ff9b8b4c241b73866ca4fc1f712d17d7a88bf4a
AD: d0a1f92f80094c1fad630ca584edd953bf44cdde404f22c8e476df8708a97a0712e7fbd8054caa7d65144d0be3b30442d0dfa5469ba720afe1d00aa6bb53c79c1c178ed42fce596eeb6c638c8a8dedf76a431976c5
CT: 9bc3708f70a68fc16bcc33099325c821a0ae9a2fd0a6a98382fa21b42ddb3a9ac6c34a13c4805d3beb92586cdf0f4dce3885793d49abce33190685e7009a79242dd93594722a1ceaa44886371c30bcc8312fa2bf67
TAG: 3fd8a4d760d5b878852b1ca2d34dde6e

KEY: 6d76dd7dea607a5cf5c21cd44c21a315
NONCE: c1d13e56b080a500f1cb80bd
IN: cb959b92e777f835afc4ae4149b190638851238b7b13c9bf65343adb3130e8ad2356101037f30997d4a5fcc0a1d6415210179fdec881236a799f6e90dd43ea3817819b432611eaafd072368b9c7036c7a88c8b7774a8ed986134
AD: 92a2bc3b6b6ca9de0cef10d8bdeaadf6f54782cdb2b09e66cce8cb5b56895636e982f7a3c7bd9d221ade62c9ecf68bde70becf683804386606ab1c48ac764c4e11620064545c5beaa5911c118856dfc5cdb8df50052b01762c6c
CT: 522ba9bfb47efc624cd8933fc9e17784919d2b3ccfaeec46af414c1b316355f65b9f9fd7f0be6ac3064b4016e43b8fb2028459f0fa0d81fb6656be0ab8fd841d05d24682b4a57c7c59d89af384db22c2f77ce10abc4d1c352a1a
TAG: 5ea4a77381679876e0e272b53519d533

KEY: 1dbcbe45a47e527e3b6f9c5c9c89e675
NONCE: 98f2da8ed8aa23e137148913
IN: bb23b884c897103b7850b83f65b2fea85264784737d40f93ecf867bfdba1052f41f10d2c5607127da2c10c23b1fbd3a05ce378a9583b1a29c0efbf78a84b382698346e27469330a898b341ec1554d7bf408cf979d81807c0cc78260afdb214
AD: 46f1bde51f6c97a9dae712e653fcac4da639d93a10b39350956681e121fb9ea969d9dc8ef6ddfb2203fad7ab7e3ef7b71eb90b5089844d60d666e8b55388d8afb261f92b6252f4d56240fe8c6c48bfde63e54bd994ff17e0bf9380ebfb653b
CT: 0d90e869d2f4c85b511fdf85b947ba3ab75c6b1845d8191634770413d7574a6fbd9d86897cb3d3b5d3d8e6f74fac3bd2a9b783cb16cfbec55dd7d2f7fc5c39fe85d39bf186a3fdd3564bc27d86f4019ae0cb73f5f516b602331433689c1b08
TAG: 8777f2002d5a5214a7bd8ef5a3ccfbbb

KEY: fe33f47136506e5cc14114eb62d26d64
NONCE: 9534a10af0c96d8981eaf6b3
IN: 3ca38385513eaf1fcd03ac837e4db95c0ed1a2528b7ab3ac8e09ecc95698d52b7d90bf974bf96d8f791aa595965e2527aa466fb76da53b5743eda30bb3ebd9f6a8a7721fbfe71fe637d99a7b4b622e6da89e0824ac8aea299ea15e43250d2eccb0d4d553
AD: 50b7bd342df76bea99b2e9118a525c0f7041c7acdf4a3b17912b5cbb9650900246ed945cfc7db2b34a988af822c763451ac2e769ec67361eded9bcab37ac41f04cdb1d2471c9520a02db9673daaf07001570f9d9f4ac38f09da03ff1c56fdefe16a855ac
CT: 927fe3c924d914a7aae6695ddad54961142b7dd5ff4c0ba5ca3e0cf3d73bdb576afd59bd2b54d820d2a5da03286c124507a48008c571c28a0ce76f0ed68dbac3a61848e7e2162be8e0bee8147b9bf60da625cdab8601bfb37dfcd165f533e94a32c26952
TAG: 9bd47a4a2acaf865a8a260179aabf8ad

KEY: dec1b34b7b81fb19586c6ec948ecf462
NONCE: d9faf07e72e3c39a0165fecd
IN: f7b0bbe9f0ff4dcf162792e9ee14d1ed286114f411c834ad06b143cadbbe10a6fbc86f6664e0e07ff7c6876d4543e5b01ff5ddb629f896c30c8cefd56c15d9f24dfd2ed590304a6aae24caac5870ddafc0e672ac3aacae1867891942998c712d45efbfa4d99a8a6f03
AD: d3c4fc4838cb3cda3937455229ddaf1cb9102e815cb9f519a5434677c68b11a0bae1280faee82f1a5bee593e669e6f81d5ece3675b8af63f1491bb298531aacc940f53678ba56ae96fc66be92b904bc35f2d5b68b3ed98569a4d04e8f8a9689ad9fa4b51db0938a9f3
CT: 2f44ecf549077b98ba551819538097bb80304a55c48ef853e20ed8c3f808dc8cb5eb41c2463d19fed2606b59cee4b458958ea75715f7654146df4519dc63524a0569a00d7bbc4b32a372f82d955be5f190d09d35c267da1017e8b16096ae84f8a671b45aaf0d1ca59c
TAG: bc3af80cf9388d35deadecff5455d515

KEY: 021add6030bd9f3fed8b0d1f16f83783
NONCE: 4e460f51fe6b5eb9558c4571
IN: d9aa1d0db5de536cfbacb59bb75c592ae3f34a5f9c5ff4f22d14e8e4bd0754af19570221893797f60c89a251cd6a19c2953662dca51264afc21099ed5c80077b0e10a5295b3c4c6fe47d3c1c84fee69ebf7d8a7d9b1b338dae162e657e6cf5277ca70d47b9290aa7efe67b0ce574
AD: 38d99cfd7578d40ffa1749d5fe83500362ceee76c5af38935806837b2f2d1b3422a5057bf617b07868dd95d8e5f4a24e74f96177d53a0275450b429a2b1f364805030765e376151ae35001d6a4872200142fdce82017f3e976ab0edac1a08d2649d297648320e7dd9143b554fa3d
CT: 8863ad51578fd1c9dc40702e34236adee885955f0478ad9a094a6941f95f900e466882dcd5b86e1563ba89aa105f56f3ba5ed860ec3338ee1b750a2f9332acb3f0f61718de7e40fb80442d046b35f147f178bd05362f0559a20a53ebbf78e920fe14c9d80d1c9fb21bee152f8ab2
TAG: 614539247fdcf1a2aa851102d25bb3bc

KEY: 311c2045d5486bfadd698e5e14faa58a
NONCE: f1cd8b373cec6451ae405618
IN: bd154e428369aac5c13128d29bd3031364939abd071c34bacac6ea7292b657b794b2e717d9bcb5d7d01496d805283fffd8f7de6a3493ddd8d1dd7f58835a44d43ea22d95468d1239ca5567d6c80bdf432fce2afc544a731a2852ef733667b9f8f4f8923eaa9de3aa32addddf99b607efce966f
AD: f70cb7e67b2842207df55fc7582013bbddff8c7f3bd9ebbaf43827aa40f8490e65397934ee6a412de6272cd568566ea172789a006a92e5920140ca5f93f292b47dc262cefc66b75543f94365c08795b7c5e9c6c29b7dc67b2532fbf8a6487d40a3eff504e75c3f2bb2cc3969621028e2112e67
CT: f88f4ef0431d0f23911aaa38a4022e700d3a33c31e0c7bdebe00f62ca3b55d358385de25ceb0538242871eb9c24530e557d7981fa0182436e1e49272d52689541f09517fd147a8da0f0d2bb32d54911a36eded0b87bcba54d6842edf461b45839df1cab5176e2c82c871b3be4ec1bced67ec5d
TAG: ae8d847f106e914ffadbdfe7cb57beba

KEY: ceab57de6220b2c80e67f0c088e97b36
NONCE: 8cf438aeb0cb29dd67506b9c
IN: ce2a7a5663449cf6e0068085e3c373c5ca6f027544e327bbc09ac00f1571268bee186d51a00bbc16da7429e4d3d5235d8d54ac96b6ecb2fb7d77a6e5b9e70d431dd4dce78ceb972e9e4b63059e350efaff841c2c42bc29c139b7fd070097556b6281b58e074d5271d9f66c6744ec6dd3b9db2f4a21aeeb7d
AD: 03e464d111ac9228d39d22a00120c6ee671fe5bbf462b1ee3fdf348b34999518998ac4e175ed48189c29b49b5527c27c43094eecbeaeacd3cdb48cd15aa82573e884a7b97bbcdad610a6955f7d8b04f6f98a13a907bc2bec4c940b77582b248f5fced1771f810977b2d0a4fa48bd4d78e4bc383bb92743fd
CT: 1fa9c379c78b92fa3c1e478443ae38d7b4b50235448ce2a88467514bc9db95844ec1baf4dbdbd1b0720e377d05d82c3b58b52af8c9c50417b39ad225e373c7ff18ac5a6ea5d182b255f1c8a2766e31e3e4e3d55dc08dfc64b818ead40a0e824b06ab24f0dc9f4f0c383db7cd4d40016b31701bb401b126dd
TAG: a9a885578467430504731d1a8f537e3c

KEY: 585bbac0ab4508afb8b72d84167551aa
NONCE: 774c82af194277a5506e45ba
IN: d788112213d2b8b5b66b056e8b3e344a7876f6193b59a480c51fc04d3ec2e5166344c833187b14117276fd671a20937a4553181c29d3d85afe385dd86093708226f082a2ea4ec3288f372c772ca7ceae86b746ff428e8add17b0f34f8553e3db63f55224c39edf41f138a2c28be49d56aa8b4c93502b9794a16310f78b
AD: a29665261a8eb58c88803bcf623dd1a14e76af49ec5db72a267f2ebcbc479385fb6b32bafcb1239515d74a8282b228e83daf282d1ab228099b315bbed0f0e6b3427e029cc28c025460a8bf0914bd584c13e7de7830ab77fb4a9258dfdc9fdaa96ca941546477f04cea19a365a27de34e23e154e7419aefb0be0e871bbe
CT: 24f2856e4e40c0b2b8b47e43d94c1faba498884f59d2ae1cdf58c73770279c96feeee3025ec698cd8f0ae25bf0c9fbf2b350674c317e52bad50aa6ed9845e194f294eb71ff192604af50ac7192f308583a3edaf6c7aeb588990be81b801dc916ffd621dd4016e2b76e9078c89fac9da39f3a88f6548006a48b0199a732
TAG: a5c8f9daa30b045bd3e1c1b01f438518

KEY: c5d727d159dd328b4160ff45a183226b
NONCE: 881c0802db519ce1595573ff
IN: 88b4be77bb8a2f37bc5e84ef9da92a4b8c3777dbcccfed13b97e93c19674c8c3f13119363ace377a14e5f36501ba9a3898fc09340886d91bf0a17ef0d028f2a92ec150071623a4a5db8e56e99e764629679943ea879ec7634fad1480e8617fe834c26210276d7db208b13f9b4c2060f2867aacb1b47c8e110830beff721dd8d120de
AD: 5f6513ad3d490f784dd68ca1df41e8c8e1ab9a240ea8e9bc22d0b1d7353da94d5d37c94f0dcd1a2dedd6d8e1c79a383e7e214cbb6ee2ccb7c6d894ffce5d01b6cf13876ae2648d36adccd88710d7d2ab6d43826d37ee0ee3b434972a2cb8f4db1c3304cee0a352bbef76f05de0e6f55a410eea5e697afb197f2483f0200d0abee224
CT: 66bbee209eb11c675ecd3303c38cf1087b010c532e1357732c4911ca9db78c67805c95c829194cd413b635a900a08454c6eb9cfa3597ab531fc9ddfdc5b02b290be2a618df7d03b1ab465d6d03e8b87a430bf4e80d8cb9916145cf2d2342a91fc79defa151b1f3c695608e76ca2abc4c0383897f1cbb9d4bd9969b2f33813e2b5502
TAG: 43daa08e6eac70e3238ce655adb65005

KEY: 16af56326046c92afca49fe173d643ad
NONCE: d32a935b4e56472d92d9f2ce
IN: c49c8e5769670384d23d9af9834026395d3f3bd32d88e61ed06b2e00e52a5ae4fe3867993c2af95203cd4006470a89677864431fb9edbed17412913bad4bb3eaff0fccaa150c9b13f83b9bf06698af844841a640d6f94d845296638ac27fb5ed87c310dbbd36415161310b284b8f84b4e025267906e0a4c822b76a682d44a70f9afde9bcf48ac2
AD: f713886f4086026779a7e479fa646cb33574e6c977d70b8da49c8fdbb395dc7c149a59e219db8e4fff053cb00e2a1df9850fce94e52fd34661fd3d4cd8ad3ffe0b4bc7ccfbbf42eeef3e30ce13cdfd77dbd067ae9f5aebfa068f6b7ae2c17ad956dc03511dfcc38eac9fa3c0c0e9a340f5c58e39d868b77dede54fea1173216c0bb8f0a6c2990f
CT: d5d7d1ed0ae3e3481e2ccee201857ce1f427734fbb4fbe82a2b90601104008b8ad4daf74514b8ab3e42b6f6b509159ca04489b1175ce1e3fe33d36ea521e0aedff8c69fd00aa588d7a2eb9d2d551e2b8fea321f573e2a1df147535a873d540a3169d3ebc099ea6c33cefc04a2d55dc2d47237b95ad269fcdcd3c3750af426beb4edfe7837b413f
TAG: cbe0fb9509c224bb0e8e33f7ef9b49e6

KEY: b3df227e6dc2c846095e2a3b825d7645
NONCE: 578bc24ca3845e23204df661
IN: bf69be81cf0b340b006badc9f644d10376f4f9a7a78c997edb8729e3786447f21e97e4c1e0c0c74e01ef655d0a84ffc04ff7c6712ad65adc9a0da2e3078d4c9e796c9bcd71e7a9da26b987990d366b5e00a23a93652e10942e07a6aa01375af27080c9cbab5f554497abc48260937a6fe895361e79cd3d5e78c1a65c6723d4a4fbe9b3dcae3c05699cf6d3fb
AD: 00898eedad307fc017917a3296bcedabaad8a505edd34e93d92f3b61797ddccf3fc31144ef70f255be3b0c165c97eb8706f14c495f4aa9b3f15d2dafd65bf6741d67fe240967efbf0e75e610db9a8f722035e039b5e9246d258084a04c12ee8ad1668032f8caec737481fd894dba2ef702d3e6089acbb0fe0bdd6daa2a5cd47fc62603499fe3ea37365072e5
CT: cfeb249551a695ddfec5f789e7f0a9f916abc8ee01d6233c32744c10a09b5b19ff9ed15e9f10de8f93c8ca1ae3c34e26fdbbb7f3b0f5f8b064501830d3cc982da99b294ce51bd33085c98b0ac0bfe44a8f4a5a26511afa3461aa88b770f076fe119ec90f33d8c9e7777f30b8cc95864f06e04dd8e328ad7a2c7dab83b03abfdde065bcd0c7d6dd47389108c4
TAG: 3dedd1054f1a29286a51817264317b83

KEY: 58a57f04d1d5cbdd1bfbe01dd5f7e915
NONCE: 47affabd7dbb4cce76661081
IN: 5f82d481a6a3856c6f0be2aca54d666f16de88294a4d763134dd51ef03661bab45da94b9871d94e5b574a52214b22c92cf9690ecbffca9b108fe796abed9e608778c0b99d7bea1daec08dae89d5f7229c04fd52cc906b5f5b9fc0f0fc1e0b2272dcf4865286ee22bd9edcce1afadb579ec72cdf6038cfc75c2dbab5a1fd64b6f8e200d1ad0afcf25863293fdb7276648de
AD: 4b662822b48005fbd85bb99e6a946eaa74403909f646d914a236eecc5f4558b60b2efb1584b1f32d936b90428dda6568515801d21d24d6fb622e6463897c70be01f81fef741d6dd5c6556d163c3f048abe49f21817b41850ce79d7ec1fdfeba32935b58d898e964fa4b36f79c0f1f560b0afec3887ab325e1a025fa7662f9baf8e08a9ee714b8369621a2f1e6d2e96896a
CT: 31ab08ce0aaa883628f4b33369e5f6e5a54ee4a6596f25ecd54eeea30e81b41d357cb6c671adb6acd3d4e6654feb2ab1f3259692502efb33c5121e0852cbcb2dc5d9a4c65752debe9c4bf5e995fc909a2881621d46cc220806703795e61c0fe74c99e3c1230521b1f97bcbf4e95326e2d581f0cc879a2fc06ef88226a4413f9e9985edc913c418cc198c4df13cd46afc24
TAG: 1e54066c6cc37f35c62b47426b609457

KEY: 64011470970333b7b677d4ad8ebf3ea2
NONCE: 17031c5133a426d96de93123
IN: 882cac1ece2d22a1db7f8339332379eb68516c8b7dcb3c089a5bfecceb49f48a169215313686eb5708135f379d89962af478cae865841e0c97ab47a57a456f634282c4e03c99abf7f7cc4e8360deb48160288f06e96cb09114877f9d91dae98828285626a1528aac87f39cfb8ad3db344fe4318aeef6f6ba14bd1edf9caab548c09f8eea091229a90dbc4b0fa34fda2bf13d300a1f9c
AD: 0394bb920cf58806b909d90c046402c745f6876af85d8a281081e22a1908f8475126594b39a0e191a070bda7c78d30dc4867e69ea522cfc962fa5f9915daea9133e998eab22f32a18957a3cf7d91c6f3d54cea94875d60be694ee841fef01e69bf5997ba4f25e846558431eb592605265f235211c2bb2d4807278f4b9c314039d0768df24e9c098c6a01c689d6a143073fb1a29f4400
CT: dd347d6a3d4a71b2bcae0a0c690ca311f012c6ceda4f7fc054b8f9b59bad54237b64b93331b99f1305801640a68e7d50cef581a57ff2564c90995a8dbf57fa8cff046d0b946af5f68e0aa3d73262965622fe6d35c78f949a6cf9e4f62ba71accbf403b690e31f610305faa6737a19efba1e1ee97084cff2d125bd69a5a4ff99aa399df650452daa835b3e54114b295f00d94fc60e2f8
TAG: e5e72cda6755bfb3a44377945adb5ca1

KEY: 4852e546fdea545d7dd12493a687e895
NONCE: 7a3e136cd961191570c1b0b7
IN: 30c10d7a63b614bcae1b79b07c252dc55f322554ac34ca664910fe4a0c9a33e30698e124d91cbb55cf34e931807cbe591a87667f2284c1c18dacd108163aa7a82e274ae659c4ea144191e3fc0f82d4cac929969a50b98ed9fbee52cdf465a1f0535d7d7df15a9a6eff3f4a14e254571cc47f82716d7a835dfa839213677c4da8c8623517244891993ad5956f65d318d9bba16f1eb54d2974a741ac
AD: c5ded7f545d2eaccbc2cf5cbd1b38b0ec3b6bbc054ba25a16efdd448e5a47b0085974e469c1b0df22441340170d6677f5158e4ccd71446d7ac73dcf5fcfe4ad7248c4ddcfab4c8ccab0968d74d66d9c9561650eb98c088d87766440fc9967e8463febcd12ed07f7e44fef47cabf05274002d0014c4e31f230a41171868db68bf5a83c902724397ed181dd8c6768a898e0c78f6aeb886df95442e99
CT: f798de4998683da7fa9ca030a23dbc493f36c48bb52cd1113c3ea97ef2b67433c00195000777fa3b75a3f689a66b148159524a1fe9576587948760b279cda56164a23748564ec66ea51368ba2a900c97169eb33cf1e557f46100193575737dba670175035f0d921675d45415c6591cae079698e6b1f74e82d4b9216c20e907b148a1d514b2cf653d2e4994f7f668dcfe88dc49c29c544de96d8dd0
TAG: 3663fb2672223154981b4c580ed3d2d9

KEY: a65b520a2ab67a24fb8fc669c41f2753
NONCE: 3bd6c7e8d29242abecc4c108
IN: 9d1559d283f7a38847088116f2156b19a8feab0731f04d0d499c6b0d21b8563a89a9c284230c1298b28a622cbdd38dbceb098ab896a7259caaabfcc7b0d9ea797178c18aaaa351c7f516342dcb9d3e91405882c8faa9a28f7c67f3db8913b31c0dcd56472d8ebbfb20cda2896a66bff2706b12ae0d9bc8c6c123c02f1f0bbaa418c1806482423eac72d718cad0dbccd208eb81663a9d9043d6ae7a52cf32b1fa
AD: 2538529cc6eec03f70df2ab085027ce015279484981422f31e58aeee31e79703d72752af2b8822dce9b385f1530f19e692e00e20ef973d333f4bd585ecf122bd4ed9b0626cef46baff0302c71411d27e372361f36c7245096faff21f0236f3dd675646760d5687b3cf1544dbcaa863f1267bce04bca976616b890c7c6ff3448d16072c3938f9b62377609950ff7818cbdd21fba2560bf1954a93517962181b18
CT: c3194fbb5c319a94c0f61c432a730ce7611a005cfc78266ac4e5d7c95351e71d613f06f52d9d008b9d886f4d9a57bcc232d47e0c75ab755dfccc057a9c7558d7fb696a8c29843a8b9199e2406d23cd6507d35a872fa54cb95e2cb9af45405ebc6b6ee353e8a80debc393329bb9499c61c6344a6380c118f30fcd76376a9765517652e1b21ecafa63c0d19c1875658f1eda89c15ac2daf1a6f526ca72ee792a4f
TAG: fc16cd532c926ba01e2e6b15327bfb3a

KEY: 84215d2c8f86e5b7bf93cb0620da6bb7
NONCE: b35e99ce89dffd1ec616ed92
IN: dfe500919f97713f6d9c4f53913175b162b8b7587d85d5b63f0cd5f51def23119e2e02c224142ecfba7f0a519aaea3c28be20b9c2a9c98eb145afd4db523b7f0b822e67dad630846b2a192bb146dcbeae00198c81b80c290d881125c24a6b01ec901b8912bad5b081ec7d97d6997b33052ec287f692489df928ce36cba1e3d6a41cf10c697a9e1f4aaf75dc5be054b98965ec3ce173be7e127c4c5387048ae6ab5a8d247f3
AD: 6bf6222e64a46c90f83f47305554d090bc8d3838b7a856f0e5e1d92c4e7231eda6af1d9eb7ff6ce914f2256a3b0c853453b9bc75e46109cf8d7e8a9dca224e022d3d1a139d00476775622799541edf9d53eb645a40f6d98ea559e181d96e4df0141e51fe067542300581c0424f534d2c2e3b1b27153c0cd496a1c03301226beeed2b5cce0710d1f485e68b44a918b63fd8db610c7ff894514e272b6ed7ae33a38907e0698b
CT: 6c6faa54df62ba5659d45f64a5f014684138c93bf152da8a495e9d067b13a30b9fb84847f56231b2da4d87e6cd509a3e38a9ff47589c627e5b5a1196e27fc7afaa14a8432c2d10d8fbfd5d6d394e4b947c456420708a76c2aa638df7de119c160636fc8dfba32227c5de12e5ef429da933ab04e77b489f2eb761d0c753738647ad6793cad64b8942f621ac67b13bd0cab106ffeff21f24c79de69424e50ae550f2241d4029
TAG: 202b232472d050b9bbc68b59a0c02040

KEY: 7c02b6bc3db61e23736c5f36faddd942
NONCE: b958decc680d5f79ea7b8632
IN: 7e5992ed0474f4224b8da1d038eeb78413fc2f9614fab7120043e75986a4bf1114a80703780a149fcc8dfd115b768f45917065c85176a3f00be40b427fe3765d3919a5b741708624e29bcae876d251fd46dd8d36a8ef66f671c25f984761cf7f75f4329de7093937cdabe32f130b77531ab1aa0a1bc38fbe2758c2664eded828b2589fc5c34d9a0d57a5a4463163736f419b65f0543f50207fff4cf1065a551bc00ffe9466538b673b2a
AD: 76e430fce1a7d8340104e6001f1c2048d457ac335c5453e48727244b75c3c4f04f55afbb5ce55ba6f8632dbc168ed715b83968a32e5b8e91cb24abc9efee6dcb7a8bed9394a546f0b9efc5823ecaa192df061eb41c671bd863498c2130f322074a711ee43791a1cc02b5cacccf25119ecdd99233abf3b131c83ddb8c62c93a0d653e91499e7481303adc8dbac615ec464eb8640ea138f6236b0ee31cea060f97ea9145a22d15e28eaf6b
CT: 14cfd190ae0521f94ee6b36bfcc403139782bfac3d33fe95c81f53e83c7d0c9a8fdebbddd79746b550a383ece1b5c93316b2fdf5aa36b4e97f739f78ccd2de9963ee7fb4d77b581cf676bb679b2dc4a48d977b45564f21181dc60ecee84d736f2324196c20327495d18973660ccb5dae69b79853d12e48ee0706c8ed821b7f722e46f35c8dee2b7b55ebee01dd3ea1e8ef80493cab6b27c264a67596cee06c15062e3a96b140d0d9ba38
TAG: b6c47410e6f4a2f2b172c6a4490732f8

KEY: 1f58ccb33649d0dc91c50f2aedc95cbc
NONCE: b3a392b1fff0157e95f82a44
IN: 738e04dc5a8188d775262c2cdaa04468844755dc912a4edf9db308efb3c229b8e46b2b34aee2c6330219bcd29d3493e3cead142cef5f192b043502b8a4cf0419f9b3f5e001a640541c84141e36d585b05a2f702356bd39bda518c42b461564326969983d22c3ac5a2aa214807ede803d57a61c9547505dd7e08402cc43e6ed1574a48366cf5b5573afcc7aa3c4d4721b362d20a58cbf251315f2b5f9e2c97c5ef6bff44beaa5004e5b7c7f28295df2
AD: 93f7f5054605edc769efc30b35018ee6c929a83bc6454352c69ba9c72e4b4ea6f51c9ed06f314b5682be6a701c719087765d0a7022e5c9d495f28a9053bd435b8b834045c3670856149b08dae742b372a15a0184375d50eb09877bf94f63859e64228606791c516e76c5695a4e529b9dc5f76eff1d4641a22597e4460aea4eff107348077d4ed2d6262744b0a2d6610f25264d905133309ace10bb52f7138674c25e5d43ededbd87c13dc8fd9d3b1b
CT: a002b47b18d1febaf64842fe9011484d618a2e855c4efcccc7d08f02dc9b53d0bd4fc8013e01e21fbf2d9bc7fdda69e68be0c06d32003d045dca6bd251c0bb8c2cbe3693b252265c8694295772b767f83661ecefd57353f6f1c442f9d21ed98c55cbe1db8171ef7b54fe3e3a1a253b4dd48416b5fbc7c18d73692e9fc90dc75d4b88de1fa47c9ad33ddfa4e582d3fc61ca2a8b1eab898b9992c8e56d170730454ca50cd4f28d2759388cb8e302be10
TAG: ac502a9a52fb3a68a7e90dc639c7ad42

KEY: c67510714f556ea1744af9207917eb60
NONCE: 71b347a21653cec3d113087a
IN: 7040fde3513cf7f1886d7be9c0f371a3b75415e94c3bdfbef485081199bec4494beeee76dcea05b6601ebd4c8fe231fa16d3b0f046eb3e9c9ed8baef25bb0ff6bc85469b2eb41b929fe904735f819b241b01230c68c0b61577899426bf0dd30e085cccb4ac290244d8c1cd7514412a3ebc51aecb6bb4be1a5a4a8d2ff3fc99191f7d7d0b44fe2cc4ec34deccf901f54e3dbe19d2dfe663855fa9d93a01ab14faed7f00c14834f63e1d153441c6fabb3cf22506e8
AD: 6d28b410c788dba025c387f5b94c0bc392c69ef646b9cdce53dc169326359de26a721703d9a7c5017631a469da13b2d9ad9115de7d06922ed6f093792ac25ae2e27993ad6be5217dc4f6c51e18f230d4eabb01a474704b71b1407d9cff921bd98e28bb60c4fc019b4d609667c747e83eef779ee62000b6800ba2666f415dccb12d43af4f585d3185d66ba2ecf0b0fcddf762445dd1b6154591dd069f03977243b45b113b6f9b110f9fdd96f0b74e2c9843a45c6a
CT: f2a2cdb4f890241f44e00b3373769542cc3dd24c3d07502ed162dfa10be9906871051b991f36b2d5c4240df483c2ad704be14b9efe79ca704e8eeb9dc250e75a92ebf5800c59fb9a6a32228fa1121d21e0b423b77e20010d36b9e6c68dbc000f69bddbd521a1f7bbc9d7e431e4e46e5094be96a928c6729293d2d805c468a3993fb7439f192b1142272a78585e3b7fcedd2f7cced52ab2bc42e2521603b89ba7633fa3b4d07d9a314d1159d7bd5b2dc5198b0c34
TAG: 0b386c3a58ad23e9a45f00ae107d319c

KEY: 171d25e195bae2eaf666993f3b42d690
NONCE: fc16bde0c69d5c894642f1f3
IN: 8775d6aa2e46ffea6ad4439000a968bcd4fce86535b7265684071a498e0bfb37646f56fad79e0fdc4d6016fd1e935dac5ad74b11c69f5261c3321efdb9cf03f9b7ec681a7f708ba8e3f66648b24c41485a5147df31385809c800155d0d4bbf41d248453302c3754eed4909b267893309ba5249588cb4a4a14b4a29496f1e799559ac9f4baba7a9b4cb5bace1c11dc0e7ef7a2ddd2596c29cdaa378b97c7d3c50db49bcadb8e1840c6b9fa12ad88c0b8152fd753efb04ead427
AD: ebb169a863dd05cffb9deb866bdd130a1c6852046881f3f8e9013158c83bfcbaa98743957ed4b0619eb88d7ff69b3a5d06da74076c3cc2dff83dc0375236d363c0e2b1fb60c9cf10ecc0fec94757b1b719abc7066af15ff9b66788b38083f766d67005369319967995407ea20339ba27e7bf1dc263fdd54ddd8088232a500f605ba825fedfed69cccca75c207b06594d1d0070ed12a259d4f574f352d2e2ea6fa45199213b6a42d53a7c717250715e0404f2fe7b64e3ec7e89
CT: 8694eac2bb3968303f795bf0118e43c132c9dd22ec320ecffefbe878ebe6b1e0833d19515c07ebc83f12cd9bb50d2658e6d7fe44a9fbcc2225e93ed58e1bebd78edecbe6c8b3491eedfdcc957cc8ddc95d8116d50cc50b1999ac420802605cc652134ce51a41533e00fe232344e805df146a952b40ce27a2f5c6bbba2154489ca40cbb617476ce6ceac1a6b9c0175ee33615f252377f52583e970f77795b573610baf5cbf5edc6d2837244f88bc155f71588c9c4c1c802be9c
TAG: f6725998336b3ef020b99818e0d932ac

KEY: f7db0fd345ca6ca82ec8624950f8e672
NONCE: 3e7ee1a209b1a191f0a00370
IN: fa86869e14df0fd8e77eba7fe5a933fd1bc58654deab310a03aa7202a089713e323a323f4932b4b8f6b40982d6738aef48951f621aeb82a747d290d93d1eb5bdec6a62fe66774209a4aea7261acff80af9512af090e0eb0f5905ce8baf2a0ec50ed89906d8d67f370639e6f16eafbdfa982897cd5a3f88929d7f1032a8b3355223bf666be94ba9945fb5cafe655d59af69829ef92365f54ff3eebc45e01ffc439b16e23ce892ba6db7e661fc3676a175a8ede746000ca147db57a14303a1
AD: f7b826afe62356f985e8e10ff356dc9b5b9d9df24486523c3bab7db355c84ec7e4bbdf66482b74fc6b4c6aaeccd7717fba44eb4820a40f03639076776719ea7aabd3a815c201146428bf4c6bf1e8b056b5a22ebcb214fbba64de54089a20ababda5c860ec301f36e1801fc55fe8fa189f35722a2cbf83ae921a9537be2b4f060d918af9b12f9111909d59db7cad24418896ce49762223d8a20a3a83fdf24b64703c19c78f528daecaa8689f307da7fe0befa1d6b1bef24ac8d9f5f12b6c1
CT: acdacc648833698eff4d42a5dc0b123cdf6f2985ef05e6f2d42c9cd04663635d240648da18dce158b21cc0a3f7a2c35441799a4f1f5622e11051c874b2bcc64314bf0b94c2589d2a24d996af57d22085a64f10135322cb68428fbb951d8b14683bf6fc96b1395829a0b05ec83eeb20e54daf7a413e070ae1e0b73bde56faac630363fe215f1883cd9eef9c3b7d076bbb56f6f5ffcce0d31570f79be8864482b6b3666424dadb674f873a1b52ae6e3d8ec8984edf54186e38c71602098308
TAG: 4dba5b1385565427a987c9d0b030f4b2

KEY: ca80ac4cf4057182d06d65dcdc09763a
NONCE: 63cdd8090e041baa9dca5bec
IN: 701c739ba0c146983b9e1fe0a9723850caeb818514860c3d4adef10dc5e020a8dd7f2fa282896170f9039d5b3fa629dbee3bcb81db44d0d68f9522477619269a59ec1a9ed399d4902f25271dff5c42f3747ab0f4b61c26a2c1bfe1c0fed02282fc2ef88b47825cdfb11df3ced0fe0227e8264132dd62af2d31f23d0c0e253f01c80400127c37806762eb28bc71f31807229172c78ae994b4ad800d6247ea12d3f4f902bb50b72c132902dd4faee05e67836facc7001c8f58475366668ed20d4899aec4
AD: 0e91b38fdc70951b97e43aa9ea2c6f78d445d90ddf4faabd3e6e0ef74f528fbd5c3d4da18cc3d8bd3167b756da495cba49ea35e2db849bc37f6db8370b492d7f82f2efafa5444ac62835cb5602796cdbe85caa50084e51eec2651996d2da0dc18fe10bd6f374168d4c9ea0a36ba665148192252ce9d05cb78429c55256fbb65f1bbffb8799d63bf41701d1d706a44e3f27eb245cf720f2a329ea24fbea803c575513830fff579a1bde3daa975eecdb8d3956ddd374fe252637aac86ed3c702c4ec63e6
CT: ca46eac0addd544bb45a97a4989d45d21599ec70f843d9db38157d186716dc39a5d1a5c0624e6c825b5b7f1fd41aa542ac846ec0edfe6bc28f727823667a33cf6cb5ba1ba6654cd023857c53ff00a63b34d2c17ebae5d46dbd073edb7b2f9e02842dbf663bbe36238f3eaeb7a23e328b0d3d50f49674253898f360c0243722af266c934f021e4f2fb8747fae728d06717b2d68cadbff762956826c910cc8ad2d4aea4518d5ac4deec978a13072fd1675a272539ebea31d736c759227f31abc911e0e76
TAG: 9f0202c228ec48f4be6b2f876fd05a83

KEY: 9c2daabcfae974ae165a2ea58ecb212a
NONCE: 4b9317e4be2256a467e2831c
IN: 09169c1f5d873f03821393bef013bbcafcd82314cc986675922e2d43031417c8e65e625ce737af4621aabea6fe75030b84acf96967e791f8427b8f052051d6247a897006c6ddedd49cb7148afa5109a561e78abff7c55b97091f356e31b5667270d5653a497e2503d75e5856ac1efdcf3fb6e80b8deba8802acc064905e2b09d45e446d7d810971e5996540ee9c01fac1b4331f99ad329565a8db38eb93f2e2a8ca37d64d73cc8a7f4fe3234cc155226393f1f2ad17d0f01d5e60537ea44835dea853e027dd597f7
AD: 1feb0ca13b3022456a4801d8f5382cad95f7a50e466a102d2208e7482dc8ba5c710d1721de7103000fe8811bb13fdf698844257dd164f1e21b0707251f228ca8bd437994526ed5684c4165c9754d1cefe7eb18f9e116a455c28db1f7c04feab74ab06af029819f51ed96f453fb6a634f73ba8c80e19dc62384e82feac70a12d42e3125c360ec2a97f4ce0a07039687ffc37c5dc1df1ed24f05a37591fcd5c34a3fc5f825c79213adbbdef65078f5e41a4062517334a67560ab215fedde53cd8129a51f27baa80f53
CT: 8a4d4ae0842f8032d83b2e4eecfaea439f745f1d0d07808bee4b68e3b58fcb65a4c8fd9b93cba2d5b4781d28a9cc01508e9e85796551064867551f9083cce342ba1aac4d2b8f5b0b0e4e3d7c82082c441467e47aa2b0f47e167b28fd29cb8d5ee52c2298c1f87cf811061d922f056214346c1ec3d2534045c5c485ccddac7d9998d3d08a80a62eceb2ee18e1a27f97616969df52ec486015974f160745667d6be25ffc20b143d89bcc8b6eab9dff82ce3c8f95a034316a8f2f2a52674105f1246b2daa28edfd829d
TAG: 0361e65b1fdb9d967492ded32e1fe811

KEY: c98ed84949749efd2ee41eaeec51edba
NONCE: 7b056c9c7b393b0b04382946
IN: 41b87fe62c82bd34cbdc70033ca8d2ec5f13eb2c14947f97fbb5d97da7323f8eb5c2eba210be11b1ab9554feaa516aa493822af4a264c8849e9c6ff41f690f44966bb49c9c1df5995de8070a2fcfa42d0b0b5115a36738102134f571988ba4fb210edc3202d3c74b5f8801a7d1e217b90caa27acb49ece590ebe6637fb6e2f5f0b849f29804efdeb8c102b3e3d2abfc4f6f2c5f71f0a6e4d5daa5cf16561914f14601edc40547d55f7d11eb4768d5c64fc621d04e8c64aa3aa1245c7192852d2ccaaabd448e06f806eae66da1b
AD: 2fdac5a70356c2c8d70def497321c6bee8ebb08a5abc8dd508d83f03bf1a09942d7f7a387d4f875a1ff16c7b5abb53d32bcc372012eab7a3b848a93f7af634eff8c5deb3269d418be698a3026f6f08f55a6e31543105cf1ccf56193cd1af802f32e10512a6bcd3101b7b54a8f3efdba03018d5f2475b51bd65e5e183a62ab11c9462450883e3e87a9640eac909f72b83da8bbd34431ed87d14c6f7e79957067c1cf2a12b5fa083496f903269a3c6c8ccd5e3f9cc287904223ee62bffc4f157f0db409e82101e3ca5e05d962378
CT: 384ddc8e7ed6868aa722f6785fab15eb69caadf43246521b97c8d016afd976360365bbfc9f48c08b0eaf5437af8a9c23061dcbdd0d22e1d58c92951b43e013689afa6b1587f79fe9ad3104ee1f80b3c95388e35b0b9a5a3b733b32a3e62fc143e6255d0e5b1b55bc9439d3c1cbed610d36c3667378bbc1ac20d93a5a7e5563409a5b94ec799a5281213d724e46f4987588e6bc7e9e6468bbcf340d5f1a1eb1b45dc9fe9c832befff54c8a85db9c07196d7d45cc389fc9d62f4bf1f4bb82801cfa9c408498331eef4ae1ee2809e
TAG: e8cbdc1d6d51ac64f16cf08725f81370

KEY: 42ece9aeffc9d2e8ea02e73d1a4de834
NONCE: b59e0770c689d60823c06c69
IN: eccbb9a2c1241c88d17204cb0f0c069e20512bb1d31f966349add203d84cbb79d88f7add957a0a8370b9a0e04c9f17215531cd48d08c4612bbeeecf3dce68d41724166e06a331e7897e8c7c6a6affb7bf07dae1874bf3bec044d38227bef5c228f4cface9ea37255e15d6b27e154b349b16048b0e7984f17cffa03da07924b190f9b91d6222db1124c1e4e77c2b989fe2a7c338c7316a49c7df0be173d0420e8790bad669f6da96745cf34cd2eb429d18eeb61a8e80a5e03294dcf3a5886bd1865e2a55a72574db8db04a9560f969711aa7a
AD: 2aeb8ee162a7aafe5a72a8d8873ce3bc43a65fd7bbdef1f6ba71b61e5a9c3bd033e7e8eaa55e08ae381362ad0991d65bf22c99a425019c4cd7768622f108f5917a4be22b4ab65ede66c58191e402f8cdad69decf6552dd52b62e8d62268b84122b64145c97115373a26d2d5e59e69b7dca5f96c48106e9fb3f7fc7e0ab11c78a1fafc697fc73603d3f08fdfc0ee885f84572fb04fda718a21744c7e5dbace91b0e141fa82fbd4d1a7dc35edafaba7c5894778c5952ec787bb547a37e509b035c684a8f51ceac5e12ae71b165dfe957c6de15
CT: c5874137f5e75ef02521b37f0759b5724798aaab8a1e62df81b73175690ca1d32cab6e7a9d7803a8aea420ab273fb46eab9e5f0773b7f5457d7a8c0058ed9675a6e1a7f15805c7fb695d277ba06adc3963606ead0cedb342614cb410f4197f4fad0b5df2187f8d2ebfe85ad3d5f59bbf652364c7e8c3542c5d7f15bc6e6c24eeb1d3232bcddf6588ab1c1953085bd0a1516046b76714d2b97718ce57ad23cd213507f6cda95ee9c5c23036cc7d4133c84a1d36393979f9d1bbc613350252a6de78d905607adf51368175a20106f81aa9ff9d
TAG: eab1c7790a5941270f2ae49895b3113d

KEY: 6ace8b5fa16054558c9d0e272573a7a1
NONCE: 358c73828e032f0e0db608fa
IN: 915466e994705239afebb8025aa965626973e41a750bd75f9e8ccc7c1078ec555fa618120b4f4b5e273fb9b262df73d39950fe5cc1c265c06a08e2318efa83c63dfc689de80966f45cab0d2dba603bf116b9ef7242bf4d9cc691a775f78148d2c75059d6049c861da5dc40d5f94848c7247a724db956d050975d613433066ab89bf91936e0fc85c61af5c2c61cd1eb414b9df0dc125a31a3805903a886b427fb78551bc696610833a9e55c7776ec1622abf839d733594864de06999be8d483f8dbc4da99f541c6f7e21d946cce229a104a57e4b823bfea
AD: e54b90d037c375238f4989910d423bc58d32ccc06ddee558dc6a0c2f9a0f13b2332883e2c4ef9cce41d72cd636516b3506f28f914dcc88311fd7c79bff0ad32770e4847362affd98ad468117cf0daa0f5747c86359615ad6087ee18e6c58453be60f3bf30f8c61c1466d107116f88499fb1b5df9a01eb762317676d5413b839c66e5c1b74121f6f2f7408825745fafa2b10ba7450f4ce207a9cc682d1e1442f972a86d5d4039c4856ccbc00c43b5b3412f5b3f87c16508ffa527c8080a556944d359f388f787f9cbc033fb3333e72127e94c455b433222
CT: 37be446820f5635c1b5ca1d8ccc2c5ab5b393243ef5229999a2c084fbb54a330bb338963740ba470973adc86e640fcc167a88bb940e5ad1723a01089b5e804b932138efed6fa0ed99c1ac4e9c607f466c829af04407a4a2e5cba486685f693a7b973921746902ad8a0242e02075cab66204084e6b281d58430f2d62bf55ad56ad279bdab0fc8c3d570fc3371dc3280ef3aea70d686c855d40ff205c04d457adb518d904f5715fc6a9a5f30bf1cc74703b175d70a1470cc810a366cb8927fb937aecc200928db6b73873935c429e2f8d595b418c5b1bf9c
TAG: 01b05fbaa9f2257b3c23ed3cf91bcbd0

KEY: c5bf40aa1127073b03c114b10f3f78f2
NONCE: b4ac4fe9920fbb4e032f6aa6
IN: 164906110c34354a0d4cb6370e1ccc17a739350cbb11d6570f398d50efe3d9db1a97f00d031a579f56d23da2441295af18a640a4e33c29dfdc848d722786d9b73550bfb76da1676af24a7bdf5fd3301090bf342369a24ba830c7f8883db6ed77a2ced83bb85205ca31f75a16a58fbbbd163a3af5e5021bee2d2cece33c08442e89d3f4d6d2359b94a7ec6cac388208a689b584d5dd1103fcf6af10ea2c7cda4f690ea0e4c7376fe2c3e69365d982da28c5bc18d58fe384c9ad2689f4047f9575e54970961a02419d9f2bac8061ce943f132edae1b9622738593cde52
AD: 9f05d0391cb128690cd8bd120120f21725a79e5d2d0ef9e8322c04bf775f7215a82ce1ffdcf0f6562c188e84cb520f30842b8dcbdec36436725633325020cfdda7ed1af3323d86b2bc72d1b4a326f02be2231fcf133762c4fa76c8a7d5d3ac31cd19f63411a220eba4fcbdec40b8eb01e4ef33c6620978d09a8d428ce0e74d02c140881f46f6f81c2850edd82dc46f3460b5d5fe0b54f09a3f31548dc520f1dd46ed657995e63297b6834df57525408b944badf56234eb2b9a43b1422a5c6a59bc58be683e47753803f7341cbb0075b5795228b586cc571c1bca70d5
CT: 5c75ee10a917651c49eab6a1187ed631c7069134e492bdb5e5698f8ccd5503cea5b1902d779c2f6e6c03b0108cee3fba03f2b47803e390930060ee4ac984b1ceb9488b4cce80e329d3427851aa7da2213eca2dc5f79366caf601c49a6b7a8ab068f1a9bb899b81a23c99a9de20466fe01398bc071c724b2942640cb1a00489e0ca7052f7a06398ad42500780f194078e3e77142df5710ae88540761b902084f57d87c2b0ec57bcb7eacee6743d419d8877d61666f93a127d22ccb49b5db0b93e4f4ac0dd9393d6351780dafa412380205a90fc8daad3dfcb1b7ffaff
TAG: 8048088e7e9dadc4ef98777c0f6cb661

KEY: b628ee6726a4d7925734ab1db3ec4645
NONCE: c830b0d1b4113f4c9aae46b2
IN: cdccda3718f2b0963414d965a3c36bce0a165f8e88aa70ca9eb3de6510d02b0b49c29cda4a7f6d439c18cc8fd80b932d0a4190236a13edc9994b1c4a71dbdb694ea5dea53ef781ed398e453ce372a99c204a138739edf5b606160e38cc8444c8fb6e9cfc3aeecc1760e90d13d01692ca894572a0bcb02e13f61d8604a75bb98e96f5f36d10e70a48bbb4f73771ef97031c7da23550b3a12554c2c436115fe56713dd303d1c3d87bcebf25f61710eecc9f01c555494facac496c68ef44344aae40bbe1199de793096d4630018a725b130a27d38ab2e8c629e61d2d8d37b5974f9b7
AD: f4d345e55ebd1ef9faf967d76736f7ef38e5eb9d659bf8a89fd3c6c3c674161bb54758f1c14856281a7dff7c9cec16cc138384f644544881d50c7692bf22513223b63274e3cb7509c8a410a389277f86cefc801d026b0049c13d85b26da1dbcc7cb387084a3d4a469788ef85b6da02ed2ba0412ba999c8cd83c9c6716cd66b65760c42d4ef3e324b470c2a5e031846fde97cadc448e87bec15164da006c10d3a846adab2b09c29ecc27ec8a9134d5fcfd2c54f17fb23f1a05dc8da46e737f317db42e927818ed00d36af8dabfef09c8641159fabfcfaed344b03a1dd6f9b883f7e
CT: 4f39b8fbd8ecbc8aaea871db2e67583a5b06cb83ed8035ff639dbc9af92c4e3f9fe57b970f4e998a0262dbf77dc024d5e208d3678ae0d90e6fa5d45e2c7f0cf90676368c8784c851d3818e221abaa87c5e54298229a2f4d3f82505ef7bf45686aaf12e8322210a727cfd57c74a5f23bb5d8222115b28503eae7a5c600ebc4765011161736a346b535e1bfcded85c198c6ce6fccfcff0fdb0c2fc480bc6e71fd5de77355932d82f8eae245091bcf5abfa0d62123302e5805ab1f5006a976bc1468e3bed0452c5844029d7d4ea6cbd4a907e905dfc796c01bbeb69c54807354a5bd8
TAG: 2b55edb998ac9971e53ebc8973c4e8fc

KEY: 095b26bf096971842fae34af6833c77c
NONCE: d59d30bd5384b86b19b33c13
IN: 3be9eeac265ec4eb947dd32583ac2e595505b363d660f8b8c2ef631390bb152f016ba7c75bf7c2e5e23c980d6967772ca4535bcbf4871ac1bf70b53826a34174e5a2e6118d7ff86d4836736c9a1f9de44c80b236c5530bb5f80e5fbce9814f3b0843a088afd029f4cd2e6190dd51fa804f8216448e7acc785ddc5478287b101bab80256977494fae87d0c13054fa4470c3827b2e8172224944c8c4f78b0a33dd78ee2bff16fabff15e5909f62c49beb455dd655ee1188b8eff35bfba72f2ec5e4ebad63d7db8b6338660f9b818c6832954241860925ea9b7eb07479dd6de27489d64b1a9191b
AD: 2ff9a8d12980e63a378d6d635d319c26e8f747435aa5d797c6e21aa69fe21f653f56da7db7d67cbf54451f336f683aa9cf373ab40c16738c44efd3e664ecc6eec40d6af82df2b3e58d7abcf26b1d9ebbe6263176ce4ef8087d14b0d5ae1c16917141d2ebdc76a0834e8d83c4ef76add82e957ae376b210ce2d94d2684a045a109454799f3cb453279d89c60ba9d038a1dcb99540fac078d7216ee94f96f5cce939eca9b5f9715b1cf3c9f1e6be982897c2f25225919db3e31595713a4e281e9919bc2c5a88c46835ce05411d0757eb738ac9e45ab3f1a42ffcd6dbd09f17f656f40f1cc2c050
CT: 4723fb7339048f811434eaaf1db24759fc232466f5f53926b84e740b67f457c8c76f902f4d70ebfd97696380de95e8e40e62434ab1089e3a5308cb066fd4cc7e862a391c2f727a63a01bfd9fdb8ceae55067fd9d6f55312f73bc2c38e4b12b3aa96edd156dd758e9175e67a64a17aedd27c9c70945a065216773d756f533b035f2ab53335a159d9ed3f97b2b7a57aef676fad95c46e3b82eb800197c03812ca4e580916c5f7cdbd4aa1308ab16096a8af5290a0a2330902966a58dcf2e72eea7ce799a8f05c986c6457b05e3eec2adfdd4ed38926a3dc07ef208c91a619848917b96a082ac27
TAG: 3ff349a628f7fa8d3f970aff8a6302f0

KEY: e27171ed1baad563d3d299abc0968b75
NONCE: 5931a4414d5a90e93d2ac47b
IN: 1d209b32a772e87c5bc593fe943d3d7a1497f390ecdccfefac50ce14595b98b682111f82957278241f291e655b3af108a9cc1523721652b6d446f34cdba2e61464a3217b29344e18ce8f47f10da88c2845a009b7491bbd1e1f36ec49997a0fb09764ee25355de29e56eae7af42a8c96aa137c02268078b7f145fb1249bdd74f2d4e4685de75be4dd7fcf29482eb26b5dfa5028accbd23c3c654bc202c1c0ae7a597ef15f4d14f7b8a14fd45698470ac6355e04fe4a14e3b2907bcade18e4152c68631f313cbef48341008482f434c017bf8e1dbd048f0d6d207446e697fea68202be7283188d1227f21ae4
AD: af2f6abc40ca82d92901de02113cb8f7638f0a510f6a03bf056a75b02beb10157c97632320fe14fdf0610235e3a06172b6b6e80d2fe18263b11e9a5e3a07758c55131ffca0a6c9b121c37a0c85658125d5bc2edc8e4e247a636d7793a1cde364ac22bf754844607daec0a6b939d05fff5a8c44ad030181aad2361ff61f20a224f2bbf2083b2fc2a5b92f5a66bf2f9b4c49b39dcc23cd3ba66b5e7c19c5b7b74a766c3da0c2b02ac80ac22c006e8eaddf48ce6f6887f69fff1fd0aaba0a0f70ef84b54280830a62d8b0dba55ddaa5b0385c586dee60d1a05a28863a081cb9b41edbf3ee9ebff98cff983917
CT: 673ae48b6080a3dbd08034312c36201d18508f4e1ee178ae2632a9a5ce0938687ac7e6cb238cff852ecfc736bb8b3c04b42752fe65cbf6ff897e207582e85533f7c238b0be14bb1deb4cdaff524b013661e4f2c96807bcd928e15e4e159390e1eeed036ce776b579d9f3fadcad81adfcbb99986babc9a8465def3de8de0cae19bdbf6488c12534a9b6b7d6fdaeb1d4c3be36b4adf7444a0b9fc69c69a46f7bdeced1214743f3357803d2eae24dc50933a733defc653dec56f0e0bfb8928de76699d4f7029fce9175b3b7cfb6c7ab1018f6f3eeb2b9401115c8cd382b06e4b9b43a097f42bebcc1493a49d4
TAG: 285c1a0028fed3ab2a4d68946399d700

KEY: cfea8c059d7b866051aa54b8977befe3
NONCE: e54e684ef16a2fa8e25786d9
IN: 5a20333c4dd9b7378bfb773b7d64ab80379d16c0a56eb1f48f53c19d0fc4519d0b5f478e37f16d6e5085af31dc63488f9f2cbde3e49ba954b674b0a4e20df811098f7b8e716efaee6a4109f16afe128ddb0e54034d66bd00d13a6c69c9ef2e5a065825701f5e85634e118c69ff0fd71bfccc25030fe94e778e7f474136cd3722eb5bfd88bc99fb45dbc3060a24ac2bdadc5c82d883c5c63ccc0f7aaf5384f4c7fb07310b66a7c767d025c1a02dc9aa3d7aa921a72084906ae6039f837454493aac3e3549ad3722a735dfce4211819a2d7ec279221d43360edd9a4cb930815c8565c22b94b4849a979d5e2a57b2da8ecb
AD: 376d8e02071a93c892293902e369b8c7c44a4c9541b5050347b016243935408d0c9557b0f66c6cd493c1b8da68c8635f4c868e685674aed42f196ee9b6e56ee44510eb9b9e89108d878be917454dca0c62d207fa462a563a267270d6b1602d6795717475bc6fb5c87b747589328e39b1d4db3cb19f0fbe9791aa4232e33abd9e14b5fa3abe4705ee988c657677fa063aa349f1a05de045f3ee66da03af18b6b8b83e29b203e12bb02a4cbaf79eab3cfeb83a5a997daaf8f36fa9e12faee86c9cb351ff361351d98ee3a10af999799955a02fc46ddf56c23070319b3fe0cb42d07d811ae976f242670e618eed113b4342
CT: 06ccc7336773919c2b1bd832e7c48ae4a569db96545363ae0b28061fede28a25ab6cc0382aae3e6b31efaa4c225073640d0148878524a7f381f53b4d21a43e39afd4c12cfdcda442d5023a8d2a8ad49f4a002ecc8354c86520524017e561fe891b6962682d168a860210e0def1cb4be1bfc6590121c1b1988254757fc5a37ef916827a5fc258ae772773a6902b084817f3641c21d3d1d1e8818b9851dd05aa49ea74e16778593f6f486957345462732ab92b1e4b06c32b5ad3270c5ef3d80b4e4bd08451e92c26acebcac1a4592e08ea434a1fbc6dfedc677151ae9471661913db19723184d9ef4bb49342606f784d98
TAG: e7be877dad60c889d397726bf1b6ea89

KEY: 40d35704108a944f1e7582503018cc85
NONCE: 26048431289e7e100481e2bb
IN: 515f9bd4935dc10e77dadd81f5a4e0b53eb858ded393979ed75330b80adb36f6b81288dcbc581e8d93b0e4705c07be3e200422397ca3648c9676952e60ea26d12198add3e33cdc589ee5a800a750d77978976344dd5dc710e56dbad462fab7fbd08c057a9f8765c4caa9418e6380038d288e09a90befeffb1e8d60e79925dcb3772cbb3258b15544f9c9554181df3483784b89b73bb6f9ca55f6d644c02fbd7e31bfbff45cc40132d2bbd08db6a27f5a302e1dce2f0afe4ef5bd4ca844c7900ba18faa1896a36896a1c80307cb37162174205665613b39cabd0a5b2dd1d5f8b6fee948006f0b2e31488c0c613c1d178b7800dddcfc
AD: 9c86692c874fa785e0d9384061bfce8d8332871ecc195621ed478706c46057bb4fff80515ed65b5fbbca3d463a62e227c228a340143bf012233b1c05a50fdb4ed04b840d983f47e00e001844a0d2ce14f6dcea58069c9b0bd8824537d2420147be7caf4a88dc9912853a7fde6d2a5cc21f85eeabca7902b94eb79d5fa143d02585acd57b93e4eb6bcdbe289a51c6631f7aea7bd9dc0f6cc2ee8426b37220216f834033fde15e3543422612fb3d972b8eacaece9614a4b759d93dcdeed026cc90ea058d7dc985c10859d4ef14ac5cb14849d4ae404badbcd98c28663eaf7274aade4bb7527c4f960875ca703ee6732c9a3720b629f2
CT: 89a21a1d502ba947ac1921efd3c998bfdb437c2da0802e5eefff66de3af00bde934fb9109e961f179771c52de783680683f4bb752f877897882103146d030bea5bc3c03f923b477443e640450244cdf66d7d346954f6e862a3a577820d49151a82f4205340ccf2e11e4575b53f7ffeef09ec640df65a0b8c04b37f6dad7f940cf2d7446a6fc5bc2dc31854c27567b2badf6f8e94294ed5d899a458a080f38d6e72df59f13f5c8f736264fa2b302d5375d6e3f8c3abe4811f4f85cb6e302e2c12a892a1e7a78a5a33e4b555c02917330ea7a45f20cb59fa991f183d1e2a5bb1761005b73fb728124fa2082f41cdbc88bb06389eb165
TAG: 5476c08e9561442745fd2f222d08b535

KEY: 2c6796d0773d12455829a3242ac7d480
NONCE: b43c0e7842006f6a7953d598
IN: e0f7ac13e8cdf4da6c17f1221df18b98267277e79c362ec2793dbb842bb9662b5e2fa34e43cea12f71b4eb53d9c862f176efc5d91f06b5c532d9c30206eb4355ad442127d325ae2c30ec436889e3d7a56b683ee09c7d79768d6876ebeb67b5a2cc13df02ab93646386106e0473149ed77ad0ec91dd282712d0aa26f30bfc44f93cad39504356e3472c5bfcbbf9557cd85b53e33e1a88d2f08686955a3d876e4eacfe783e5f6089b3106295899d4a73fbbdc1bd22e1408a2b93a9d89c9489cfe7a9a7cda7c92b06560a189f5ed04d1f02489685c602f8741baeef3fddf610b1a25ed26d88daf9a05aa0a476c8000dbbf798de92b0ab8779add7b7
AD: 1048769719a44958dbafe1a59a159ddf2427c5dd8746a8454180dbf59f48ff6467d760f8e06aae8d2d2a79efefaef2dd2abf33ba1929073685d0320a583a56e8748288b50c7eac551aa859b274629f3d3cdca5fd7b2a08f0bc830e929584bcba85f80e2eb12bf83de607e4749eaf7631c3545f06ac236d55769c8a08427abce0174c52718c2c08b02afc7e418bd7aa7715de95a930eaf92f54c7dfa2f3ff3691187a21c6bb9b238d2fe2dac7266de30c94c7ee96fa60caf5ec0f5aae5cef28264933cbbc295cade787321f4c12f63ddd85185997a63fec48fc5ddb83be3b47a94e15dda3f315e7495098bc7a0b7d26802e12fdfc6a94bc6c5a76
CT: 794ba0a7df144e66e6e7fc83ee290431818d149673d1821e1df496565aa7996f9e581fcfe9499c01d8716fd3f6d67acd6641285b70f8457108063933126c95b665e551925722af60aed5343e429e645574a65cb6fd767b204ca8fa91979c6fe49377fe4b43fb9994e619e1dd962fa49a8ae5ae0b8eb630f112c43a4e9c28ad91fee9b5bec0b27c5472e30c2699e984dcd9f984a3eb7a7b7209a165b2f4a74bca555dceb81e3495a3d39115d32609f372d8dfce820aded274ac567112d295de5b261b10c01f4939ac532d4a0591f87742d9502d7a2201178b4cb4c069b1873c44b73a901e299d4a41e57dabdefa39907dc559b44e99f2b950e09c
TAG: ae5afc2bc4096e308cffe8063277ef88

KEY: 092e4a78c47bcd0b169aa35343c885f6
NONCE: adb73023c873661f02bf4ea6
IN: 0751fac5f54602181fac252cd2fc408ea3763fe229b80149bfb4b0044f541801843c8a20ffa1ec931830bdbde31efa998e0875c09eadaba6906c870549dcc650b865665c56b5cf29b75da63de088fe4d79cce59499518a04a17dce18879e3e33ed11ad808d470b2811da4617039758109f56fe75eeee696ff51c18d5ac04fe895518fe59435ed1f073b56079dec1701999ce0e5ab45829cbb85cb1f94dc67c9ad28815728f6de85fb7ae12203eff28420393c1ae5cf644bfb5633156e9189beb02294d7199e54ca0d2012bee2dcd6322eb90f41b3c6086cf0ac6b3888b21131f3e57643f2ab60141aeb17d9d07daa213658b52503482fabc4a0ba17bbe3a1a
AD: 60fbcd82efaa99e17f3cb16a4d2a1e04659d13d84a83135a5e332366ba5e6716bb3674d27e6b2df4269180a0df25841e2235eed7d8eaba571b34178ac1a1041623138641f500a7d4ceb28efdc0ab45274cf26c0dd16174c77dcdbb79a7980e04d48b35efd3656e501e352b605bdd1b57cb7f9ceca5ca14a3953b2dc77d18fe1c4e1b859d2b02feffd3da7e259fbbf27721d330049f0d1c2729ed2f8048abfdc0e7b3609d2e6b4f5b42ece472f0fc330247880fd04768b678fbe20ba9581f3db18bf3668fa0c80751d78286e1927aa6e27ecce63fe883ee88e7a05f8ca2a387b86246f7d1a4791881b14f619a340163da62f4130b2a2c0bf39f463ef0af4120
CT: eb0fffeb17e3309d1104c9a9c211bfbd585f9516f775793c365d36352e93af1b4db15430b454d1e7aa913f2af994191c365d76a4d49eda531fa7ce9c49b98bad4d591c868fb066a2e00a6bf4b1bf529002d403313c5df306ae34b8c62e939569bb5401eb7ba87080ba505e5c40a3856d2e177d247a5d8c727b32a13014a00a57e9f01cdeacb4d1abd16f1548256d661c45da12c2fe3ab561375875c7b6e273bbff5659749631fe26cef86e02742d0cc3f63a76ae5ece59b6556ab27da9de1a20c627da8bef3c596ebd7b246505006d1a381c2a24dda70e52b126b919471acfce274b89e07d125bc69bd94f2c65bddb82441897973566014fef625bca7e342f
TAG: 8f2dbbcc01538ccc45436e7176c2df47

KEY: ab1405116f454a3b1f106fd491cdfc8e
NONCE: a9e9a06e4bb83c215fc59a00
IN: f64f0ed5ca25e118f2a2dbf069a9dc0169ab0079d91c6552d4a7e8d0314c910ce0614e1f6157b0f758ed6d3fb3fc3e2eaaa9718ef30e8d0c136c8bd6dcff97c0f5ff8a5d3808d8c23f2a9ccc35fb9427afd10dc1c298e95b335044b8d33e414ecc17d7b34901608284bc175418910116410a40b29dbb379eacf4ead521db3ab2a3d9956081af6d7438714c0631147b7d1e9ee4789751d4260b57630bb573739a3fd0b19a7ee8c301d7f1b09f86e60e31d5f2a86c7a65b244d5e4d591df3df3caab80887ea5f1dbb569516672eee351db5d5ee4d662a3d3c0e48cca108966ac6dfa6e4f9b88e5e577752826d2da05f2677dac7c31774eb64b1b0fc938580a78e4a296889c
AD: 3726f25fea1d10c2712d157e1a1bfa75d6f9e5bda448944ea2b7b85c7d4ff4ac00f68988f2a290cff3d5dfd6af33770a021b03fadd5741bffb7532924f3f2841a7f7658c49c6b915b1dc41ee4bb9ee89386c9911974979f43e71297bcb34ad6ed085177ea91300c9b42524503bbbbfcdcaea03e3f2c939d6b1dfc9c6b6e53e221568d2557bc3055752f4fd487b903a2a0bb7697a19a763fb7c615c7edd099f72e87849f57722cb0987651bfc476a0acfe13d02d6b01f761784d247301bf514a14a990cd4b59664f826649e0f389787641c1e5b87388cff42fec144d6ff3f382b85062bc21368c93019bacb56b643808a848c60bb3d804aa64e2b8fa1c128d6914663d9d3
CT: bc1c14f1df6ca46e6b4daafb016daa235718fcccfc1ac698a061885c33479c0a7fd44e46e805869383232168940b1a9379bc652c565059ba81b4ec2ab435eb9b91de5bc03cb0a7dc11805690ed9abbadafeab2add15f9fd69b5ff4bf4ab5cdb4a6fd3164ceb7820530641d8460b83929b13860bd2e64b984407dbfd2de51e865d88c63554ea1f04305ab72bfc991fa5573bd6b41c4f8c848fff4b0c5d2398a57b4de4678ca4dfcb16a7612773a24088893444a8ea3d0916e4b460b33657f41d2b04d0c28653ed068a3653975402c31088cd74722d3bc09c50679d0ec94c1e84844886b1a56c4fc3b14614634f08c5b0868d276e9f8f992f94b2c55be5f2e408a498d27c7
TAG: ee43dba528a9ce84a53ed8fc1fbcd871

KEY: 7990cd12d13fbb929fa541bdb8e3107e
NONCE: ff7b2818b62e856952aa2cac
IN: 5ba2afc1da8c18d8be3936a2e515bf9eabb93e44905a86773a38de7f959c49ca56d7f1fb43213cf7fe394b49733b031334729ce6c7ef17d843790fde814672ca982807b76475350210871ddf8309f59fb280a7d41726ba7f00ed2fd96b4a17aeb7d157130cb7e49c8a454cd08622824d20f86b4ba062bb3b3f9d4a9c1402a9d80f3324e4127ee57ad94f87d6ccfda76145363fa70df95341d483dfcc304757da7541a0f148036b2e2dc7f93697d8d275456107a016b425542a89ee33ec02289f5260257176369d990c8c89df73892d7e67227086c0c2c258e5fbfff8bf9129a230c229356fb0935738d2d6fb82992c3465ca5a9472ec06c7b5a29240b611837225c61a0e14ca2dd30f
AD: 865a9b2706eea62f3fd3164805cd8fe4740d1ba7be809cad9fb39cac26f7c57d4c449f4eac03d87f87dcf219c562b9ee07ab3ce22abd46237eef8221049fe499c9189f789948af92bc434b24aa44fff600c2d698593bdfcaea878f8780adbe8dad2cf453d253e8668631a6eb831be01db9c7f1b7b8bfedfae83bcdfef3501cf2b2ea48bcb19f40a70733f3e4c3dd90e17912d5797fa46ec852edcd49b0780bf6287679aaad13a926f750ad7d3ca1ccab577b74fc0ce4cb22e5c619d2d668292c9db4a98c5acc4c49561a77275c06f5c3fd514ed8555db3e2f50dde5c23e84a38129e7a91cec8d168bc828d09239a5c6bbb180bf69950540d8876f9fac5d1a258543a771610991b92ec
CT: 1901c8f9b5a99c46c9cbdf8ace9db03f36ac17183295544d8170fdc3a16c7194a2fda400f8f0b251a3eccf639f539cc356ed3fd09383954a8119b536290865c30a629d44e467acff5fc323d2be97f29fb9b4ef7cf2c18a63dabfefd7f75e696c574372f4a35249897a3387a2b10c1a50ae23ea74560b498c9d06bede78f4c8c9d879667c8c8e137a0a254f3f881ce8d183588546e066314bf1989d1acadbae61f7836fa633de9fd0fcc5b3f72aa03ac432be8f7a14c8e86b45bee416acfdace44b783137e3135a801342061781007ab939a52c68d686f5e3b401240bb10e764211a059fb0aa00e2f635ef214322918fffd0326ae38ee939b4045c6039df7e7def36fdad7f5b65c20dd
TAG: 3e003897b4d9411cbd449cd8dca5b58b

KEY: 64f0a8065987a4713e35dede10afb708
NONCE: d6ee984b82f1097331400f38
IN: 29327f95b41119679b80c3b51fb5240490689880ebb5ff7b59a62ae5e08f7cf0993c09b13fd845ffb32a99ce18c22bb8825c137c3aa622cf3a8390042c6a1a159aa1dcb6b6b21f4e07fada584dd21620b2fe0aef64dc609aac925d8b8d26915fc101031b68a4bc89898bb92146a0a580103da265cad1946791c5735b95d85d3f0f1f39a88f47b9c52e61307627c084d68d14bd14e3572825e190bc7146080bca423099f643d53ee3989386b87fe3dd9c383f6a58fc0437fdb2087b5211df2069bfd981d8ca785384cab31545ecfc35345f38837883dbde917155e631a46ed1444ea0ea8a5441bebd54e5f6ff914fcdd66d62efd223f34e16a880370a529b2ce6ade88e907102021dc87aba9900b6
AD: c8116196a12363785d4d6fc593b23226a5fe83b00a77ba24c69644d2e52291dc59d2af3c6ae102707439f22c33251a01c41867f54ecc552396a5aa98ffc687e3a88d8d0dcf826645bc78ff9c1a3052481933c3e8ba8e30bc249e6d095699ebdc51684696a15dcc9e28d09cac757e51336f79a0cd5ce8d070579e12956a740666d28ead49c47bae10db20fff8dfe6fb0260a87cc6f5a879cd0b2f949dbff046d90cf42c7ab51337e8908302935e50755a4503107c84fc94f7db3d3f0e8eac9c0def7435676701c9acd7f4c2349c3b7324622dfc4d6ddd8265a810c000158260aa6a7e3af973f8b178959de409792652e9c4ed1d50fce2e5e6bcf205c6889ed717db7f4b14500aa8641b8514150cab
CT: 3e04445e0ba21e8788f6f192b710b466d5d3433463f0308a3c0fbf7f1666fe01853b9d340f496bb0c2212ae3e3d34b0fa1adaf33f039201d1962f2b51031c2a4dd9aedc08f7c895682d1352e9a21225d81c98ac7fd4b4de6efe3dbe437d255e4464a1258d4497e2a1d4ef6c319869b78fdbcf4632743825112fc21acc0a1431d8cf8eb8865e695c0f3668ff5acd8e850373331ed7ae3bbe515b42c1d0ca0b9caa4df0048425fcd08850f23a86b4adc859291b5c49ed54e41778c7ee2a11da9598396aa889dda9513afb9fa0b66c0affa555bf76849d754702163004fe3e77ae5a7c46f3696bbd52cb8680583aa5cac22608c6d45b96770dbbfca14312fba61b3fd0d7041ded80d8dfbdc3f901b10
TAG: f42a0e4e6e6a1e0654aca2ab7877350d

KEY: 2c351f0b77cf0920873fb57c910cea15
NONCE: 4f844d27dd26df3015608119
IN: 227ae9330bfd5a662af4137ca7fa164f383a63e5bc33eba94726a0e7a27f666887fe484680899ad8aaf6fc5426600760f5e6ba53b0484615d0089d9b1e75f5952ce0665d16a045b272c3c50194ab7b3831b313dbd800168a24e576cab5dca4319660fc6add76bb400376fa29cbcaa25adf3cac81f3e66a6baeb0d94ed92aa37271d2cbd8219c0647f0af6a4ba8a8e169c10cf6354122054a547ba046e67cf1fb424271d3d3eee5b51e94019d450de6c1f770395316421b61c5ee9ff00c910103e58d423946c68369730a974a392c21be3fc8223cd816e7432200390fd7cc3f5160795422c9daffed23df42a7f8259e295d43fe57f75f674886c6405bc6954d17c2a36348761ba09694964646cb86c0d8c64c00
AD: 9d7d5e5f63267154bab863a7b53e0ba159a6d8a57a8c49e084b513b463a1e812e94611116dce9c1ceab2b7e18b4d69f7dfd225d2bdf5b7750d0d9dc131f22987bc812da5b0a8ecbe9d0ca2210cf6ed8a791d95c3f72898497226f69c8971c2da342500b75367842d14983384b5985041eda7f1cd73e2b5c71bbbec6537390313583bbd53d2d563848fc93d81579d8db321d1bec973f7c4e8f34b6cab8bd7b5789a7b40f599f2f8c43f6d7f8fdf940577ca8b5159e699d449ffb00acee0940937d491a71a81ee9da0949f8fa1d780f3957908819221941f0c5d011bfb2560acf2d7386f973358d68487954e26ea9ad3068c65b797307831e03aef7d1f1bba9ddbba2f251329e85172ed8efb1a689f8026b5068c
CT: 4ef2a097a8e507143b6354ecd94d072c0068c68698fd04f2211a771bec45d616d8eb7eaf90140850c135cf468dab9e9f3dbf059b56efcf616b32992df407bdb735a8b5ac2c361973abf47029bcde46dd5b13728add772264f2faf60f3de10494b0606618c383c8929377f2390c4a104141a11711ba7e3a3c83396761d7d62a997e8782822f51ffd0eaa0e6c9e02ae4effc0686af29f2805039c1cabc8b826d1ceb75c4274e95f854a9f5be709ddf1002481272586aa021acc2fcfe3e6cb0b2a47d124bd8b83585b43bc38599a497d0de3979c30c81536ab06a1649a3cf5dc2c2a6e52bcbb05a76e35139c668dc8a3c038ffd1fde8c1b4a31de48341b5fd586c674e35bef3b104e4b84063889907c268226dc73
TAG: 12aa2a46a9014800b3243d1020290d1b

KEY: d94582550b2e0d42255f13a8753f8e82
NONCE: 82f7abb31dfc28491697b347
IN: 53ba297d691fc3abd93ea8b6f3d629584370ac045934b1b738a73c09a8236bf5f99f357b1cbb120414c68ee64d304b7751c88c563d5d16fa094602c0ad3c803a8f116f3a5071c049a4b88f19ba2d500a171565c719fa64e691bd4a9c4588077b0c2b91733a30a214e474d868ac6b301898dc85346523bdd4f6c9807ef69941a5369b4b7ff7fdfd252729d3829a7bde65427639de0b2b154b4830f57ac13894bbe705f02362f8b75367ec7962c53bd6aebbf15d72b25c08570392592b6a83d4f44d2037da8cbfea2456696cc39a3272e46a5b4fb837bc6e4bcd9606afa58d3b260e9f6f58bb5d0f07438f378b6a36c1931e9eaf923c2a3679a789e7ef5865c7e799ff4633f1b2acfb79a5a0fe9cdda9cf347b9664568def93
AD: 2bfb6a6726c6564b31cca749bec29a8c9fd7bfa22f26af0a80db5e6b13a3b10367be6ad87325abc59252453422535466347059b7d57fd2b1eda1d6d37dcfa9da7df34746e1bbc98baeb4bae17281a537fff85c0785f9f27617e77333f11be28f9aa3704651e4ddd72502c79cb2a810c4686147cedf056b5f035566eb34d117c83ae7815e7e1e83163907020cf0736ff1862371e87269e5c8c1926e0bafbc10610a6ba6cfc273c9d9bec0922726dea04acf72b3f88a5fffc57e0af6dddd0396b4937d2e7d52feaf60d29dddc5b4cc139eb855acbb794b99d74b8a93e3731f9092b92b9bd50c846eecb6eaed2e51290cd1f98dccf3fe746c5293e0b970dde72835c44b3a445dc1f2bd67fff6b1a7e378611eaa42889fb92de1
CT: 1afa2fec98728ce39fba26bcc769e9766993c8276f88613db574773c84c91fce6ee7dc6ba4281b8d2dfe13820723526f0d6f20cc21f305b792e9a2bb1622c742fbc05ca1f0121cb9f6e1ad6c3ba80891e2043adaac4f1bdf29260a44a182cb165f58f480be5f16b51fddfd0d264bc4a18bec589d24817f586fc8bad15df7cb4d48d788fe7fbe69f821b5558b0a664ee12ba8ddc6bbd325f9b83a024245b4e68b310f2282f4cc6005209f7b7aa6ccc025d435441e3bb990e81bcd4c8218b8360163ab266be4a1f5603059db2bb67e541e1edbe8e7762ac522a81f495f5ff8bf99948050e61c86e83134f4e1212f879c86f7fccff472fd9753e27a0601f914655a5f803061cc986431445021c907b3ae0f060fac13f3723867
TAG: 5ef1ed1e2bf562893b094d58516c11a9

KEY: 31d93fd51c2d6450cf35d9edd71413f4
NONCE: 28f6f0c288c9f92e80252e1e
IN: e78eba6c58f93cc2374932fc21e54f695f2daeda3bd1e0121a77d178e3bf5c0e824a99042e8f2522df829d014e4d35a756780e8c07f53ca8fb78db6fb76754ad461665051c4572b2514804d0a9cbae1a1a013b796565eee13a7832ab8834b8406b1185332552d38754dde2344ff4f6e4823390964ba2dc43de136f2235b1d919e0f4ad60813d30f0ac1dad35abe3bee9479337c7b430841d2c722f12aeaf931cedd8a82053f697fff8d07f0af6013da7da58a5dfcf45561943e7ccdfd8d11fbe96a68a5a27982e47346500c0284caf8e6b63c6621e80503a7365d6693dc9a249093dc45221cfd88562e25910034c2c123e44e3b09d8a8a15547285d2596b98c7a0ee9d10b2cdb032d08a6caee1212420b6854181a583c15e046aa202dd
AD: a4fdd42aad5475ffc1b122170024486406033c8640233cd9b23c286fdd40c5b69eee39cfbf965f7a10c73663f9804e6821c4f62980f8362a580bab446325b009a004b60b1dbd12566b55b42e58d8037d86c1050cd6ecaaac2fb0ef616a15bc5bcd8252fd459165795c500bbb2fb1476e5cfef9549db733be65bde391c810d099e3745a2cc7a94debe1f4ff6653b338123ef7d2f9a602bc9a4bbe757a63f932a802014f2f06c6688faf14332a355b1025f33687124399f55b6a5adb4864727ec6c5334c41d78d1463400925f6c29c0f611f35c9640045a740dad5b4f0dcb632e7f9a3478b526aa9f97cd9f8d3ad094b7922890e7b6d9c67fcc4f747d04ddcd115fba0a8f0433c6fb1bf6011a9cd153f866c76b26d427a25aebc60d10540
CT: 8d668fb50efda82552aeb5d075ff3977c37929d73f6639289e7c6da8c89c664df80b2387e788d12398d62d3c0ed2f9f918010d41021c464d54f016c4e10e85e29ba3a45793df2ebd6cdf30045363434387bb0d20439f4986e6eb7ae9fd85fe776f7b8035025624c2413ca8491cc6e79fe901b9c40ff3a0e37a7c7e88b56de4fee65861865162821e046846d253982e4ecd17bd26214b0923a4297d4ed9423395d856940829ca5ee74488c3b4d8aa3c5ceade17d8a3f2e45d3ba91360ac1c76d6a29f8243bf49c1d75aa41ba239fa6f3b123e198ba799e3b70c674607c5371894800954eda0264b3b82606433f71371dabc5f1fb3d703232533662920a241f613c38d16b0bad24f4aa3b336af89cdcd2f371e1bed7aaa47c56d17100a01
TAG: 594ee5c93636cfb5fde940e3d561440a

KEY: b06d694a83b14768ae26a8f00fb78ecf
NONCE: af11369ee342454cddb8db62
IN: c01130afd7d3f4276dcfc1ffaf4bb636a85d18e0778df6c6791b6edb92a617894b84cffef6556c834a4800b336dc295e80b699b28cf478a01c54052ab0d0d4208e1865edd6906e3a263862c05f033668d7eb5b42baf36c702d102a6a5c723974e63bec848c89d16584f0d1ec429c87686b1ccffd7626e0a83f9c471cb615541ccb02cb58d10e63ffef171f1affca492ace4d39fbf33bb5126c575963e6b6ef9fd2ee4d6efcae5afe422bbfd9c3dc22b6b47cab8dc04127ff93b016e0f92f5d8518d5bd3bc6edd45e0397440f1a4a0c7c9c2773c0a0cd3b890effb010dbcc00237dbed1177b86bf60913309bfda9376b4192da59a360afc5bcfaf8be16ea8313de97b417aaddceadc63a1c3a355693616413ed4101ad68f6e6aaa99c839dd2a9ff536
AD: 18e3195358bae4ccf43ff8daa34902fe48f99fc1371d34060aaa442a43016a1d756f795fa5c9c4a828525554571e18c27134f46094790dd1e68471ee40c17bfa02f175b2c2f7f2aef20f00e4d71926560b58f015de19c871d808acdd341675d8fc19d1e6d4028e1e8926df500c4685c14729c6a056898cf919bf3ae429fa3ca8746495716d78c9a8f2ecde596f985b1c25ad0e73aa305a86259319176b4c4f3bb231fdaa478a856f46416ddb10a14ed23c96dcb86f5bea3114568a44d8fc6ff4bb47fd0e2538b70d964842910a682e7bc7c7263249832c21b7083a1e8b143828de0f3dea8b404cbd82efb19a11e4d60aeef13abd86621ccbc3d8f220715730eabbe04a6bf0e11a4f78cd2c4369ce2447a76f4fa48ef8d322a8a28a67039c24c4bfbf
CT: 6beeb306c71318cedabe3877ec916ce2074b2c3f1df887cc3a3e8019c10d353854b6b65c947359138d5decc62a42d50921dc8f6cf63a16062af47aa8cd50d0b2dcbc3300ba0d7d069a5e4b4fe03bbf7062c6001e276be116fdd00d15a6399d1b0db71c58f396f8bc7e51c2b1f47430d4ebd6c5d05328b29aa79bcb26927ea5a40c82715aa0e36cc83ca6d250812c1305c02ed4291a25762cd709cb3d808031b5f918ce253f622c1afcb83c43707edc493d18ec6f0dba4353a1cde7184db65654088fa13baf45f7643f0dfedf4058e6095156b791ed30827c556a7721658314356e7a3f3c62cd62fe938b008cda56ceca71442fa0ffeb78b13c5847a3ee9668bcd2a01c753bd797c240378505d1e8f2b8905428b23bf589de9af390f94f21630d1826
TAG: df5a21a399354b2b3346a9eb6820b81f

KEY: 06a4c6a8aa189134f5784a525d46ff10
NONCE: 0f765d3893af99f5c3e6d9e1
IN: 706b754094869313523493089e591d34868b708cbde9bd8b42cba8175d1fdb6a8769bb9ec156d44bcb8f9cbf2685a0dc18b5a802dcf7a12570bb9042a0aa53dfb19af8c0f13763f388d9626a480d6d435dd90fbdbb4292d9015a5633252aa0583498d6f7ec54460d8589c1d6a6d16a349d10ec6070e1cc52e5fb996f810d333675a7130e4f3db9f4db0e3fd3541d32e0b2efbd40ba70cd59295bc8d08481f0f137832b01bac1778ffd7450376e174067b3ec23d0495cbf936bdc176cabc3f42e2991947a4fa87dd8343c32fa3d7ac0e2d22660a0c128a00e1b51a8742fdb2aff44540e39e588c5920ea16293aaa522513c944d3b77f3a0e90bd9105319c170886202e336893d100b0a25aa609a49a8255f78233561f7b88256386d1c3c002c3ee68f2775585c65
AD: 18e2ed6d500b176e49f7e1b5074c0b7dbfdefdf00a63d9fa2fea8c5e78a1c4ae00f17b23442933543ac864097629e112a099f3dce6d5beb1e3f3c8e19522c6b8f615cbe23444bc91a802edf8a08995a55125da805ebb073fd89863996ef708f7293069a744ad95db8c17cbcfedc331119e85020df8852d74b8092fd38ad424f3da41b4775beac19536ed801ac1069925b12303d8ad2c52c36ca5b4ec95e96f02ebc5725ee6cdc099e666d9055b789e39ded77a8fdca0fe2d94b8039be55b6a75209cbee4fc7864957402b50427db71bc75a0b1e3d2ed6ea20f12a980c5ee916067d0dde7d686570d075da4df7088fe5dccf0d440064a96998da6f318b603d513104c723f27484780bdad586ee358d821b480f9569e4dbdd1a45ab9056f8d8e5a879789a0d65338
CT: 5f3627bd53f8da0bbe6f3c9246d6f96fe9abb91cdecf66ddd42f833d98f4d4634c2e1e1ad4088c84c22191bdb9d99ef227320e455dd112c4a9e9cca95724fcc9ae024ed12bf60a802d0b87b99d9bf22590786567c2962171d2b05bec9754c627608e9eba7bccc70540aa4da72e1e04b26d8f968b10230f707501c0091a8ac118f86e87aae1ac00257aee29c3345bd3839154977acd378fc1b2197f5c1fd8e12262f9c2974fb92dc481eeb51aadd44a8851f61b93a84ba57f2870df0423d289bfdcfe634f9ecb7d7c6110a95b49418a2dd6663377690275c205b3efa79a0a77c92567fb429d8ee437312a39df7516dc238f7b9414938223d7ec24d256d3fb3a5954a7c75dbd79486d49ba6bb38a7ccce0f58700260b71319adf98ab8684e34913abe2d9d97193e2
TAG: e690e89af39ff367f5d40a1b7c7ccd4f

KEY: 31323334353637383930313233343536
NONCE: 31323334353637383930313233343536
IN: 48656c6c6f2c20576f726c64
AD:
CT: cec189d0e8419b90fb16d555
TAG: 32893832a8d609224d77c2e56a922282

# AES GCM test vectors from http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf

KEY: 00000000000000000000000000000000
NONCE: 000000000000000000000000
IN: ""
CT: ""
AD: ""
TAG: 58e2fccefa7e3061367f1d57a4e7455a

KEY: 00000000000000000000000000000000
NONCE: 000000000000000000000000
IN: 00000000000000000000000000000000
CT: 0388dace60b6a392f328c2b971b2fe78
AD: ""
TAG: ab6e47d42cec13bdf53a67b21257bddf

KEY: feffe9928665731c6d6a8f9467308308
NONCE: cafebabefacedbaddecaf888
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255
CT: 42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091473f5985
AD: ""
TAG: 4d5c2af327cd64a62cf35abd2ba6fab4

KEY: feffe9928665731c6d6a8f9467308308
NONCE: cafebabefacedbaddecaf888
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: 42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091
AD: feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: 5bc94fbc3221a5db94fae95ae7121a47

KEY: feffe9928665731c6d6a8f9467308308
NONCE: cafebabefacedbad
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: 61353b4c2806934a777ff51fa22a4755699b2a714fcdc6f83766e5f97b6c742373806900e49f24b22b097544d4896b424989b5e1ebac0f07c23f4598
AD: feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: 3612d2e79e3b0785561be14aaca2fccb

KEY: feffe9928665731c6d6a8f9467308308
NONCE: 9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: 8ce24998625615b603a033aca13fb894be9112a5c3a211a8ba262a3cca7e2ca701e4a9a4fba43c90ccdcb281d48c7c6fd62875d2aca417034c34aee5
AD: feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: 619cc5aefffe0bfa462af43c1699d050

# local add-ons, primarily streaming ghash tests

# 128 bytes AD
KEY: 00000000000000000000000000000000
NONCE: 000000000000000000000000
IN: ""
CT: ""
AD: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad
TAG: 5fea793a2d6f974d37e68e0cb8ff9492

# 48 bytes plaintext
KEY: 00000000000000000000000000000000
NONCE: 000000000000000000000000
IN: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
CT: 0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0
AD: ""
TAG: 9dd0a376b08e40eb00c35f29f9ea61a4

# 80 bytes plaintext
KEY: 00000000000000000000000000000000
NONCE: 000000000000000000000000
IN: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
CT: 0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d5270291
AD: ""
TAG: 98885a3a22bd4742fe7b72172193b163

# 128 bytes plaintext
KEY: 00000000000000000000000000000000
NONCE: 000000000000000000000000
IN: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
CT: 0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d527029195b84d1b96c690ff2f2de30bf2ec89e00253786e126504f0dab90c48a30321de3345e6b0461e7c9e6c6b7afedde83f40
AD: ""
TAG: cac45f60e31efd3b5a43b98a22ce1aa1

# 192 bytes plaintext, iv is chosen so that initial counter LSB is 0xFF
KEY: 00000000000000000000000000000000
NONCE: ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
IN: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
CT: 56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606
AD: ""
TAG: 566f8ef683078bfdeeffa869d751a017

# 288 bytes plaintext, iv is chosen so that initial counter LSB is 0xFF
KEY: 00000000000000000000000000000000
NONCE: ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
IN: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
CT: 56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606872ca10dee15b3249b1a1b958f23134c4bccb7d03200bce420a2f8eb66dcf3644d1423c1b5699003c13ecef4bf38a3b60eedc34033bac1902783dc6d89e2e774188a439c7ebcc0672dbda4ddcfb2794613b0be41315ef778708a70ee7d75165c
AD: ""
TAG: 8b307f6b33286d0ab026a9ed3fe1e85f

# 80 bytes plaintext, submitted by Intel
KEY: 843ffcf5d2b72694d19ed01d01249412
NONCE: dbcca32ebf9b804617c3aa9e
IN: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
AD: 00000000000000000000000000000000101112131415161718191a1b1c1d1e1f
CT: 6268c6fa2a80b2d137467f092f657ac04d89be2beaa623d61b5a868c8f03ff95d3dcee23ad2f1ab3a6c80eaf4b140eb05de3457f0fbc111a6b43d0763aa422a3013cf1dc37fe417d1fbfc449b75d4cc5
TAG: 3b629ccfbc1119b7319e1dce2cd6fd6d

Added jni/libressl/tests/aes_192_gcm_tests.txt.
























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Test vectors from NIST: http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf

KEY: 000000000000000000000000000000000000000000000000
NONCE: 000000000000000000000000
AD:
TAG: cd33b28ac773f74ba00ed1f312572435
IN:
CT:

KEY: 000000000000000000000000000000000000000000000000
NONCE: 000000000000000000000000
AD:
TAG: 2ff58d80033927ab8ef4d4587514f0fb
IN: 00000000000000000000000000000000
CT: 98e7247c07f0fe411c267e4384b0f600

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c
NONCE: cafebabefacedbaddecaf888
AD:
TAG: 9924a7c8587336bfb118024db8674a14
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255
CT: 3980ca0b3c00e841eb06fac4872a2757859e1ceaa6efd984628593b40ca1e19c7d773d00c144c525ac619d18c84a3f4718e2448b2fe324d9ccda2710acade256

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c
NONCE: cafebabefacedbaddecaf888
AD:  feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: 2519498e80f1478f37ba55bd6d27618c
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: 3980ca0b3c00e841eb06fac4872a2757859e1ceaa6efd984628593b40ca1e19c7d773d00c144c525ac619d18c84a3f4718e2448b2fe324d9ccda2710

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c
NONCE: cafebabefacedbad
AD:  feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: 65dcc57fcf623a24094fcca40d3533f8
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: 0f10f599ae14a154ed24b36e25324db8c566632ef2bbb34f8347280fc4507057fddc29df9a471f75c66541d4d4dad1c9e93a19a58e8b473fa0f062f7

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c
NONCE: 9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b
AD:  feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: dcf566ff291c25bbb8568fc3d376a6d9
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: d27e88681ce3243c4830165a8fdcf9ff1de9a1d8e6b447ef6ef7b79828666e4581e79012af34ddd9e2f037589b292db3e67c036745fa22e7e9b7373b

Added jni/libressl/tests/aes_256_gcm_tests.txt.






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# The AES-256-GCM test cases from cipher_tests.txt have been merged into this
# file.

KEY: e5ac4a32c67e425ac4b143c83c6f161312a97d88d634afdf9f4da5bd35223f01
NONCE: 5bf11a0951f0bfc7ea5c9e58
IN: 
AD: 
CT: 
TAG: d7cba289d6d19a5af45dc13857016bac

KEY: 73ad7bbbbc640c845a150f67d058b279849370cd2c1f3c67c4dd6c869213e13a
NONCE: a330a184fc245812f4820caa
IN: f0535fe211
AD: e91428be04
CT: e9b8a896da
TAG: 9115ed79f26a030c14947b3e454db9e7

KEY: 80e2e561886eb2a953cf923aaac1653ed2db0111ee62e09cb20d9e2652bd3476
NONCE: 5daf201589654da8884c3c68
IN: 96669d2d3542a4d49c7c
AD: e51e5bce7cbceb660399
CT: 4521953e7d39497e4563
TAG: 2083e3c0d84d663066bbe2961b08dcf7

KEY: 881cca012ef9d6f1241b88e4364084d8c95470c6022e59b62732a1afcc02e657
NONCE: 172ec639be736062bba5c32f
IN: 8ed8ef4c09360ef70bb22c716554ef
AD: 98c115f2c3bbe22e3a0c562e8e67ff
CT: 06a761987a7eb0e57a31979043747d
TAG: cf07239b9d40a759e0f4f8ef088f016a

KEY: a6efd2e2b0056d0f955e008ca88ca59fb21a8f5fc0e9aa6d730fbfc5a28b5f90
NONCE: f6775dca7cd8674c16fdb4ee
IN: 5dc495d949f4b2c8a709092b120ac8078cdfd104
AD: 86a597f5e2c398fff963fcfe126eae1bc13f097f
CT: 04416e23586ee364b1cf3fb75405f8ef28fddbde
TAG: e7b9d5ecb2cf30162a28c8f645f62f87

KEY: 8d6ed9a6d410989e3bd37874edb5a89f9ab355fa395967dcbbfa216ec9ce3f45
NONCE: 55debbb289b9439eb47834ab
IN: 52939c7416220822a77435a46687f134cebc70a2f1a4c33d37
AD: 7790af913d84a04c1b72d4484ea2e09fdaa802d8b1733b8470
CT: d7bddae8929ed6bbc9ac077e2415d9fbafae4a0432f8f7eb6b
TAG: e6383b16ed9c32521dcaeef3a7b9b67f

KEY: 525429d45a66b9d860c83860111cc65324ab91ff77938bbc30a654220bb3e526
NONCE: 31535d82b9b46f5ad75a1629
IN: 677eca74660499acf2e2fd6c7800fd6da2d0273a31906a691205b5765b85
AD: 513bc218acee89848e73ab108401bfc4f9c2aa70310a4e543644c37dd2f3
CT: f1e6032ee3ce224b2e8f17f91055c81a480398e07fd9366ad69d84dca712
TAG: e39da5658f1d2994a529646d692c55d8

KEY: 630b506aa4b15c555cf279dc4a7ee9add213219d2c68163ceaeda903fb892c30
NONCE: 79eca200a5cdf92b28be5a7a
IN: b12e6f1f8160cd65278c48f68ad53c8c82fd17c2c39bbb109f077c17fdcb8a0b3a5dbf
AD: 46cb18593b3b26ba75e4cb20a252caef31d00be31093d2369e93572a393d650c68313f
CT: 9a9ad1f78b4d411afe450d2e46347a7df98f39daa4fd478b9ab6e6b417878bcd52743a
TAG: 55453a003b021c8a247379cdc4fa6da6

KEY: d10bb6641e9ba0a3f1b016317831ad4232f81c2137adac0940ecd7fa36de0563
NONCE: 99c922d37c95ebeda8e81ae8
IN: 8b9089df5bb048cebbe709cb61e178ec768515a0031288d95b7cc4dfffeb51b836e126a237ec50cc
AD: f1cbf6c83493b2087d9f88e02121a114f45ed51817e46ffc0b66a783350eae89c6700db3f3be5f4a
CT: 8a838c51a8ef8134481e9951033295ae686624aa4df72f869d140980347a5e69a6d7cb3d7119b303
TAG: 9152bef766579a3e9a1e36abd7ebb64c

KEY: ca665229adcc7554f1b1c8f50e7444c6d4059c525f9c0da1406ffb35d50cae97
NONCE: 8e2df19123ce0ad41df416d4
IN: 12365eaac86b270e9c61b3ae7702a6f3583ef4accb80a98454c56e34e2ab97d8afa23ddee34e7e3a522497f985
AD: bf539d8e9e3a02f3e5834970e7efd40cc7cb340a075041428d6a69ed9fa5105e4bc63720be9a7040ce5b4af6e1
CT: 96027efdcd4433df8e7f6181c05be365cdce550b09d45cfc96fe258eab6d55976a9306a0070c9589ef08cf7a42
TAG: ec9fb5e79cdf8ad4c8a79c900975159d

KEY: 5033338bf7526cca0425f4a620424662ebc58364c8d985d130e525fd1f598f3f
NONCE: b40842b30758aa3eef7cda62
IN: 69a62b8c5f9b81cebee3a9345f4e49ea089b0d9c1cc57b4ef707956d0287de83fcca6d8f5270a9393e00693075028189bda7
AD: 3efe0ed6fbafa61070388abc59c0d06589309736b02418df5534c8c594d61a2afefbee17af8283d01634b6ca3e8e2aeadff8
CT: d6184677a21978b6443d99d7de1fd01c6b6334cf01b7e7d58456267453f4de96708b62301172c8c87e970f91c5301e0ff61e
TAG: f8ac7aef208712845d137b8b176c89f1

KEY: f33c39140999a2cb69e43129cb5df18fffeb3513ec3560792e9909784daee43b
NONCE: 70608463f1dfabb1fc4451e9
IN: e2802c4d290468177fdb031a717345753cd7c3028ed07dea428db84e7c50c3eb7b24f7381a167b4ee31bf88dcaf5251fdb90ecbb74ac2f
AD: 10a6f463dc59d4791b3c2b4c93cbe2dec579a154962cb2c4cc77664e8c2b106c574fe115fd43dad94b8b1bf2f74820e28435b4444b2b82
CT: a27419a46037323c033d7cf2a716777fedc02a5ddd8bfbdbca82ffbdea3037bc1cc80df7c5e502b32276ae88ad6fd0f0cfe72604648812
TAG: b1ae330d47fd399aaaa687e141e23fc7

KEY: 2121056225a7b2316a93c4bfeb970486fa9c586c14ba8b40be5844a31e9449c0
NONCE: b4b7d1e8fa7d0e2334c92315
IN: 2038e2c6cdf5282f081292448f8febbb60a1520fa3771cbfef387f48c5915a1438ab709628e8d4c81623ddbc2f6f159c3c9a8922905c4994269898b8
AD: b07f66508a39c4932b04c16172d6462d78273cd9463e52284bb73e3b8b8e7047bdf10c5ace1f903e5a5eacbf67c9351f82c74bda140df2fe0480c80a
CT: 7b54618ae09b37ee72e51873c82cdd20b6dca37c334af89548f52f34df3a757e632cc0d453fc97270898eb50ce2f2a98c4cbd4cbb22a5b7c7564406b
TAG: de3a9e2aab2439675c4f7f0b61216d5a

KEY: efb15235bc91771aa32d51472877b0eb364de2f88766908eebc6e6b57a702099
NONCE: 1a510b42dc20d1d0fb34fb52
IN: 4eff604dd4bba67f143dab0728b8597e269d4e0ecb4ce80c9850afc645d96da239d9db360605bb4268d74e1fe3431a44242ae862fa2340c076db13315f615b85f0
AD: e8dad34f727e77444a96cf06425640f1fc80fe3b01dafd1d91476140afe8204286d01b0ebdadc0270a3d218516ff5f08a69a7ba251ac325983caccbe0d9e1de359
CT: 989fef0145e2fe93b9f99fd90123632d83d9df8f37d8e1f80dac329dbe0c214c2191009e31232538fec63a29665f0fc1c77dc86b2f5f2050b86b3ae48e85d63116
TAG: 6816304faeb45da4e4772f5c35730f8a

KEY: 998c22912d5687fc3faac262a902783fcb0c738520b5c4135a8dd2cdbd7b0dfb
NONCE: eeb535c5bd6edfd696655b60
IN: 1f6ae10d425923c882b7d2f556571acfc10333ec665b07bfad9f8948a3b8c5e5f163a4e99d4726da1a35359c657c848f327b7fd9b5f61987440ab12b9399db24715715a2d1c8
AD: 9a3c76dbaeb69a6481a89318caeb6358267ef51a1a364a48387bf77526837c9c70afb6f105cd47d2b976dbda7d2b6bfea7b76b135810c53437472f7b80ffc8ce4dc95c7e5045
CT: 87f4e2c80a4f15f92a8e94f468e70fe7f0e0f83c0a7799a1d465043d25210ac6f0f39a5e9765b4daca637864d1bcc090d2ef33ddfccded2d2dad61dab443b3cfcc683147c490
TAG: 0744d928a5b5ec95f3087cc2623f0031

KEY: e12effa8da2c90a5d35d257c07d1b467991bd5f75fecd7129aea4e26b9e27ff1
NONCE: 4edd0b4cc349d37eb77f5576
IN: 21dc87984edca46a629ed95ffb04471397da8806c525a781d9a71818422e344e4af577f38e7cdbc556d4766770a9a3c95bea59ad497fe0127816ec4dcecb6b999486719b0b86cdb2c9d09e
AD: bc158e6570fb0a08d73367dba65b80a8c8e57ba6c7b99493ebdaef0424e18d8ab1f7c88670cf51c4d91b77eb9ce0f89a46ed1316141e4299ec6c3d6e712ec9e92d3db44640402aa4ac00ba
CT: 07ab8c623d683ff83030392e2864edd4b8e3d296d60579a226a8d2aff6bc5af3c4598a18cc1e8d7db4ac8eb56a082af864ac52a324851dd29af51a0945cee4bf303ea111b9b627aabf5ff8
TAG: 53e69b7be969c39560c016c6bc1aa4e1

KEY: 3d9723c9235939df8647529b7e4a57b8536476d5b71b424e2c27ba4d0b82b0e8
NONCE: 60163d2eb7822af7fad64c04
IN: b44face0f45e4a8da19aa0c5cbe3aa960ed6b74fe3d3d9201f52523dfe7651756b2ce482e759c87bde4ec670a0e808fb4883e437c7cbcf2f6470352174327824200cb0897edc4def1736f51e229addaa
AD: a4b2b7bf36a70a5246feee52c474058100bc618fb0e3d32e8c1f76153edec47fab3045dcc7eed9ca1886bb2593703c9ffb8883c45386d2f4e3fbb0b7c722d19f2eca94767174d9127450549e8993ae33
CT: 66fa63ded066ac67bf218af7bc21169a875f4bd695f44fbdff906f0a9b8a067be721fd260571c53a8b51661c8d49fe178dcb28c31deb3fa71b096b387f9fc8f3657d280404c05d2b6443eba7e60b562e
TAG: 59d5450872510c4bfb590d9497524331

KEY: 75b0a20935c4a5e2126ac7420d632bfda8d41bc947c2402bed4759b6e617ff92
NONCE: 0c3edf0dcd1125d7e263b897
IN: 8edc98e70030e40bea1548f6f56b4561272be0c333f3b7ae53ff3e27c35a91b1aa42d39e6305ec4811e75931e5cae2261d88a6f7d6c5b05bfb48802264e9cac782411f1de579e29d464ba56840b126a3fad07f01c4
AD: 7e35081ef652424da6304852243ce43ff711da17f7881d5e0433b1ad7535e755a8531b93d67ce99ffe66e59fbb24f6b42655524b39f2c84daa5cdacb5e7916266c05711a118b2128930b95de83ff1a67e53337474a
CT: 858dc74dbec6fdbe4ef15a3596ff7201c8f4fcca765bf5452f678b1493a66ed9852a6fa174a73099acf951a35699f33289ec50625538c01eaa456dc658013a29e4d133b856eb969c1f221f99e11fadc98b0ee08243
TAG: 3d8f17838c4fc69f04d7e2b76eebbc0b

KEY: 7a3823191abcebadb7970d1b65c2a8dab8a908151737bd5400b3b6c0d59e3b08
NONCE: e32eb00e5106097e2ef0e8ba
IN: 220db5400dce604adee4cb698cdc02d2ca61622bbdeebe347b0bfef55cc45319b940f93773a9878725c5f55485d7a26363251b9ce0d3da1f8f6e34ad5329dc9f752ec7dc12b2d259ac89a8059085996a431a56cc2dc2400a26b4
AD: a83b6dc78931cb7500eddcf77792e810c1edbd5f4e33f85018807a8539a3cace094fb794fa9ea058e82c830d42d5a6b3e22b7785698774aec5c73edd92731c51106a23c569c0c0fef18d13da1562a9a42aa435b243c4fbc9fe42
CT: 5ce6ec0e1d67ced5a6aa46c909b9b8907b372be03331dd0940ceb6d87e928c14a1a1e8ef9096c9b63ab4cd93242ec7be7e38b80643f9c52e7e90ffa06b8f2d238fa63dcd97af74ae37802d124623b8a272e68ca18b3432b7c017
TAG: e21c61d604253bc5b5d58283756b9eb3

KEY: 53ff6dc0af3e89fc2de7370caa433f539d068609fcfed6400a5b9fda4c83e3aa
NONCE: 91a824c5e023283959858062
IN: fc23e07b4018460279f8392e86423ecfe465b25b60382f58995ef5fa1f9ca235e4bf87112554aa0e72836831d7b5f39125df11518b8aeb1809d804419beb05ae013482213012e4ce980ddd1c58e11608b775d12b450ecace83e678c69d2c5d
AD: b3a1db2d467780480f166859e0e7aab212738b85e88237c2782496c9c503347de02f3dad6bfc671fda71a04ff1e4661767c11303daa0c36d944346d39e3e29ec63d695cdcd83b2b57181582c5ac692b13e4299ab5e86c59d09c2dc6194ebe9
CT: 88af588ec33bdac2cc748a01ee3eec97e5bbfdf69de1d66176f42b66383bbffa8b185cdedc25b11a62237d334d68120fccfd68c2f9447b3b8e1f623f33f7f97ad8815d29bf11bc0c65641ba8fca4a087783f4694fb1d574450191825f84402
TAG: 2c4973323e635a885f78ee106eddf19e

KEY: ca2b4d335598f26d3d3607e62b9ef853d3543e741350f92f3050894721d3d450
NONCE: 2431b5cee8c3ecec4caad278
IN: 75e29e46350d1fa99403b1e5baa414e41a8e714910f313f8e850cf3076508ff650011af766b51283fbd5626166d775fd4b4cb7124d26d77b41eb17bf642bf67a34c1caf0fa9b43eec12103f864e56c5ccdc81b89c1a35e394362688d05dd94eda3d05dd2
AD: 31c3ce532bc1bae65b5ced69449129b112019cc6078268b853dd17c41832ecae07f9c6b068ef6cba2b55f352904afd6096ff8432081aed408d9340c319fd8e2029c389b6e3a4bdc38853444c3f7be9385ff1ca27e59c43b542e99799bb4ce56b8e26d6c1
CT: 90c13ec26d01b7b96bdd6816d3ee57df57efeabdb15ba602229ff71d71793fe8081eb1b462e8b2967bc4af96fd6dc72cee3d2b6495c7f04c9068b2ad0b073e11cd5999df541ad705c6315eefa8da49c5dbc258f7ba922908489c1ce672971c3bfb6e8482
TAG: 3a7741a094be92b838850c32e4b06c6d

KEY: 49fbbdb5ae21cd955be7f7603cb8563ea0b02b77a9ea14016baa5cffc55d20c9
NONCE: c0a4463350506d2af9e35d8f
IN: f31003aaf5d8fd6261c01c5bb1e7bf6af248e0be3cf8aac67ccaeb0b7468a40d98be526a8e4f692dd23763563e601915ebcb59ecbf03bf9c665c4c5313c318939a911888fd427d5297b9b2fd91dd33eb7ed38e2f0f6ab74ec263989cdd9915811a022d4a46ed35eef0
AD: 17e01af2386531ce67d5bc3325d8f83b53a87b38f1c305f99c0798380a7e59d3ecddf33a5ad23a82e33f0fa34eb2438b17e958451439774ab642fafd3794f80a0ee1b9bc165f32df705a6175310670ba54af3a204e446db35170ab02670086c47a475c22d1f14cbe44
CT: bd661836d1b74244baca62d7d1cb6717e17e2fb0bcbc8d36b3265a983d557c562b0be60708499d0e7e9626825bc049db79a0ef4d2393fef6024d849089455e55693fd4da3d910eac11496492a645e4376855732765e1b3580461a2a2533cebb482736ac928cba175bb
TAG: 4596e3802109c899f27f6cfcbdceac5d

KEY: 30d0e4f6425e38c92ac34dcaa06a815166f301289ca9cb0ed08156617d87bdf4
NONCE: 525618ac9e317405c7d44367
IN: 06f2204ca864dd3f7c9d0290f6fe3d0337eb9442cd5d2b586d1d5c30e58951fc2f4e99831ac7bca4356db4609a0428c482f2580b9e8cf5fd00d86d474fd88ac3b2413f44c1ff66e59e7538c090b2444396f02004ff636aca05ec40439f4e3f470a24916fa4033cb60127223addc1
AD: 23c1a3e1083904f7226be7242027abb7af9d62f1115340cd4a57611be88303955cbcbeba44eab5488c80aed3e063c70cb7bbdd9ac289c8c8977868c3702be63d0358836838a97b31f6aee148f2b8615ad7c5dc0de7c48db7752e5f1ae8637f8c70335bbecf1313ae1b972ffb9442
CT: afe3e71953bad46ad28113b7c8f2092fdebaeb81626bf94bd7e9dd59e000e8ba31c1ce7f728fe19dbbb42322e54aab278e3c29beb59b2d085e65cb8e54ea45d6a9fb1f561bac0bb74afe18cc8de51abf962c2fbc974c7ed54ccf2c063ff148b3e6cccdaa65cc89ab19fcd9cd0436
TAG: e9f5edea1fdfc31cd5da693b50b72094

KEY: 661309741227606892db13ab553070b456c5e421cca59087144873ae6d59e590
NONCE: 9f07692c017e1391a981e70e
IN: 40b5f8081b5dd173203e02e90a6c171fc41f804b2903ea18109edcf77c03dba687b47ca389c55389bd7b0ac59bfaefaf43b5f97065df6a5375c1fbb95d95cad589c2a45cd9e1e7960b1d13622440f7180aa565863b4f9dfe26ed336ff4318653e1a520bdb830e01db78a7e598f251834d0c9bb
AD: e8540d084f24b80414af554f470048b29a5af8adb2f9d55c9759e5ff1595ca74884af67027324587131d90c77ca72b2d15b66564549ce93df7f667d0218a6e874848563a33886c6a0c5a9d00fa435dfabaa9053243b4c8c25779a4dbf79eb4b8530a7c7bf4263ea824713a90cee92dec78c449
CT: d543f49e6cbe26f1d8a6e058769d5b16e6f8255a28b4d73ba2cbdf664bbc5ded73f9dea12a11b86b6a6acd578f685afabc232dbe9ff8431a5318ec7f0202959a310595b147353a7ca89c9d1fc2d2b92ea610cf6d9ad2716df2dfed70f5b74d498edab114058c22c96873a2a64abc254c82af46
TAG: 31a8441886d0e4c6bfcd6d74f6a5ee5e

KEY: a248b0d683973d205ef2d3f86468cf5a343d6ad7c5aaac0b9b6b2a412eed3552
NONCE: 8f62ffac4027f4dfeacf3df2
IN: c2d7d29256832def577392acb9fe4f249eb4859025ea55cc0c4a67806caba3e1cb81bc7f5717d94e1c91ff06607b23c238daafcb0fa96905616f02205b702508970fe3bfca87270ed1102a9ab96df57ebdcfd86ef6e9c4c4242b4febd82b0220b0d6f76d8c2d0fba33ca49279907f6bcf7e8401d1419ed58
AD: c738cdbde6dc277ab81dae20fbbb4a50d71bcf0ac1ee0ec6a39747ccd87be40b1f0f2c37f2c6b32ea99722979fcfddd0ddc2e4ff34a2e6113b591cbfda317c6f4b021ad30325276f8d8dd78f757618b53297fec091f029f9b00850b35f3863a3801c882422b318b4a1bdd89002f928371ea05c6fabcb1792
CT: 7a837df292ad2e58f21b89da43a74de411e1746556fe47db55a136757513bd249384bf67887a5c1f605e7f7e3057596e17039701ea351e5ccaf0fd4882559e87197144632977cf07cf9e86784a959fa7399476a4fd196d7c507fe3876d759e2b37bd37edb3c12b89716f29ddc8b64974263a1ec1b6364b0e
TAG: 291098a2376a0faa5da6fb2606b4f2a4

KEY: 80634a8baea1c4fe5dedb664c9b5d714422dd1726d642e60d15e02364195206e
NONCE: 725ee5023ae08fece15d621a
IN: 4d1d8855b4d155e77bd1bf34b3d049ef09b2b94f4e604306406b015a2d520e8772b084ed668b868e32c7563085f2a82e7d99219da549e507aff9515e45a045c7cd5292c0e09a3a38c769acfd0a11826b27d8bf05184971670200e79c49754debbfc57d9ebc661b25f22f241c4d143bd922f7b0981a48c6a63462cb5cfd
AD: 12b3fa94a64454dc5b47433df1ce0a7dd5e8066d05b2433c6cbcb83087bb7d22d153a19c05aeb76141431c5f9801cb13531691655939c0c812611c6a30083ed3ec27e63e6868f186be559c48367a00b18085ffb8c7727638e833a7b907ff8465e3a01d654b52432767b18b855c05a9cfb5d4aabae19164f0dc2ca6346c
CT: 6b01e934916823f391cd0d2829c224a12eeddc79f18351d2484ef6cb5d492ec9ec4d8c4bd3354f01d538bbd81327f6360a7d157feee64b539489bfdd1be4d7f724d2a6dfa1af91e4108dbfffd529afa71388b07e5079236644da289ae236100b2fbeda0c17bf2a01e76cd1f88081682c2d074223fb8a41d59e70a37870
TAG: 55762e95d897a33c4c75106449112986

KEY: 4f2edc967b11983f05ef5ee2a4364039ac02dbcccef3f3719913ae2719c8217c
NONCE: 255f8209b0c67a6277bdb42e
IN: f8217163bcaf77c1383089e396b271e22c517e8ccda244256cc39315fab7d0c291078d90e9b6e336992f015282caa1ec0ea858a179c9735b7a2f0d50f6f1eecaf3b9308772279ebb95f8aa53826e9dd60fb354de0c50c10001c98812b59d7c0f36daa1aecda6782ca36130fbb559363fe07704b0b91ea85be319ada027e47840c764
AD: 1dc7065f1585384b88be47598ca484782716c78f49b3b6bf5d24a5b0d24fbd7831f18d77d80951d2c4fafb6f939d46362a69b558afadb3bb4d8aa27f7fcf3dd9624e1e075fce9bb239926d51ea9dff03619d64d5828103a414e360adcda8fd864fca55c21df86c76972c3765ab1d68ce89f708e7e5a3e06cd4de08573cf750c6f5f9
CT: 6719849b7cea3f7f2a8e4de13d7a864d581b7c638f49fb06378a768d2034548179963c33f0ad099254c2edda9ef771daf5d299f58850033e2e449d7bc21ca3f7d3b7408429b596da615c8582886a6d8c1a9ba81fec4a41a38b7cbf1a80ee0ec8bd71451e727051fbf2a1d1e3c6ca98ee113e47650ba4fe80451e79b04abc8bb99a2a
TAG: 2ac7f962553a8007de3369c7795bc876

KEY: 51c5cf1f0c76ec96f4a5f9aa50a36185521f3ba259145ac6cb4da3cd12467696
NONCE: c751e5e7e3d75874acfd2bfa
IN: fcda42cd098b7936f4bebaa37d5850cb0fdd6526966b1b5734f23d5050ee44466627576e1144957929123198e40b64eaef74476870afecd7b70f7583208603a1b5247074c6c77e10b9bbd41a3d468ff41db89895b0e9ca95be77526ddb30d4c5eb0796ba97d7d5c56d0eece344dde3ebd7de586226c00da224b04e74d9abe832686797df067c52
AD: 343ae5e73fd1da48dce92ba7b86d21de0a203ba8587536fbaf4646bc45051a7feb343e38916f6c4c75b65f940045e830857c7b62b34a44622a36b34268b8a397892ed3e4de5df3fa7384d4ca50202b5b0833f921349c877931f4b735cec45db6b95410c8042ba49c1a39870276e0165f09c73b14bdf7f36d19084f958695c7ad2cc56f0487eae9
CT: 04192659d6a2f1b7be472372c8f969a7de388c97d37b4a89653593e48b630947d2160b569379698e94de49b21572ef0b4dd330487a8be814a84e959a1a8e3cf33dcc9f7464fd44814d0cd7ab85e4c01c9d015f42ce3723c8ef8c311222b0c78eb83d81696c217992be725faf27701b4922c6e6099442787ddde2b7572500a5320a4d0c787b786e
TAG: 23c7a866574976dca8f401c4b5b58292

KEY: 1cec3efc0311d623f34b6853b3dc97e470fa728cdfd65993d9d48fdc192b28e9
NONCE: 320fe742ef171b7b8cb615cc
IN: 722e503a97166a07974dcbf136fbaec6c03668fa52495b040383433ca59f6311103f2fc6a95ba4c925f8637167537321eff6949aa3051269fc094393a7b17d1ac8d29af052760835665b0ee89adda5dae7738656af9e8513c96e8a532a46ef34cd7430832d2be51c586a14e9aaec2458c1911bbc0f90b496737e838a12ff37d3db058bda9360d7d33e11629a
AD: fd5ccf6b6948c3eb96543aa40f107fafe94e5206c326dd8900ea510c6b61d1bcf746151a75404e31406c8e991fbf6e660db7c18e243fd2608aa22dd7ca9de88f277037661ce6dea4ff0a86809dbfe1708cd47d3061a34657cad143e6577549c9944e081f79c276300bb406378b26f349a91fa87de02a1405d712c516ae11b4bcf30ac9d56e677d03eb33e3be
CT: 363c1d6b806a6d97e2fddf53b242378e1d2b818828863fbb3f856f7737d63998a84e02d6c91e1df5f5eb6cf89f7ef53e16d10ad52f82362292d3acafaa02c23be7da7616a8b8daf8ee3ae74ee1078742c4ddc3e5a110e510417b9f43fbcbb00e17af3301b2fbcb784fb0a05b66469e771fbd78114fce3c4352c42928bf5a0ecc49228a3c930b0790bde7ad7b
TAG: 669482999be99149f9b723b60fec62d3

KEY: d3465cdecaecbf25943b7bbf8084ccabc15474a4228c46cbe652a99be24a861b
NONCE: 04fc836de3a1420b8e7136ca
IN: 81e0e984ce0a4074a44524f93e375eabc650a847a42393f5c524c65523368d38a7e2b677fe08502dd3bc42311775016b5689c660cc0ca8cb33a09b89f3ed3d02fa0fb75ca5bf0dc3c27c546b369ab5e7731f93bc074d37ee50d6f8366f6c8a45f73ac92b05c4aa552ecc5266041dc122a0df69a36ad625a26edb57bfff43a84e527ea0d9d3cf076f8de9eda28eb09de3ff
AD: e4adc14ac4bbf3ae7ec7d97f5c0e6090bf8127a75e8b70e9b86496a62a759dba5a4eef64a8c679c362785501260d29b58e1af647782564947950428dbf14edab8e6841c7afaf9e7949b560419c44bae30315c597f6f6e02204da7ec605a4d9a8753de1268bb0b1c84c972b4e7296da5c969781feeb35a44d2aef799ed228aa399ea04e21cf9f7d5600a2c07b047aa78388
CT: d7995e7b610eede708526c05c584039d48b9b4356fc71b0c37ec2559309a688a7c69ac9655f94e178cd2311db58587863b0fbb990554dc9a6aa849571f945c61e5611ae7e1a96903be725a1aa75adc381b86e43fbc68a36f44e0e0cb8fe5c494caa91f758597b6ef3b80a879154cd8a7e5f570893b4f768105b24b58efb67c5f07c6db60e0f48eba9563f17d38aaf0847e
TAG: cc3fe61642c2d7fcbd579048fdfb19ec

KEY: 1a0dfe2a6bc6a69659c68942ad0858e1df905890f47dab728ab9c73f742f469f
NONCE: f8f76b014116ba61392597de
IN: d93eead436e835a061ca061e3a53c3f9c66c6f011b21682b8a6fed098bde2018a2462aa5ab542c69bfa2805612cf6146c9150888b9720db1dcd0f359c1fa3416df4cd225dd0b0d949e917adfb3e83bf5ba2b967d48908e6b6d8aabc545335014d951a67390d7b5c7cd7dcbcf66e4e3f02aa4e5e9cccaf73e75622bad006c63433d36cb1c6aa4aa253dd1b2eacac75c548aa6648ecf9d
AD: 56ca2d5340629ca75de4e98921da352941559bd79f47ef0ab42d1d5857059352f96ee877f5458f090ca237e4eef5b08a53311c8dfd4c4582f18a93aaa8cf75080734cb2ea3389c9c74d2b04ead614eb54512ea93f0e3434e9a9366454b303a8129d6ce6cf96b1d6dd4f751311c736b517dcb50a6f6e0962c46637b4f5aaf0f34bff518cbd551a7aad3fa615708b17cf6d8fbc864f580
CT: 8dc4d8483dc665b174ba32d6b6244da5f2a8fcc4b1865d662ec23057838b332a07ff073ecc893d413696f3fffc6dca5d107a5673f14abe8e0457a02e61138380d25e269686cbbd23cb7da3060f482f62bf80a40dcc2e711ecf5f7836ca14e456c4b73a48bef90749024393f5f8af01b73302e81bc37c4110dc26174702231d831cd14231905d2dd3f375cf2bef0425084d5b19f1039f
TAG: 825e7b7e195f65c454ce9fdd637138c1

KEY: 03cec87d0a947822493b5b67b918b5c6a6bbdebe45d016ec5cb6779c3ddfb35d
NONCE: eb7d261a6b56a179c88e88ad
IN: 2326102c58524326759ad399222c5b5a563cd01a29809d6aed4d49772a4723cfdf30c9f85f031063e838f543c201412d6f085a8f5435b0b2fe94659aaf70cf7bde99309239ed5b815b48342d4f81011f5aefe10ba105ac15601c64a91076c29c3cdafaa12bdd5706dd7305b48e923873cf06944b5027b210c59d79856f602bd6481980ea909152216756d77362c59d57673cedb91ee6f56a40061e
AD: 4d0fbeb69c1869d2d23198ec49b3dc23149005a84aace7025293c3afb8cb2e38c167a822e25c2fdf667d3677f4e94ed6574529c987de506d26b7ffccf3b7a36d9adac48bca76084710338eeb5bfca9df1bf6b403e33e90761a0b3152afac333071a5ef4f54010b945d03b51f123865673e8877f41ca23359e60518f076cc64232b306bd858634417e92e546ede4ac6231635c9cfcf43aab1f8fc1e
CT: 06746f993843901ce72f2fcd4af7d15e64b3102d2f9bec0fe72cdd0b97e43177a1a2238c9c1dfc3311f701196653249e767a73dbe819b660cee07a5f3bb8f25823875fb4b4d34a5a3a212d2e166311bbe11fb1d36f4e725c3b74054ed7fffb7082203ccb5e9d65873cb8a1ce28d5c6e2b6555c1a864a725e6c7d5555d37dcaf1d0884264be72d38cc4b65bc2f0d039d542c5055da56c57e084b804
TAG: d36a4b6d2f592d4f0d347d906fc319cc

KEY: 7f4b4bfa26719d9610c80ba3f474c43127f4aa3414fb070fc2f389e5219886e1
NONCE: b144d4df961d4f1c25342d12
IN: 638982b95d66ddb689b7b92e3adb683ac0ac19480148bac9db550be034cd18dbd10f2459c915e99c385cd8dc4dc6ec48b75f97e818030fc2d8fcdf66d66b80df64f0ca4af91bba83a74f3946b17af405bbbc6e216435641f5633ad3ee24c1a2ed1b39f649acce59ee56c282a3aebaee6e97f96b34cfc63d5b0482fec20d755f399dd5f61688fe55878713cc55d562c2d72236eb674a340d1a64932cdd8534a06
AD: f2fe3d27bfc278cdcf16fffc541846d428b31534ec5cf51c30c8b6d988dc36cd6c0d41a4485a3f4469e92ea0fc7e694065bd8130c2854c95549630bd9cbaab2205f27a6efdc2c918c3be53f2d12f8f7cc8e6a81dc8be7cccd217be1fa2e6887cea7d637d2e2a390f50d2c5be10a32a9b380a400cddbdd40eac67f1fe9ba6033d4bfa88c563eaf57272c8a7052916cf4460f31ad026a0ac2588a45d082fbb5c0e
CT: 0d4de3489e09c7239972b675063579e409acbb663bea76bee8fb3f7e8785158ebe1c26db9219a9b97ea29e74762999518613249c3a87fbcd0128f651e2db8e2167f10ab532eced3464b56bcaa09780e5ece18182a6e092477ad933bd8de015c80e67c6802257a97a647fe2b1e9ab6a76c1cbf7d905deeb824aba2a34095f84b276d55ff940d6ab788c16cd63d9b16e0908d718c851a3230b0a37257751df5a38
TAG: 9f0a882d4456847f44c7287c8ff3ba04

KEY: 9799ae8045d58250e4d9c3b0ccc8897a04b5b9fb164e54019dc58d7d77b65459
NONCE: 0f20d002dbcd06528a23d5e0
IN: 8f323018b1b636617c935791e1c8023f887da67974080af07378b533a7573424f1de9193c5d38f55e9af870f6c60ab49c80d7d1ad1f18f1a34893fd2892d49c315ee668c431f5f35e3f60ecfd534b4b09b64cc77cd16b0e1b8882872cd109a5ca377518e5b660d75052e9a4228e3935705b6bf6b4f4249346b7bf4afb891641a76621cd315cd75de391c898959be945ccca7a96073f2569f217617b08502f7d569bd2f80e0
AD: 3f1e297bd91a276a4a4b613add617b0488414a57ede2ac75d10934e03be58ec518a418e98a4dbb39d2365889db7c5f389b2a16d8c702cf21b888a4cbf77b356df48a30298c825fb86128de45d7fa0e5f4b0b7bf82a2c4cad2470f33c231802263901fbda54a6edbf2df638716492157ec1407e7fc2eb6c663d9a215afbec3612778b8115e78a5fd68cf6ce66c12c0ca26e5c1f7ab079bc09c3bc7b673d21835671a13dd2a0
CT: 9a5758dad7997a766db05d698b43fd491bdcec21352032cc023bcf10e136523219745a56f0360efee75a37de55da23cc7d8184a50ccebb110bcb960dcf6b25fe731e21f26290281d9c1c7715c4e6ff3dc0026cce52929163ba222f123d4f50e1d3cf67725fb4737f4010ee2b5b163ca6251c50efe05c5ab0b1ff57b97ffa24c98653f5c82690d40c791047a3d5e553a0142fa2f4346cfcd1c849a9647885c0daaac9efe222
TAG: 5b85501a476217f100be680b2f5882cb

KEY: a26c0e3864a7dd3b589d17a74a7c9c1f7e8f9adb4aafa0e75c083d10956b6bf6
NONCE: b54a2a43ca3f84aef3824375
IN: 6fd4ec60613646490791d82de30ded1a12e61fd270f1642d2221272dbb150ef63ef2604213e203b740dfc9c4bcdf722b3c85aa20abb1197949de710d7e8311956c8649524afc72a9bf5eddf0b284c7fc6d48a741b82c215a0dcd73bb8afd08d5532a6f7f99b5c6beb2ad793d6da53a81e6523b2240729924ddac996a723421f57125f928990daa7a55a5b6b53d7361d9728f66590d969659aacd9aa5c0ec627d991b55e9fd0bf9c3210f
AD: d6d8b570eca29a48a4d408d5b27ec6aec291d70cfefcd02bbfe8d8ba8aeb6db770bfd723d2c3a4859f1992767d24e7b33e3e241874292af640e2bd22a5b77e0e9e1e0d5e485041cac41d4694ac929ae1fbc08e7591e1cef689028f5db26f95fc9e0868887fb9c635579fc6335757697f63b4f2b46664ae338eafdd827988c8f2ebad80ea9787871ed8d6b302d5dbf7e8019f2e139c59036cb5964a3701ec049b839e19e33e68b83539c8
CT: 2420e09adb24098038b2750c946551a5f6a5bdf23b126947348ddb5e938b3fcb874b33fbac6407095e05ce62df999e7234cd2b4e413009c71d855b23993cd58c1e26ba0deed891dc88f099fdf852cec0aab45f488a90edd8feb6f4c837036945bd304edbf7a2737921a2f8c1b00a1daaf9e25b908a65a8f69963fc767bc975b5b7bcc215ce37009009dc90b5c7edb1a1174a10ad28f4c1d1a2241e7ffc215edef4f847ceedf7b64f2d15
TAG: 20521b35310385ae66557740b435d204

KEY: 53ef3dc7a10e435650dd20550cf3ec2b997afc8d9e79cca8f7062622afac3496
NONCE: 257a205ed0f84016183f4613
IN: 081e2769935f945419aa06fb5fa7d8412efd1f9b52a45863808022850836c1974d53d2b2c5c0cd420711a71e6d1a09e984366b8b677e6c61bbce8f3adf9f5a9fb5860887617a08c923171d681c4fbc6d569690f6a183d42b52a80ef0693862efd22bf83b7b4014a7008424c356b5022df1842309b3a4a2caee0fd3f4d3fc52a17d53959daccf8e0ca889578ee2905dd8c17d52e76712dc104344148e8184c82af8165ea8386f91de585b54fc8535c3
AD: 5b73ae02bf4a70e57f5d48fbf45f85b8496ae8514c8aeb779c184f9cf823d8c1883c9e5a42b2c099d959c2298ace2d86c4479059256d6a4325e109fa4b6c4ce90f84a8228316e80aa86de9b5e111d88b2be447a29297b35ca90a8eb280d4c0fe92a1d593cb966cb0010bc06831efb0c72c1e222b031e900ef06ab8da542a5abe2870a0efbe92351d5915ab545b14900e41a27c5ca9d75d6277afafe7ae861131c2767eb314c0c3da5c264f8f2b4ac7
CT: 20ecb6cda861b660656d692c626436227bd4ac17a9bc71f6c84a1917ef3b5a0f6ba370f00fa2e7f1bd5aa8d6c15032572090482c23e4ab7376ef1f4dfb77f79d5dc065792fe3476c9c37614e32f493e461981b519dd7d10234c2c69264ffe5be06a8e14c81022b652c8cfa24adcc7c7536a55a2fc41e9ffcd09e1c483541cba814eafd5e09e9e44477018a41b073e387c9257c07d97e40f0761fe295d015e1f2df5be65b13f34b6ef0fe1b109ad109
TAG: c129ba4c10bc9e9c2b7d67f5f249d971

KEY: 15ddf0d794b1bf2e67db1af47b45b8abb0c62ff5fe09b29659f63ff943815c39
NONCE: a6e6b4fd129bee3ab8144da1
IN: 9c82ac83e3dd227d0cb9692703dbf41292fbaf4961e28b7407ef069e33850371ce2838b1808ec1f837511dae9899a867959183ef3d988ac20758d7a1a6859cedf687d8a42f3dd53fa4b5843e5be61422fb8774c9eb0fd22cbda5950155caa0ceaa00417f1e89a863fcc08cbf911776fbea8d7c14a6d819c070c9abe76a7f0d04598188d07fcbb822758081172e654c025703bb24c523cee2dfdc31c8d2c84534a60e7efa9f52f7e74e19c859889f9bd024f28763
AD: 892bc04375e9ad5ad2b5c117d1aacc202a74ee4cd4125019f38ed4d716ce361b8b50463ec3255a00670f5f95d361e79349e90bfccbf084586cb5fa145b9eece8a10187c13055ba0d17c0fa526ba7985f00f3eb4a2cd53b6da488827fa8481cf47f6be58771d1e40125652732a7dd5adc49cf99ed6b085fa9fe8721c86f7241b6efb6002e65ae5f72e16ce6a09ce81365485b20f1fc2e092216024b1acd0bb4c2b4ffe28d62a9a813fcc389774688eedd76c0b041
CT: e30465518e7dab44b9ca4ab6c86fd7b701e334b050a7889fefd08aa12c9e381acc7875ad5f8574fa44f8550bfc820b6d9a5600cfb82d1f98721a875610a91c8f47960ea64445c0e22fd3ebe94b3564e98b9b00a68e9bd941eef5382a67782c5e24ac44b928fc986c62a02fc702b145843b1c6882188dcbbb6f6b51ce1aa7784da03cbdc3efb1a01c1cfd7e90dc3332fc6e912a6a967ef1f239cfdc9752e235dfe75dab8088f8cc207a4a28994f122859aeb52d01
TAG: 62e7455cd6b95319efa3ae0d14b88452

KEY: dc0cff51030582f29676482ec8dbf0490a135a4cf3e444edfb7d1ec733cdf7b9
NONCE: 58c892d618ceb6027afbabb9
IN: d6c4d49a9431d51bfda5bd4b07997690748fdc3df196d27d219a62480dfcb6300c5a234d675aec1239280446cc134bd4e0e0b5ebf6f10bb11b788caf949c0c3553497b62e729f08700b66c6720c35f1f434f16b15a4e404d627fd054ae1394a77d5ba728f3422aad5d99a608c2aa52b058946a76a408c5dfb210d280629ac999e86ab1f9da8f2b7b79ec07cb666105582564974180ace98c63bdb962e4580692abe58929d29f066d2f7e25c23a3824483d9e49cb6f5fc4a1b0
AD: ee3bc8d875a4d43c278cfeefed8ced8a3da946adaef93dc356001da151010548990fe08b62edda46634db320601c7f4b50956e29868bda9ae5df186f15c3ab4a19d7cec274209cecc71602e45c37c273b7e4b2a168de5c29278042a3dd1fbea0998d7d9707d412f476ac8de7936e2e5c268a2f22646f682e664e526f88004e7c461bd42337dd21b1cb39ff678974adb67c2ea1b7055ca98697ec16c4b3bfa95b4dcbd7fb015480135634c34acb20f58549f7e7e11e20a991a1
CT: 54eedf8ca21f31d21067af5a05dc3cb99c3dc046540d2cd1664abb32fc7714ac057d039cebdeb124e1ca9511bc71f92ddfd4c6bd3edc8a1934f2fa2511503944f2a0818e30b9bdd26bd3c51b9673f55ad3f2ee5e41de114ccc55abcdce06a5bcf63a5bd61fe71dbbfc97e1c7f3417fcb9c1462e244ad91725081c9176a0b91d3485400d273a16eecd870ec1e9e016a7f4af2fab39a0bc93576ffd1eeef9cc15b7e47feaef85b21de422666ec722cbaef26edd1941e7dc03f72
TAG: 1cc8c395b2ccae3a685183667ee7bd34

KEY: 90da49f8f64e8a585697a43644a48bcbef33a8ed23c1a93c65e59a217c04a1e0
NONCE: 0812f87792508dee6868d454
IN: 26dac57d9f30bae5831f98ed074cbc9af9731a52b2322cdd23f1f0abbf78092c48d6d24a43c7d49edb3fa66086030f37dd9dc67847714437b11577d2bec645b3210baa8f7a540cbfc20deec5973b7489b7607eafe72e249df5d0fed95e29f03cf7f0c7a22fb2f06a0bc75214446b06d25a45ab8087270eec56af3960f53b80412a4ea7b45e54a2c374e8a3789e8eb57e656e22107503920313ee3e4025836b9e1a98541446c23bd5674cb83483642f2f3e8270bd1f77c85bcfb205a9133c
AD: f2168cef97c27a902d93cbca07b03f35c5c3ed934192d29a743c3a6c480c5a62172c088fc89cb2d8651b8979e5bd1864272ff179be8003c6dee18789c17583dc1de4e8b4fec80e5c7575838e621cac4b5b51ce5952f22e06b1c196101d2ac8d05e797323e5baacc49d1e74db97142e1bed723d46ab858d59fd36d5d08eaa63f696b610eebdc9662e504992fd3481de1264bcac8ac426b09fbc641ebc93f72c5d460088fe0b08420d88fae219b6a5a67420a5f9d1201bf8d64b2ab3e9050a
CT: 82196d89624689bb172e4ff71619046a91149c8ea99ebbaa3f2c32c77938b5ac466481575dd82a008c7f5867bc46ee44faf95fa40b6237c8c3b62474af2efcf07c771e23a63e65b48b0bd8ed26fc64dffe03e71fac6d3857b1248df63d888567d7d3618c68d6b8f1c88029bd7af8677d3b51f70ccccb4eec9e100768515637ad8a4b2e2e317902e456974ce9fe23095cc68566e85cd913e8b64119444f124640d16ef3e98136f32d618eef78f7ffbafb64227b3185bda8f541c0e7ee8405
TAG: 71fffdbd6358f755dd22f1dbe42c4aca

KEY: 0b1b256665284390a9193b7b7aa4e3ad15a3d2a58e79d75da8ec284c02fa3a2f
NONCE: 346ae65660de8920605fe8d1
IN: acfa83f56f137ac39d6447d98c5f7d5e812d1d8e7c7fa7f7beea9a87c59961449683fcf5332c9ef1587135030309a1c2d95257114b790b18cc32f65f4c7d1652c0106e3331f826e9b8b0dffc50aa6723d0827076b71c668370ddc8156db3831559a72e48266b3886a6d88318e6ca646ff561ed4f71e665abb7a60089f0a115c7b7fad9cbba6c4cb0c242b9e1f17705825d98f4bc10bacd8ab2e11cf579f29b2a0b085d8c96a372434785856b483c3fc9ae909029b0c931098d7e59f233cb6450fe0b0d
AD: 64347fc132379d39cf142ca81d7e49c010f54f354ca3365d5195a7e43175c9a47603062c5ca61aaf2b381f5cd538bbf48f50d620ff2b5980c086049a378aca69570ab7c406b510a6aa6b7e8682ade6a091b1f822a97ce671fcf7c911c43c4795b78ce1c86e990e32bc5c9fa34a8a4b22a20d6f7c46722d1bafd49443b4da9634db4615f7cabc3d5bd9a8921e67de45dac261f54bcd0af2b2f845e255a16f2d2f1ffe26e88238f5dbdbe111393aab3409e08dee8b9bc85c51b385c191ee9290454236ab
CT: 9d7421330f0c2a525495bc360cd5c2273531d050d461336a254c9af8611d07c3559931cd6804fbdc6e6c9c997283cf40bc23596efd1bf116fffcc6620e45d1c738569af012a7ed0d575ace3c12662f88f3ee480af30ee015ae70db112bf4a185e220660a912f9ad840346e7cc0715e853dcd9b415ca9e865d5e4de2321e6a1b7cd8a35c760abd3f099d395576a91503147bdd51cb4bd1452c4043b42dd526de6f61bcbe819cfa3c122c6f62e0d4c38b443f5a138325a5f0ff8a9a2071c2773ce62edda
TAG: 2af508d74bcf8157ae9c55b28b5d2db9

KEY: c055bfc7828d9fe8fa8d9851d33f3e4888e0f7e286e1eed455e14832369f26fa
NONCE: 2804e5ec079eada8bb3946e4
IN: a26a9b189ada0ccafab92a79711360c7c396374c6170de395bd8ed80dc5db96ef1534adc4dcd419fdf1801add1444a195367213e374eb1ab093f1f54cd82eaba5c1cde6b867e0d8fff99cdab4d96e69aee0c58a64120ce0cfd923f15cdf65076a12e06e53ab37463096d9ccb11ec654e401c24309fda7afa45ee26e5e4b8adc8febbddaff1e7cecacad1d825a6b16a115287b4b3c9f8a29b30fa6236ca6e883abda412177af38b93e0e64b012d33d7bf52ed18c4219bdf07f36151b7ea4c53091ddfe58b6c9beeca
AD: a184e4811d5565849a08d0b312f009143ac954d426ca8d563ad47550688c82dbddc1edbdea672f3a94a3c145676de66085ded7bcf356c5b7e798f5ab3bb3a11bd63c485fbcded50c3b31f914d020840cbc936c24e0b3245fead8c2f0f3e10b165d5f9c3f6be8f8d9e99b97efda5c6722051d5b81a343a7d107e30d9319c94dbc7c31c23b06a4ae948f276d0eabd050394c05781712b879317ac03eb7752462f048bcd0dccb5440f6740ad0a3a4c742c3da32a49dfda82ed1b66380a8cfd09dda73178ffa49236d20
CT: 58dca29b5008f74bf132947df768dc85e2492a381429f151a3bad3132e63a4a977aa09f10879d206f43f27a26909495d0a2c8cb252fbcb3abd953f6e0ef0f6d5e89d89a1d9ecdb0e44686fbf5567a6fe7557a084a8a5ef5316890917bc432164266a331118c828fad4f5d1776645d163dc5444c2e12def608efb47adeb8f9928a5ffd3c46f963a749c310688e78525e34a510f529472a14bc7a5b65594338f6f5ea1d95bb5bddc6e8e1d1a449d126442accd162e4e03c10824fd48b32df763de5d7700dafc54206b
TAG: 141c80e1d044e1e9cf1c217bd881589c

KEY: a54a347a7a388c2e0661d4ae1b5743d1c2f9116c0a7aa2d6c778a21e2bf691a9
NONCE: bd3456b0dd0e971451627522
IN: 3d17e3d9b5020d51295f7bd72e524027e763b94e045755af4b3cc4f86bce632a1286f71734e051dbcac95780b9817b5f1b272c419e6bc00d90c27496ac5ab8a65d63c2ea16eeeebe4b06457e66beeed20fc8d23a9b844ba2cc3eb3d87e16e1230fdb6a9134bad3e42eadccd49baed5e03e055f389a488d939c276982e4bc77f0a1c738fcdee222e2641b06fe12ed63ede2ab2fee3c54d7901d0911c32980b7c663a67d35ece23136c77f8e4536464225ab427d937e7a4260460d55bb5fdd7ea2f105604c4b0cf129dec49b81b1
AD: c12d1ffb08acf27d51e63f5c0e311180b687438e825204074d4456d70b7c5ba9903ad0b0778a5fe36c3e12e82718c00f5d1ce585e5c73b23d6c5e41ac4a180c97c9418b07ccccbfc58c678e97882ea36395c0a05572b4cd25ddb3c32fa580c89c48a0e3066b8032e3823893a5721a4fd1e59c7d012a01b9e9afc12f3bea93e9d1a2cf5cab26e064576b36bb65606de62fe2887ace0cf399dec08da618954ce55362c8a2bcf31457a1804bbfff68a76d752f9aea81be8868bbca8f1af3375f7137941a1924b8a2b178f06a9e33f
CT: 938f8f596e17eae6920410f602c805ad9715833087e1d543eb20b1b313771266dc6a8f86f2ba033609fadec92ac38c1f1f0f728e568fe8bcecbae2ade7b9c4128fb3133c8b4107ad5c29cacbd5937f66905e18cc52d9239c14e4c8edbb2db89b26f5f4a9ff0f2045192fd212af6c65e448834580deb8787b612d6345466483dbec00b03fee4751f543a6155f2dbb745c1094e9721aea3e544a894e4a19a14645725cb8fdc21d259e086b1e411fb1bdb11293d0224ada25da2896dfe0d35095230af6894404d27d901540b0ec35
TAG: c55c870a5eac5c0c774dd10dbadd3fec

KEY: b262f6a609c4ad6da3710d58530b634fd7bed875956d426bf4b2412209902233
NONCE: 0b455031d28e4e17a45b7a60
IN: 9cff6ec8832bd0e62d9063e43821db6a1e0f3ae7947ab4d029643b0e7db8224f8bd00a2c011b246a4d5eccf9801fb314aeadc0532fa71cffe188e801d7c045e81b9dfc5cf6ae1e310b363adec4e7ca52fa754ece2540545a5161eaf9ed5748070b6e232125fa8e0fb7548fd3eed57a6be72ce0a9112f166776816a0a4ccf8151b6b93780875d03ea3d59ac57e7904c83b90b7666de85f055b25f9e342af4cb04b0c3f123ea0906c04f252f2b16b28d612e37b2a7b788d66beb8b361385efb73a825ccfb1a5ca55d60afde0349e5dad8096c7
AD: fb99bc661b51464c0df92ba4f64c4c56d601622287bb1bf8e0a082ed3793e74db6a2f5a546391ef55dc45fd2f24878834bdc2903054d9d02ac05bd5ff122b65555d7ab1664cc36b630039e4432315445f303837e57149fdf6bf8d6856ba97abc5a18b6cd2f8f28cd3ac079355b314561c50126812861c39180fd94f9aa24edbec37bead760093d32b96ce30e389f63b2b271fc051b42952b3f5cf3950def581f7cbb2b4aa5b151a16ed3773166761232c106d3ff57851895640ea12befd69daadecc4122b4a481e85088edb093e02d5d3d8a
CT: 5341e8c7e67303d5374e3f5693c28dd9f9a5c9368efaaf82d900b4a4ab44337f7d53364544bbd822020d79443e2ab0fd2381bc73750203caa3d28858a8f9a6dba57a7c5248361ebb152a81a89c00b1bf49de9e2d08c0243b38eefe316ef89164b4907515f340468291e0b51009c9d80cf5a998d9cd8fce41d0c7405fc2d1854aae873f0e24cfad253ee07d9f4cd27080ee8ec85d787459080a06d290e6e721d23738470835f173ed815f1a15f293ffe95ad973210486372e19a9cc737c73928572cbc03f64201d1b6fd23ebb7b49d12f2eef
TAG: 5e0ac1993ceccc89d44cfa37bb319d1c

KEY: 9b4387e01c03d2e039a44ca2991aa8557dea6179d19259d819d70ab2d5179eb0
NONCE: 852124b4e04d7d1d63743d74
IN: 92c6f01cd2cd959495bd8aca704f948060bee01ca61c46005b4db43e2e7655af4c0d96656cd75d904325ecc325f5fc9a5fff3eeafde6f81323b0e3b64269028cb64c9fbe866b400e76487f1759d6ab8fc66589e23df0c008974e1613bb4ec556bd1a6a0751f6dbbbaeff219874c57dffca59a955e0aae62e8fd6a904a50fa7eaacccc6dfd4a2b8c6c040505d3448ed2217b7024224bbc4335c63b2ae8172d7d3088b819edbaa17991a4729bcd5a456cad20ba20dbee99ae56f8ef669dff93c99a995c8f5dcb5d113db4178a49516206a1cba7d872682b1
AD: 92a1d2574182f850e37aa62338b19f403fe99dbc7ddbe1e6524ac67c4092cfe296b5ee9b94eddb5c228c902c18ec1ec26e1ef0263d05c5caf1c71ed9e5ff987e9964b46f27be05a83e20867f1f2107db26b6bc7066af2b0efdcad2b65f2ebe8b31fbe2f3c30171f2e4969f1650c9642ae47c8db5bda47e57e8a9af210a6fd4894dcc2934b4ecf823cc841cdb3c93ecc779b455b8cc796d7d60437da201c3f848dcd5f45e88973e06364e7cd01afd2d49fd3032550f1c1a60c4ba48137398f4d58e5fd0093c06042b103ce0064f2cd1cfdd39b7440121d7
CT: 28b87d324854d5c9c6ebb303fb802b12d946ed681ed5b3384dce2cd782bfbd022f213f193bcac579176440bbf2af378b019d21dde5d70e42d257722d15417a9fecc8e56430551ea3bee798a01faf74d0fb09be6dd0c14cd03feaae29c7d17581e1fda0b4bce632ef790202e98c8c4f8f842fb3e33b3fa5e8700c8644ed6d64280652bc2a5d40b3ee0e47dd5a9f3535e15b1fabb30264515afd4f9b1caa5c224574636935baebf6d1992bf1a7a3d698d457db4248a2b38a803837ac4fab7998722d52de61bfab4f98e1933a77046bfb3941bb7988acebce
TAG: 1b07d58be48b81f7007e5683b399dc28

KEY: 9d36155d429b90b5ff22ded128c9f0cfe77ed514d410998091bfca4dce7e3c88
NONCE: a7b73ba1b2b0e846c3f635aa
IN: 2510210b420b12300d51ee4a7ad233c9c97d71672c0f9a7b9041d32172fdf3a6ce274aca77a0db6961d7921d1681ede2c1088a7618382481296778e7f56d2c0074c7c545ccda313495ae2a6dfd042474b07d2b59c79a0cd8c3dc16132beff1687111a48ee3d291ac556987e73c5a3807923c2deb3b9a59a135a8fa0d85d5b39016edfe0649dc13be672a639db58839d3362eaeca046767fa1182ef8a63abc104e7cdc8610b1e956aac89af76b40844a358fe6f7343d217e1838aad19587ab4b1c765d2cd7bf7018e338c0207d4c9dabdb1625af0c75749e9a20a0d8d
AD: 39e96c8d824bee306189a3bc8a8d4862df55e8016726222a528d76de169746a363e82e82e359b774d061a6e98e3c35aca8ba802a5956a2c512501fed44ae341cfa65ec9d95485763d99cbd9aea078ce551f7f82272bf54dfb6420ae7653f275ef145b2c87720c9ccfa56bd286c61cb822d0473dc2cc3fa22d50fd16bc0358e7c615aa1791b990f30b1d737f798219f4446d173e80fa62380dfdfebdb36b1284a62c2b6638f28fc370034812d09b57d27e5b7d589075bbab42fcd6a91fa2714538be6286e4c7b2657b80f045df7f8954738efa7d49a38e5a55a2af934
CT: 8cb991b10218bfefa522e2f808dc973620ea391623947cb260b852efd28939ccca4c8b1f02d66fd6d0d7058854fac028fa0f23e8de801ed9a4361bf7e5a23e6a7086624a64a29815bedd5e5ebe4d9f9386d47e1408286971654b38ff8e5dd1fef7686d7614ef01900ad33bf97896b4ad02e7445782b1794b45af967ca3ba72a2e5cd5252a9ff0ff550ee56fdd8aa555bbb0bf8a5dd534fd65b13235fa6650761dfe2a28b2757077a2680ef88c84eaada743d1f0d25de38fdd1974ffc07dbb9c7fa67cacca309a10753c6e2561c4784470f5c7e116e12070fb3d87131
TAG: 665fe87506f8df07d173fedcc401d18b

KEY: bd187500219308edd6ac7340d72813ee20054d6d4b1bc2ebcde466046e96a255
NONCE: aab93d3181e7a04cedf17031
IN: 55b824816e045702526f8b5def71a0d023a2e42257fc1e06f9a8531ef9f7717474ba4f469e442b471d5da6e71aa635a307205c0a935a54b8a59be8856144dec435e29aa1a3568073aa6bd3439bc0f219fa1179ba0a316f7d966ea379da16be4db2f1fdac2fa6d00bef9351b78bb2773bc30ddc9d019e6e7d78dfaf38010080027afac33e751c0429ef6c70a1f2d01f103482818e9353e39a3a4b785a7dd2c7e1ba7a4c36a5f3836d5465c002bcd1ac576d90ad276952ac155dabba6873e6d92b5278280a540071b205ba99b77b7568862e70e6ddbd804906c33fa130f8b0862001
AD: 11b35743bbcd0113d2c188f75d382df44e874a2d4b3c3148ecf8e0406479305f29197a3a71dc7bcd71b6136ab11a7cf46de80140e15046acfa18774cbcc755e9f3beb37202fc308c03b1c20470b3128f5b91d925bd6703dfb3277d65159688f656d5ccd83d2beadfd778854472b1cb8fe440bdb7efe806f4cb95249cddf69fa0013dc5a626eb8ab69a48b3ddb1a317b35f7772f711221cee1cee9469e2639c44448c5942c95324dc2fcfdc952e05aa336ddbaf57cec2d1b33981ecb8f70ccd34a279b211c50a7784906f2981a2d2ad8fb130100c4f6bdb09c95dfcf4b0eb7ac6d5
CT: 1e99d06f82333ec8e4fa1e81014458c81325e5d69db561449b153727da35c0b540c570b60488aca6aae58f75f84792388d0160dc45e4e5bef552c49228d806fcc22259f0f94da2f786cc94a3ecf3cc15ac67719379d86abaa54ce41e868110ed2b56dbeeaad4a444eab51a96aed404a4f4b9677d22345fdb67ed0df091d23d8acd70bf6cd29f19c99910888b3281b65637590af984e493ac70011486ca88e72fd14ef1cba06a50070f138dfaed35ab12690a14b1c8ac319f597bb690cae28019d64c868acf9a58fde1d8aa18dc1ec9c3c4a0ee9c4cfff8912b1bf23c805af6df48
TAG: 1a43147e6e097a46b61f8b05c7dbbe1b

KEY: ce53e967bb4675a51652a9e6e87da6be36d16245c1e37ee00bae09cc30ed8528
NONCE: 0f53ed18bfdd28918c3993d9
IN: 3f2416477ff2ce7da3e5766f043e7a06ea2b87fdf06320d296c71cbaec4b115da356f8c7f34220f91e90c97a5cbbb7fcf0048fb89414eddeb2ec1062d08cc75a39a1f9f214fc3efd6fc8e70d78418007d7d28944b3f37fa5667ff79098d7af36a9324419b53efa76e98a311e1436ecedd977397cd02cc8d377ea8558edca35ff4c71ec31943119b76af4c78a435033eafe73c7079224bf2328b49ed58acef9b043ae3c7ff17a66b521e190d6ca2b2835ed8edc2c173f04616af237391a4440fc5306366c834f6a504e902dca6d3e9e1554088eaf5b15db7fc1fa19f0867ece90ded639ee8072
AD: 64a596ffca0889833fcb537f58d94791f9ba9b6b7ce0c7f144f2f1a95d62ce334f7bf7f0d2ef0c6e7afa2324b069dc6a7a522f19a001c335cc0252ac4a26079c3f267cdca1e3f933069f52fe72e1a00c83d8fcbd2e76149a912c7b37663c2e7967a3a80656c87094d349af6b9d64b3873f467ed376eaa1e0abae06180c847e981c6a12d32b580acd34f779c343f8b79df1b5004d333a5c37a8be7a94c6f6400f819ffbe6d54d3c1a92824fb15c279fc8121c735b6c42248ee22e665245966d40eadc51f12904cd64110d69354cc9d9fc415b3469317d5e4643942dd4b649de0ee2fc5d200701
CT: be462da8cc9d8cdf343f7025df0b8b41c24f7b6060cea2d3c63338b6c3e83f0797e966b8c5dd889bf1b5058fb4d694be2178fb33d9be1a351812046a6d3bd36c84ee3665d39fb98159e4d30f8a25a60064caf980f744fc519e2dc451f5fbcc0834b72920d32f0492abedc1022b0db4f2f44b91ec48c588334775fac91f174a4714b3825e96fa53cad3de94807f3b888950c8776189cc18fdf379cdc9d6054952c6ed2b3fb7f6b49beebacee7ddcb19a3eaee2b2e2b7a5d6476e5fc1f216ca443b859a9a661dcf2f7709f87361186368a62f255d78150f09ad4ab1a20e7329f3d96fa2a33cbf6
TAG: 1cf74908f6fbfa5b2b309ebeff2f3ad1

KEY: 093d932ed969cfae63f07e0c04c7f9eaf1b36f656095f8d5f112517dfc430cdc
NONCE: ce36a837ae93a280d2fffc63
IN: d9da99635f8d728843dd587cbb24e68e1df2f81b5f7abfe233a224cdbd48cd8b82da3711d2ab6c1ca722610b87f426a2cdee4456b50781e3b25da037ca636f2a5eea01f4eeea52d0feb7f1f6c2594d63d8c05c2adf339839449cb1d2aca94852d1b64b5641a572c2da02ebe299c7d1ff4da8706f44b14602f44c0ced711fc78005f87b1686106250d3d3860b67f5b38788db1891150f88d4c5276751afa0b2e37a59587cd8b718767455e65eef25bddaf787d52b88556710f740f117b02f244edd47cf0e45646d40e789671ae61ab06336e24fad8b64cd8f60b427ea1f58af443c6f55d54028edd5f40d78
AD: 5e9c95c3449cee3f9f726be031089b2358ee92fe7b408b355739c8da6369304f3b287ca60dde4685bdc59879e1530ffd8f6589449196abf0f0dc6dcd82ba7fba481f13376cf29b32af2ecca24a161e6e57b6db70a7e02ee2154cc0bb5280b08f8dca35b1a342fa18b8025c7a805cebaed99e30b43c139de7c37adc25b0b6b5d873ed86530622ef2d0ed3ab19e9c27df98a4a15324f902c35a23adcad4598c6e990c64893355be15fa7320c1935b4ad3c069c068d6b3c8f43d6fe0588b59170bf567ac3a53a50db68e4be17964f55acfe695638cb5fdea5c40805334a385c2d35aa836637ccdf71390487d9
CT: 40380718f069f44c88932af22a10f80513821caa71fd7a9e5c4f37e1c756c43fe491ac13f244bd1299844cc78d7812110f570b693e63614e639ec7395cf65c206eb6fc9bba86f89d03dd19e45d5ec64c7d3a308ced4ac1f59cf4e13be64e49acd9ebee209afc508c97ac817f1367629af9d59b0cd48f138d23abb61f92dac530351f46a4e7f70ac87388e44f6e9548d3e6a26884bb7611f632da7db2a12fd9174773e685df316ea9401d8b352135b6b32a374eef8661b77eeedc34fa4178d0a5731ac9bfc14bce1dfe96af095b0088371ab1a04b2062625f0c4fdf01fc0a6bbf1661cca11932e93690501a
TAG: ef7f960b146747ba4f25c705d942f8c7

KEY: 86875efa72ec1827f133a8935193292463ecef801bf3b461c96b0312cfcf32e1
NONCE: 738136465c8935d77c8d4ea4
IN: d692d3ef47a5c9d0d9a3b6a0d498e90a3ea06278134ce90cc1d69da2159d9a1f5d0a9ef4b4ce5f873e26e8f9d53ced79991491325ba5511be4d9e6563b70459b10e60d8c5da45d3b0b34dad86772b0560314f0215bef7b55c6ae53999cb2d6a14a35b50fe5a1598adb7ebeee097968ee7624bde42862824900c8cb45b12785d9c4d50ef38133d31a66a612d8638008d03edd19c4d7edb5f9b9f195c60883a7d6aa85bc3ca3b59c395b85dbe9bb30ef6896c4ebae8d72cbecfadfa451bf36631aefddd3feb36978aa8d9a45c9fa09bfa0b2c040d9a422840e68f4dcc3eb902f6be1d91b11e1749183d89715761b6cf22c
AD: 17208cfe5a96adf0ec903c7618d994492d3eb77275fe5bfce5ab1f67d27431c7746314e52934b8c44481e5760cc8f6b0e17d1fcac7fd5b476196e3152c3dc90adeb58c2c9c62cd684b4b18d4a94f8e5b4336ed3f1758b58a254f48b3aecd9cfa63cf758f2df54c52eb246d046198b6eabc90b2a0dd6c5323e915a117235174fc9089cc9bcb1a3bb49080cbcc24367e7f4e17e27a2054bdda0ad8996df1cfc6bcf43f70cd854f4d97aaa4badb5826dd86765d36a2ecc83d3daaf31594eff02999a423185356d693f26025a576037336c156543353423dd3b5da75f45e297c60dd8e091b961f60eb6786fc988f6324f9e8
CT: 55f48dc2b6836b8603e19264382ddfc568b1bf06e678de255d355fd865ef03339f644312c4372494386589431d4ae7af2eaee5dd3c16340ecae3e87dda9220a5f9b9fe6cc3eaa226d9608385b7e8a6216e7da71997088eaf7c67b5402be01c0b182383ed3c0e72e91fc51fc99c59cc8271660dd7a59ee0e7d9626ccd4439bb9a1499c71492807f8126891ce09451d07d9c5525c5f185559ec44aa31498be3fc574389cf948640dcc37d0b122249060bb7d5d7e5194d4b7a7bb64d98d82a1155e30970a854f7c0d294fbb1a9e058f3b9f4762972c21086e0bf228768d0d879a9cdb110f9e3a172feca7417d48b3fa0b0b
TAG: e588a9849c6b7556b2f9068d5f9ead57

KEY: e9467b3a75dde39b0dd44e7cbf2b70ba1757ba6a2f70cc233d5258e321d5b3ad
NONCE: a9756c7b8e2e2f4e0459f1bb
IN: d6d7f6112947be12e7ec8d27ce02924503f548456d0ba407bf23e848b9ecc310e4a0c7b00c0de141777a94cb4b84a5cc34b2b05c8a37cda08b6c2dba80e80853f2a18bcc41341a719f84262b601610a93721f638a8ca651a2f6c03c3cf1070f32b92c4ab7a4982a8f5e8ae70800f7513405f3ae28ba97a9ce8241608eeb5351e6cef5560c4209790ee528b3876896846e013a0bd3a1aa89edaefe08fb4b73b3fa64c0c8b0f7ab70653ee138456319230174f0f1f7f3477f0cfc80eab8a96e29e85e20658cebb830ba216b1d8281ce499f729278dcfeb59cde3a043ef3fe2c42705f311a422e9f80fc3b58ca849dd4b99e5e66a958c
AD: ccab7afe4d320e94f77963d779ade1343e66ae80446eaa5f9ec4d3e3bb3166255e4aac5707ab407b284dfcdbb18ff515cf08790f0470cf335946040438c7de2d2a342096d7607e1920d86b519e96cec1715f4b0dfe375c5959644bd664d23d879b825dffbbdc458ea9da5ede5682ce1ad1cff33dd8820761b1c067cec638873a3cae79c7682ee8d4f97cb96a413dbbded1c242ca669d50ebb6de3c27eca3041fa8aee8974c3d17b0cf79c32c7bbfe20dcfd57303cc40334fbdc43e925df1d63fde57bf60553d7790fc56bd95e675db934dabb1125eb97cded95f397b32bfb3a2d40703e3f11c6c226633b3cb7f9da1e3367de2ba4d
CT: 47bb258ddc0945079a0b99ed5cdc0186f453f8e0393cfea258412e423dde4a00c014ac298c4dfe7c03b0d9bbd4ad189624cb6fbaf13e60ec2b4d83c5bc3294dfec30bd6c8f7125e11d7be145a966dfd78fd77af68099b855989fe077cd9f427d4381b4930abc1daae55722540e4bcbe1b560fde208ef1c2dfcaa2c51b76072e67da311c2556eaa2c25413bfc43d00dd84aa8859b296e05945683e028699d60a29227de1363c4138b9ec2db8f3b502fe09d368c5f2ffd81abe50cc1ec1ef216f27f401456d061429d1910623af00bcf500cbc6509c5aebf7de9c956e40a3f0b0d562775b03c282c204e33c0b380ce1475eb5c0441f6
TAG: 9ea19333f5050354a7937fed68e38dd4

KEY: 4e323dedb68bb5cc4cf2edfe3a54a19b410f849492ed6f66fc053d8903c3d766
NONCE: f77b876eff796db621eabe88
IN: a7514c4111d7d8bce2d56faee25d9f5fbb527162576b444fadebf42d48d2631cfed344b0437ce8a7609bf30bf0a44aef172f8b12ea7567cfa5dccbd08bb3115efec59437ff02e7128df9d9e5193794373e30dff7b3d8ec0fcd6cd3872d755c0314f1cd9cb996e4c6ca8ee2e35f9b64a1f0bd1669369f9b333a356ba58e553ff9bf9cb6c5522599dccca2f7f57a91006e7dca4095d11955e5aabff69febb98a408aee92293c0abc12ff23482ebe9d541bf8fc7493eef2c68044dd185eb243b54a2bad9844d831d9b0766a0ef013ad3ac03627b1feeb287e5e61875bb1d0a01315761bae6323a9d678cdcd3c4a85be71b70213d081b348c63fc603
AD: 9bd10dc97ab5e9b35e1c8c36ef37f90a11bae7dd18af436fa8b283eafe04a5bbb16bede6ce1260187299ae6474628e706cc08b3627f5243f1a9ab469455666e6d5f2ab597b6799bd60a365a9248341decc36d473fa52ac5ac469b965cb2023d43b437dded84ad49de95a6dfc6ae4bbefaf86f9b06e3a33ec90d32ea3af541fd2c43387c75dbd94d44b9582e8ea41afba5e49f1d158d48e979d04888fbd42876e12bfd6695cb99640c537f2f9223d37cf6b627207b9318bd1f4c64556b5db1101c486c53dd8dccd7405e148d6d9b38b7ac875a44bd6df75edfa4da8594a9c43b223e7a6f5b81a5cb8dd6e06e9a976ef156e45520af332e4d56035
CT: 9885d7a11004ec546955fb7a8c77ae57588fa2e7fedcc8e9000123495b9016d1a101fec1e6724302e93eb8e01bd05efbe8502eb97b1064bafa9bba5658b1677819cec4998dbf02df1f1eef51bb3e75c19f570efdda98b0b8dc5dd9250eae8396090ca9ebecdb90f32c5e2085e86b64e57464d251af62d9f8c01d7bd6cec5f9dfa5eb7c4cd412077571bd071a4eff5098883940d63b917c08bf373916cccd7a446abff0aa5c687518703c25cd8d3c5d724f348e20be54f77fd18dbf6344d1d25c788ccb5a5747d575435829b1825e31f9e94abc33c0d2750fb62ae167a7a74fc9e39db620d43e0b8514d5f70a647e53dd5764254b7785b1519474
TAG: 936072d637b12b0b6a4141050f4024ce

KEY: e57e74595d230e8eae078df1dbc071c66a979a912e2252257e28447e97fc82a7
NONCE: b613d6d5fff507e917674f2f
IN: f1ecbb2a45f04ca844616528b10ffa4d2c5d522ed4ae3366888fb371b6ee7eb4be53c8204783e43265931f58f308623f7b2733384c173540aa0bdf879fad0283c2be6c42a7b4feb2b29265fffdb518ea77d33507dbbff7d9921bd97fd27f1100402e02135f7df4b5df85f7472fa75618facca3e24d487453e831efa91242e62ee9d32880bc20f7ec016eb12edb589dc8a669f7c78375f915d7c2b03457b00ac2aceaf37c0369a85c3f6fe7c0447c022d66bb5acaee62163837a36e882cfb8579ba9182d3153a25623f339758ede5a62f67b199fc8abe235fe4b607a6804fd4d15378c76e0c26c1edf1cd637b7ea59edc66cd5ef9b8cf79b95ff89c235ab195
AD: bf4c0737e461c1d6fc45b87175fd7833625c98a03e089c4e3d47c6b21f4bf38cb4b7666322217eb8fa022afae473df56ba3502c88cf702276bf39c6fcccf01e629925a83816a5096e612458af6380dcb7f63cfc0eae99d63475616b18b44111a1927b05503c4ce46ca48321b0f8f247a54919fc844fbabd3a2481e83bed8a5ee8086d7559db00fd1d64f4892ee9363d59829ce1e10af66696c28e86297b43190800251f346bec1b577446120529d486266a271c71011528b24ff4caf2c30f9748a2b03c788dd583541368a643075a52127c48b3b6f0c6ef413e61479c9afdbeb4bda44340ff0d81c7bc0321d3de4080cf7e108dda3fd4e480e685b202c6bfc
CT: afb2aae2dce03cb0bd3467447ef6895a132cec06b9f7764ee24d90078660dc820b8384c01375e03c20a6c688a780d7d7fbe5837d477e8f3d7ab3ab865dacb0eedb5694d3276ea914a421b03b9d4e4f586227a3af7e8d5d579bd832450f038eaa7bac57aab996df55367ddf59b338e5d370e310124e8ef43c9fe54e5d23d60023aee266054ea66c9f32170ce97998b527073fd178ed4e1752cb9c515c0b32766b363c39c513c2e9ff6d1c24807afb43af3c5a317f1536087d8576fa3be3b007d3a77ab0422303cd0b142c4ad194e1bb86471b91861235dc336dfe9666f4f2c6a32a92b8fc52b99873f9792cb359476a2aea21996d21c17ab814de4a52eeeb33
TAG: 05906cbf531931559cf2d86c383c145e

KEY: 847eb274561fdf0c1af8b565a92da74641f17261a0ea4cf63ba5f36ba7028192
NONCE: a379511688390ade6f0318bb
IN: 1e588cd0636f34b656b140b591a9adafb8dc68d0abb75531942e3c6ec1d29e4f67853e3d718dbe61b733490525c7f9ce6746f8639e4d271267a95f0940b3406c67ded0aaed36374b9a4bb8c753579051c6dc3244d6126a8a97d4a912569ba139d55dd00c380e7ec450d44f6c7b9482c2594b21f61ef8d165666c830867139262be5ad3a31f44a286d7e86d4e5c9bd6118147efc8e606c522ad0e9a218aea4daa39d1653157e4c3730240fff67a42e4f34186de1c13ddcb1e44020b7a31d21ba6ba96b3f42360dd1d754a7bae75b6fdb6eb3c76412cc1fd8e900d7aacf4d897f4224f19a1d44a77e06c95eda5fe76b11c6f5088e8ca75c87e07edc64c09a6a31371552449
AD: 331d48e814f660516f3a796b08afb1312625b3b17218819cfdbbbca4c333378b57fd93482d971992b5b15b62f0724d6e7b9beb5ddffd3c70b6f8bdd3cd826663eeb91d37734a686c987efeb4d4906b80c5378fcd07806d2dbf3eb528472a110743df8cd96b6eb67e98b13ac506c9bda167f045a412c93d78e860c9b4bbd7a2d71adbd3530f30253847b4112d4b898b520c7a14fd075e62605b05084f26fd138179c2791fd6e8d3bfbb2735002ae12d986f92d7d300fd6f1dc12c993449f8522f6f32f506a677c8a981aef9815e83019713b2f9943acc8d5b3f6f65b9e2b9a14ad2e300d636166da2d35a6a0a756a76d08709a043d65341695490124971a7574cf0b5845a
CT: fc1f0d7309e6420b42d59740c9b9d4b97075b874015251ad55483068b00f87502b18182b140db07c70a80fd884fd79b7b5fef1d307ca4db0ff046494443e1cae83478d275c31402035f1fc24e26214b78d9a4dac78d074150012f9fee810a121d87a16d8e1eec5700e9facba350029788480a259d9f30df1c2b8df7691629314391719853c0b68614134f6028865700b1fc4e7f34ff28f449c6abc3027f38d7a7f6d84b8f27f7cc5afa09478c809eec346bb58244ab42a3bef61a14ae7640d76591343983de9fe5f1b985ce56c9fcfb2e3f6220779ca6f92a6b8aa726573b38ed7663ebe4c85066ae3f488ea3309593fa41dba8efd2b8f44b9fa8f7a427823c1228093a3
TAG: f1832022e06228c36181856325d4eb68

KEY: 3828b138f72f8fe793d46c55ad413bab31a51e7a9093cdd10fddb4739e28e678
NONCE: a60413c0ab529ccf3de58468
IN: fec017c1c51da5ce9dcd8e84cdc03a43145b31edfd039c7c85d8811a2f58efe7a2d7590149a98cf0b5af82d3e0a325223bc9d5585ceb1afc4cdd96024be6c8064c2abac14f68e65de49e25e3e967500ce5b4504d00a9cbad1e86bbdcf65c01a7a92de27583b7b92122b6a4923b7192994a1edf00b75d14a982f92559dbc2d5e427a75ad29715375d90193ddbb39b9a52c1a23d75629c539e0a6ce822c7c08fc77dcd3adc357893215df4694673a16d34513de21217ce86897c8f0575d213ce0c66eb1d1985fe73dd86da3ab5e89df4243e1be9dd95af94f878995d02929ee42a062100d6d4d3884730f54593d5ff7b7ae53e03d4f0e10f6f4c3077206499ab7d4de1e825d532d0918f
AD: e2b16ff2b6c73c9374704ffb4cdfe7bad9eeee32157f2eedf427f99c2cce80c5aa4d9145e85af0cb08e6ed477cbe79ee168ded5c0895f9f4f939c21916b3dd5c9d268b3aabdefb85d953bce9b70732fc9acf6c7b727f78d8c9aaca9e022d7cf0f95583e81744227d87fa34ae19de44d202ba01e3d03993f38c9b2fb00b54dfb677d67e6f5a15f46c29eb5597ae3d5384b37bbeca3f3d825e2b7cceaaeb36a8c1273062259608956dd0c79877cc460d0268de27355e34b9d8d1188c062ac5e10a73f2d70fd0636304b3de06cffeedd246e2db19b8b66785f9f9c62b8f0198f29d37a4ab5280f4aa0320559810f89a1618844d0ad5f3a4f5a0e834ab31e56798b7158217f834d372c36f
CT: 88ea11ef6b6ee6fb0be77bcbf227e77508922550ef0d7534bf05668ae5fcab2f4defe643747716e7e000950e36c6cb24b79987389a150382c091d39ddf841b0a5e31d763d9c59753a3ef36a23b81f38e6e715357395ce715d30c14d6ab5b7454804ecf633daa39b6107f562fae6a646efb25c1119dd17955bb9e640105a21566345408f72f2acc8f2726a0be465551f9ae566da559fc0b92c36764c5ca20a18a316c02e606030a53450e7ae1146050a48a64c600d33cb84389b0bdac7ff45d3d1f2f669a6e365ef722d76d2fe9bef2df93c58bbdd6965e18111b5de0f4a62dbb874161bf8adfa61e9cdecd97b4fff668b3efeb3e32eeb929cf58d94ad8077c0a2ca79e80877c5d9329
TAG: 9b47afc5816b7229213cd3c9135545ed

KEY: 91ea63dc27d9d6bbc279ec6cecdce6c45ff0b247cfb8e26b6ab15f9b63b031a4
NONCE: 80a134fac73eca30459d5964
IN: a848e41c77ac8c733370435b5b6a9960af36031e96260d5703ce15b003606875a7901cd11e4571bf88dda29a627c0b98065a8b4e6d382852dfa4f47d86fa08e48ad8f5a98e55c305900b83200d44029f304abd21e0264115192a3fd7b0eb69b9f8ca7865b3be93f4ba5a28468fd7bbb584c32ae867f5146efbeb1412d3ac36c30cb308c327a6f207e30f561d6efe0a535446c693e14176e9e714ffb5a5b1075812909a362a6c4bbe18322e15690c2c9cf5a18e0120c11551cb7055b5aee97e7a56d7c24fdf1214641c8eacb196d74f3d96a7fbecdd4fe52dc7b6ead9041cafd5a3fdf91fd3614e63189b488d4d7c1ea3c6351d112a2223b29d390ac3ab7f09a60bbd3df6e0d606d902aa44244334
AD: 47940a0694183b2fcb5e760c9ef6dbe4cbff6ccf33208337a981138f9d35c03f8adbd810e94636acaebef6791b531a65e99b03fc78e7eb48036615874e97cf762fa6ca5d880bb2c2f644f1aed70c667880f98834d501caa277cb8ef1095ff882e79c3a92ea8982abebf63ea9ed7e9a24d32cb81d5d98e891974e3d636a59e165984e00f05a040d33f07b39eccb924fb24780a422a6b2b7bddb5b316beddcf6fad20e4cee7d0141c2f7c4e4f759db8691dc7b8525ccbc3ee6071a2ead63e750d6d92dde7eb1303d5b1194702b6c3e0c2e6f9649e60eeddec9c1f71cf309af0672cd2ffcf94ba7e6c3d7cee020a224a9a956274d1d36ba16030e215d90a165756666eff066a8e51bf7d4babe8b7d8d
CT: b90449af99327afb1124bb24f1c8b5cb878423b0370d5f7cd297b28cc4135ee77d6f1913a221cfeee119bafa873072bfa79e303fe377bbed05add41ce3a42ca4632b98f40a36227de1a9ba84d6176c01eca9d33d954d0ebdf4e40f136e0f6a56156fbb33b344a8a433941fd6e08774bd00075aedb0e396c2bc37d1250541248dbeb899e1b5170cdfeaf7b89995b049428bb277c501354f8cd48fb58f6f04f956dfd099c48778dbdbb4c95b7c9d6797cf6d3bcd1d00e88cea885ee4a10d94356509e148990a0e10dd89103a9d5c8434a7bdbed6c0ac1271e0709eba144abf3cf075c020e9f7835d5a98fb2439b399e377ae6e19fc5f32df9ddfb9e936190d3e9c62de99835249d1f32ca3f92ecd44
TAG: 6ccaf7c142d86b83e4d0b4289b49c4d4

KEY: 1344db082889367fd48c5f06bc39f9cb9e3ad4b92fa484ccf49418dd4caa2e19
NONCE: c04a98e7e29326b5330818d4
IN: b0e12e3122c1ebfdcadded5a45163a6208548e9bdf95cfd18ea504e5d2e97372e58dbfe460a57b724d38f3bc0ce02a54015779bcf127343474d7d4c1402d598bee56897203b903da5b819e2218bd0d1a2af11c542544f02c46969cd2bfac683b76a8de61698ccba63361a1a0b570adf69d24e9a7e466873c8c12e25e0bcead7828386179a4d65d5bbdb800eb52fc01b67498d7b5f9864270162158a8572eccf541b07833f001848672098c57708eb479855799567c318b1aa097efa70db0d8a8d36fe0ac22ebcc2870baacac690a79e07ab286acad9f7a877939cf2989cd6200eb86dfa7a41e969a3683ceacc7c97d1cd5487f13c439a9777a67770687657d38267a347a0b6d3aa3cf64e7f31017246e4369da
AD: c96db14dbc2aa0ce3ac63794f75c7e78037dac6763282edb307821a7938de4baa3d2e35a8cfe0c8724c2a8d870d0a462ea157e15aacc69a3c881d9c819225ea8be479872d55e655c897936c95b9ab340820264567495fc5e4e3354f42b84e191b470ca9f4d8fc25d011bf9c9e73e1590e1bb919dd2f288b26935fbfb8c93e54331dc8edad5e1cc4aec103c2f3320d59870c1770319f105ee790b704ed655be423e63ab040f1153f41e7070ae3a0f34d217c4649c180c84814463902d99a9396f8c7c85a3a4c8ae2f01737649fae478a40fc72303a108822775e9c421f945cc0eea992730790a9aa0c0d014518dab371b52d30b5a560f34946a9344cfb8a19b09ee9b123bcb8f642780697508f04983b790dd2d
CT: ffda075dbde7b874995230e1324f17894689baaa7f1354e26100befb546ea23dc74807818e43a3cee00ec1bbb95c82180489ae5f3a1c482dec28f96ecaf5ca4655ff7f33c814197cb1973cf02a0b720a5c44068d8ddff0789fc1e7f20ef408c1a438133fce4f7a3e8c85d95a381b94e949ce47a85895c4be7cbfad468e52a160dee34b8ddeef2ab280eaaed4990ecec790ac16de3c74aac6fe2d5e28ea2b66a921c894a3971cee4a2158054c3567e0d941f867ded5ed1d21d8ab090848fb3eddfb1559bf11815db52b8eed871cfc117980f297da79da31da32de3f162a03d95090d3329da3662df29e6ec9b236e0f7c1d7d957cfd54d5efc99c694b9dece989912388254798513d881e5943ce830729a8e2ddf
TAG: 81c55fe9aa2de0d63efe3f74a3d8096f

KEY: 31dbefe589b661af00a6fbad426e013f30f448c763f957bbcbaf9c09764f4a95
NONCE: 147fe99bba0f606c57242314
IN: 908bd801b70d85085dd480e1207a4a4b7ef179dac495a9befb16afe5adf7cb6f6d734882e6e96f587d38bfc080341dc8d5428a5fe3498b9d5faa497f60646bcb1155d2342f6b26381795daeb261d4ab1415f35c6c8ac9c8e90ea34823122df25c6ddae365cc66d92fc2fe2941f60895e00233b2e5968b01e2811c8c6f7a0a229f1c301a72715bd5c35234c1be81ef7d5cc2779e146314d3783a7aa72d87a8f107654b93cb66e3648c26fc9e4a2f0378fa178c586d096092f6a80e2e03708da72d6e4d7316c2384a522459a4ad369c82d192f6f695b0d90fcc47c6f86b8bbc6f2f4ea303aa64f5ce8b8710da62482147bcc29c8238116549256a7a011fd9c78bbb8c40e278740dc156c2cc99c3591fec2918cdeb5240fb428
AD: 5a32d7044f003b2ffefffe5896933f4d8d64909fa03e321a1bdf063099b9f89752d72e877291d8da12340c5dd570d7d42984ffab5177824fc5483b4faf488504e6822e371dca9af541c6a97312b9cbf341b4198b0902cd2985ac10a8b5b5fe9691bb29a88344f863c980e4e871a72a8b74f92eef68c176e9d2ef037898ff567298e186af52ec62eb7429a8004ac46b945678b82859396d36d388ec3d67653aec35cf1da2684bbc6c78a5f9e3ce1b355af3b207f64e0fa73501c5d48a14638d0906c87eaa876debcf1a532c1475d80ed3d4b96458d2236eb9f67988863bc6d5c16b96b93d898683d248d7bc601b5035fc365481b89465e37a8f7dd64635e19a0282639cecde72c6b1638e0aa6e56f9c00d031cdadc59ce37e
CT: aeab9db30a579ca54195e54a9e6c787f40100c6d12ceee35643f36ae45f618cc9bb66aa4c0fae0ec2686cb4101a5b23a46877460c7e020b38b0d8d1f533ecfa99df03d346bc854a578276d7d5685ad1fb03655683a64aae4159c9efa6781f053057e0811226c7c533967a94587f4025353b28cc3a2ce5763783b4c31e7818b8ad9195bc03be8f294f9f6ceac578f9d30b22b1f5a68d647d46cf6db4a9c3a8a5c06fa97c9efb4578f501ea96db1f40942e3f24c44a7e4070a6b931c39947d9692930b67767357015de51a39e46fff94b6019e4bc1ad9d216a571ba0dc88859c49d2c487ca657384e49b4d382d86a60c8d5195320909c4e82fc077a3b22bd4eccf0f067e66ec78eed642b2d16f0f304f60f1d9ba69e205c982
TAG: 17ca09e3084504fc22e914ee28312c8e

KEY: 0ecc44c9036961fba57c841ace4ca3c547c51d9f126567bf41626765cfcbd53b
NONCE: aa98b6ddff7e4b2041f29d70
IN: e49a2a5713f507bfa00c140dfbefc0c43e37bcb932e0741db03f0055da61cd837b6e2d8f99115d70750fb23685a17121b52e98a37c87204e0207729fd9219d11a48e57970d790338793cf329f7b239512a44dd4409fe9d157f92123dfc5cba24af106442644dedda87e1d9e95fd395f2f0ad8f7d27f313e6ce1a07d9845dec5ad732e6e4749b3a161527c8ce42331f5de1d700650072fb68e9c7645a0e0e529d0563d2727e3fb38ed341f74ef1ad95a0216a440e1384d0e7ef71cde38cecdc9e2b2d563f19014c40c1f92ea0af3b4f6da9146d433ae85f647153db326a28ef6ea2e0ebac0cc1aff157067c7dba7cc4317d56920ee9deab5764368e7e5b3ce8bebd0fa129f869b15897c09659c53188bf8efb7b6ac7d265c9b85fe96166
AD: df41db4ef5350d4afcaa88b4a577b3370b96699bbd73e59aeebca6ea856cf22694a9399ae7f97a3bec226d82f5598f8949dfb92530dcfe77770f066f2af988fba5543b8ba7655bc43f8dca032981a34a1beff695c6908169d475c55b2119fe5578623f68a9dd85b653656881b0db4006d3336fdfc784d1805e48ff478fdc196601f044c9d33fca3ddde2db0102f90fff0b370f520e00e3786c2a9b0b4a9a7ea6f9d866f77d870c8ef0f3a8bedef17949a32598512af665679dfbe71e1c3efc3dee8f5d4499e20dc63281191751f67e51f201973a6675896484527d66bed94d6aaceff65fbc4192cec19452b8873f22d72bf2f4981fe656285cb24be5c58e77dafd3e096166b230f18d3f4197fe16f6ec84c060ce0793ae6848311a18b7
CT: b15b2bc4b9e8ecc5d9c4a6359a805b7590bdb4bfaa9b3fc4d7676d721edc4b3b1ef71b18a3d78f1b31a477cf25e55b278eb3ed774805ae8e5a2a0204f7291d9587663c4d8b1b744154f3b7cef796e0b91590161f3bde82f1d8139cb8d017606ae6d0552ba144788fd8caf435ab09a43a1f4057776af49bad98fc35cefefb159cfebfed76f2e4d18b7be143677ff8b3d6e2b440fe68475b5a1193bcd19ab157d0d2257f33de8e50091ea3388648c3410aa68c830566a0413d92454e4eff433c3edc74e8f7516ec17b2c01cf57a2d7c48db97b706b8d7da0b68051f2d6a87c417f46cf217a48611980890f669d39b478c35d834ed2c79299df2381a1215d6db303cb63e2795fe517649874226e0a6dbfe2c86370b9fbdd8c5de349bfa25f
TAG: 7082c7ef72c82d23e0ba524132acd208

KEY: c05dc14b5def43f2e8f86c3008ef44e4dc6513768812e9218b2b216818c4cec6
NONCE: 5cfe0dca6e599ed9aa89ba97
IN: 8a06e2997b8e5f8040b22e07978c83c48d0f90bd2b2f8b426b43feea0b614d3b0681745ea4224cabcaa25ca45c3053a6300c47ffa4f72e838db135ae35c27939aad4cf7f75fb61daa3148d869057598e4e8b44c6fb19b0d9281e18676d8bc137489bb77a51a3a8f807a896d558f00040e8729ea9bbdc7db6102c8b99c8a1eacb0735577bc6533cd1d8147013935b6344116090a1bdef1f2e38a877a50c8fc0f394bafede31375c57476ba06d95ae734e6dae771a32e5091dff71d845c5f7385b9b9069ced12fcfea34a510880b088bb0016e94a5932c89baee038cbafbf06b3d09426afd2d5dd5e392636362e9ffa9186b5c753eb84f82f68fb1286ed06c58a5a936cad018ebc4269037b49f2ea0349373adea99f06062e5dbb0bf94f2883f5c0556
AD: f2a3f7af8ea984bbd85953f14202c6e478f98d0bcaacd414329ec480d0c29fb4c1a052d3228c883928448f0bef12cee5b69829b4a3eb4680084131867cfc3d3af84fcc0d80c2292d3fe02405634f6cfb20b0fb90345da3a557fb30582175c32e432be66ad096f9425ff4060df54d6741fd6567a1e2fc5f6f3ed95cefc806ff64ae91ae82920b5c829ea026f83fd90d760e240da3c9ddaafe4d08507f4af1049056dc6d09657779a3dbd889d851e97d4ac60dc66df2d24979ba8947a7890a304bb301d0d42b67824e0c68fc882e90cb6deee50c2e3d9f0da59ab23c997b05635a0d56c71fc39aa0e6b19c43a7fe12d4e4145453cd7fbd8a3f33bf5451addf05052df7ef044a33513bc5f1a4cfc8b68015664bb5c8e4bf54a85efff109ee96af75d4a5
CT: 2cf630548d6f2b449057c7861920308958199f77b123a142c6b7c89c4982f4ed0efa2fe899914ddbf4543e70865a5e683b0721d6c8443df2e697acf31e11c8809aba94196409020a7c64d396fe136826455aec973af23a6c7733cb567f5ea550e50e0b796623a97807d042855568e3c568990cfc818c31a1bf415337f43e9baed57fada2fb2ad3c3543f2b7f2777e03f84040c1c854c310ab1cc5dc7f2a5fb213af79ac068b46c7d9475bea126adf079e2100bb57904a931faf248e0f7d5832ca83ea8a283e0136979737132afb1f4ab38d307ac0774814f4d5ecdc4aad79185c05f8a706f579b78f2c1c7004cb38e6cd22c2080735b34c3f6134955ed3bc36b1ad5c8e33209c9f3c658fb07b59b6002b2526cd8d853a5c624b7108573d7df60c827
TAG: 3dcdabcd1c82002a551cea41921570e5

KEY: b33f449deccc2ef0d7616f22b4a00fcd84c51a8383782f66f1696bc6405005ee
NONCE: 6afa8baf923f986b5779ac6a
IN: b0af85a6deae5fcaa94778bce015ce2da7400ab768f3e114cc1b645fb2716789e2aeb96894fda6da5bc24fcf2466124720d6ba99e5475d77e5bcf2c2f8c8e5becf5eb73ad650861bbdeb51ba5ee789c227478934200fc18f36e4fe392c99d4c3fe0b38b40d2e84f831b8ef9bce9ac1362c755943521ecf5b5cf8fbcdf08f2d47ff7cd62838597dd342695a1b037bcede69500bf70bf1edbb40a17b44695bd8ff8bc8664b3211a6bbfdcbd1bffbfb1a2ea0141cfbc6ac841c803b137be5eeb2666c46c09cc1c4fa82be43bfd56e7a2b8ceeecb6efc1933a90213a0e1bc7aca2af35f2d1dad5f0d9002561064a699f1ce76c39d9c2224ae596e88a1517e19c2115370768d50107f3f2a55051838ae5897acf2ac0814ccd864eee2f6b5d7a6728c6ac6e6a57327102
AD: 2134f74e882a44e457c38b6580cd58ce20e81267baeb4a9d50c41ababc2a91ddf300c39963643d3c0797b628c75a5fc39c058d319e7d6deb836334dbe8e1fe3cc5704b90c712e1fb60a3c8b58d474a73d65fae886394f8b2c029e420b923f2af4d54c9de3c7fa2bccaa1e96664ccf681cacbbf9845069a4bfd6c135c4392d7d6be338eca414e3a45f50510718e2a5a3e5815eafa0c50172cf5f147510645d2269929843bbbab682deb5823d4cdf42bd250bdbd20c43e2919d7a6e48973f43a4cab73454b97cdca96721ebd83b6dbaaec7e12cf0dae678a57c431b81421657037dd47dccbee73a41f56495fd7c25c75744fe8f55cbd1eac4a174d8f7dd6f6ba57b3e53449a9ce7806517e3e07cf6546a0fa62c7b1fa244d42eee64a3182461792edb628e567b23a
CT: 0fe35823610ea698aeb5b571f3ebbaf0ac3586ecb3b24fcc7c56943d4426f7fdf4e4a53fb430751456d41551f8e5502faa0e1ac5f452b27b13c1dc63e9231c6b192f8dd2978300293298acb6293459d3204429e374881085d49ed6ad76f1d85e3f6dd5455a7a5a9d7127386a30f80658395dc8eb158e5ca052a7137feef28aa247e176cceb9c031f73fb8d48139e3bdb30e2e19627f7fc3501a6d6287e2fb89ad184cefa1774585aa663586f289c778462eee3cd88071140274770e4ed98b9b83cd4fa659fcdd2d1fde7e58333c6cf7f83fe285b97ad8f276a375fafa15f88e6167f5f2bfb95af1aefee80b0620a9bc09402ab79036e716f0c8d518ae2fa15094f6ea4c5e8b283f97cc27f2f1d0b6367b4b508c7bad16f1539325751bd785e9e08cd508bdb3b84
TAG: 1976d7e121704ce463a8d4fe1b93d90f

# AES GCM test vectors from http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf

KEY: 0000000000000000000000000000000000000000000000000000000000000000
NONCE: 000000000000000000000000
IN: ""
CT: ""
AD: ""
TAG: 530f8afbc74536b9a963b4f1c4cb738b

KEY: 0000000000000000000000000000000000000000000000000000000000000000
NONCE: 000000000000000000000000
IN: 00000000000000000000000000000000
CT: cea7403d4d606b6e074ec5d3baf39d18
AD: ""
TAG: d0d1c8a799996bf0265b98b5d48ab919

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
NONCE: cafebabefacedbaddecaf888
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255
CT: 522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad
AD: ""
TAG: b094dac5d93471bdec1a502270e3cc6c

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
NONCE: cafebabefacedbaddecaf888
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: 522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662
AD: feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: 76fc6ece0f4e1768cddf8853bb2d551b

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
NONCE: cafebabefacedbad
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: c3762df1ca787d32ae47c13bf19844cbaf1ae14d0b976afac52ff7d79bba9de0feb582d33934a4f0954cc2363bc73f7862ac430e64abe499f47c9b1f
AD: feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: 3a337dbf46a792c45e454913fe2ea8f2

KEY: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
NONCE: 9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b
IN: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
CT: 5a8def2f0c9e53f1f75d7853659e2a20eeb2b22aafde6419a058ab4f6f746bf40fc0c3b780f244452da3ebf1c5d82cdea2418997200ef82e44ae7e3f
AD: feedfacedeadbeeffeedfacedeadbeefabaddad2
TAG: a44a8266ee1c8eb0c8b5d4cf5ae9f19a

Added jni/libressl/tests/asn1_string_to_utf8.c.
































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*	$OpenBSD: asn1_string_to_utf8.c,v 1.1 2022/05/16 20:53:20 tb Exp $ */
/*
 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <err.h>
#include <string.h>

#include <openssl/asn1.h>

struct asn1_string_to_utf8_test_case {
	const char *description;
	const ASN1_ITEM *item;
	const uint8_t der[32];
	size_t der_len;
	const uint8_t want[32];
	int want_len;
};

static const struct asn1_string_to_utf8_test_case tests[] = {
	{
		.description = "hello",
		.item = &ASN1_PRINTABLESTRING_it,
		.der = {
			0x13, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
		},
		.der_len = 7,
		.want = {
			0x68, 0x65, 0x6c, 0x6c, 0x6f,
		},
		.want_len = 5,
	},
	{
		.description = "face with tears of joy",
		.item = &ASN1_UTF8STRING_it,
		.der = {
			0x0c, 0x04, 0xF0, 0x9F, 0x98, 0x82,
		},
		.der_len = 6,
		.want = {
			0xF0, 0x9F, 0x98, 0x82,
		},
		.want_len = 4,
	},
	{
		.description = "hi",
		.item = &ASN1_IA5STRING_it,
		.der = {
			0x16, 0x02, 0x68, 0x69,
		},
		.der_len = 4,
		.want = {
			0x68, 0x69,
		},
		.want_len = 2,
	},
};

const size_t N_TESTS = sizeof(tests) / sizeof(tests[0]);

static int
asn1_string_to_utf8_test(const struct asn1_string_to_utf8_test_case *test)
{
	ASN1_STRING *str = NULL;
	const unsigned char *der;
	unsigned char *out = NULL;
	int ret;
	int failed = 1;

	der = test->der;
	if ((str = (ASN1_STRING *)ASN1_item_d2i(NULL, &der, test->der_len,
	    test->item)) == NULL) {
		warnx("ASN1_item_d2i failed");
		goto err;
	}

	if ((ret = ASN1_STRING_to_UTF8(&out, str)) != test->want_len) {
		warnx("ASN1_STRING_to_UTF8 failed: got %d, want %d", ret,
		    test->want_len);
		goto err;
	}

	if (memcmp(out, test->want, test->want_len) != 0) {
		warnx("memcmp failed");
		goto err;
	}

	failed = 0;
 err:
	ASN1_STRING_free(str);
	free(out);

	return failed;
}

static int
asn1_string_to_utf8_tests(void)
{
	size_t i;
	int failed = 0;

	for (i = 0; i < N_TESTS; i++)
		failed |= asn1_string_to_utf8_test(&tests[i]);

	return failed;
}

int
main(void)
{
	int failed = 0;

	failed |= asn1_string_to_utf8_tests();

	return failed;
}
Changes to jni/libressl/tests/asn1api.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1api.c,v 1.2 2021/12/14 17:10:02 jsing Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1api.c,v 1.3 2022/07/09 14:47:42 tb Exp $ */
/*
 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
376
377
378
379
380
381
382




















383
384
385
386
387
388
389
390
391

392
393
394
	}

	failed = 0;

 failed:
	return failed;
}





















int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= asn1_tag2bit();
	failed |= asn1_tag2str();
	failed |= asn1_get_object();


	return (failed);
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









>



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
	}

	failed = 0;

 failed:
	return failed;
}

static int
asn1_integer_get_null_test(void)
{
	int failed = 0;
	long ret;

	if ((ret = ASN1_INTEGER_get(NULL)) != 0) {
		fprintf(stderr, "FAIL: ASN1_INTEGER_get(NULL) %ld != 0\n", ret);
		failed |= 1;
	}

	if ((ret = ASN1_ENUMERATED_get(NULL)) != 0) {
		fprintf(stderr, "FAIL: ASN1_ENUMERATED_get(NULL) %ld != 0\n",
		    ret);
		failed |= 1;
	}

	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= asn1_tag2bit();
	failed |= asn1_tag2str();
	failed |= asn1_get_object();
	failed |= asn1_integer_get_null_test();

	return (failed);
}
Changes to jni/libressl/tests/asn1basic.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
/* $OpenBSD: asn1basic.c,v 1.4 2022/01/12 07:55:25 tb Exp $ */
/*
 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/asn1.h>


#include <err.h>
#include <stdio.h>
#include <string.h>

#include "asn1_locl.h"

|

















>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* $OpenBSD: asn1basic.c,v 1.12 2022/09/05 21:06:31 tb Exp $ */
/*
 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/asn1.h>
#include <openssl/err.h>

#include <err.h>
#include <stdio.h>
#include <string.h>

#include "asn1_locl.h"

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

static int
asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%i != %i)\n", label, len1, len2);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

static int
asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%d != %d)\n", label, len1, len2);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {
90
91
92
93
94
95
96
97
98
99
100





101
102
103
104
105
106
107
108
109
110





111
112
113
114
115
116
117
		errx(1, "malloc");
	memset(p, 0xbd, len);
	pp = p;
	if ((i2d_ASN1_BIT_STRING(abs, &pp)) != len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n");
		goto failed;
	}

	if (!asn1_compare_bytes("BIT_STRING", p, len, asn1_bit_string_primitive,
	    sizeof(asn1_bit_string_primitive)))
		goto failed;






	/* Test primitive decoding. */
	q = p;
	if (d2i_ASN1_BIT_STRING(&abs, &q, len) == NULL) {
		fprintf(stderr, "FAIL: d2i_ASN1_BIT_STRING primitive\n");
		goto failed;
	}
	if (!asn1_compare_bytes("BIT_STRING primitive data", abs->data, abs->length,
	    bs, sizeof(bs)))
		goto failed;






	/* Test ASN1_BIT_STRING_get_bit(). */
	for (i = 0; i < ((int)sizeof(bs) * 8); i++) {
		bit = (bs[i / 8] >> (7 - i % 8)) & 1;

		if (ASN1_BIT_STRING_get_bit(abs, i) != bit) {
			fprintf(stderr, "FAIL: ASN1_BIT_STRING_get_bit(_, %d) "







<



>
>
>
>
>










>
>
>
>
>







91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
		errx(1, "malloc");
	memset(p, 0xbd, len);
	pp = p;
	if ((i2d_ASN1_BIT_STRING(abs, &pp)) != len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n");
		goto failed;
	}

	if (!asn1_compare_bytes("BIT_STRING", p, len, asn1_bit_string_primitive,
	    sizeof(asn1_bit_string_primitive)))
		goto failed;
	if (pp != p + len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING pp = %p, want %p\n",
		    pp, p + len);
		goto failed;
	}

	/* Test primitive decoding. */
	q = p;
	if (d2i_ASN1_BIT_STRING(&abs, &q, len) == NULL) {
		fprintf(stderr, "FAIL: d2i_ASN1_BIT_STRING primitive\n");
		goto failed;
	}
	if (!asn1_compare_bytes("BIT_STRING primitive data", abs->data, abs->length,
	    bs, sizeof(bs)))
		goto failed;
	if (q != p + len) {
		fprintf(stderr, "FAIL: d2i_ASN1_BIT_STRING q = %p, want %p\n",
		    q, p + len);
		goto failed;
	}

	/* Test ASN1_BIT_STRING_get_bit(). */
	for (i = 0; i < ((int)sizeof(bs) * 8); i++) {
		bit = (bs[i / 8] >> (7 - i % 8)) & 1;

		if (ASN1_BIT_STRING_get_bit(abs, i) != bit) {
			fprintf(stderr, "FAIL: ASN1_BIT_STRING_get_bit(_, %d) "
186
187
188
189
190
191
192





193
194
195
196
197
198
199
200
201





202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217





218
219
220
221
222
223
224
225
226
227



















































































































































































































































































































































































































































































228
229
230
231

232
233























234
235
236
237
238
239
240
241
242
243

244
245
246
		errx(1, "calloc");
	memset(p, 0xbd, len);
	pp = p;
	if ((i2d_ASN1_BOOLEAN(0, &pp)) != len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN false\n");
		goto failed;
	}






	if (!asn1_compare_bytes("BOOLEAN false", p, len, asn1_boolean_false,
	    sizeof(asn1_boolean_false)))
		goto failed;

	q = p;
	if (d2i_ASN1_BOOLEAN(NULL, &q, len) != 0) {
		fprintf(stderr, "FAIL: BOOLEAN false did not decode to 0\n");
		goto failed;





	}

	free(p);
	p = NULL;

	if ((len = i2d_ASN1_BOOLEAN(1, NULL)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN true with NULL\n");
		goto failed;
	}
	if ((p = calloc(1, len)) == NULL)
		errx(1, "calloc");
	pp = p;
	if ((i2d_ASN1_BOOLEAN(1, &pp)) != len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN true\n");
		goto failed;
	}






	if (!asn1_compare_bytes("BOOLEAN true", p, len, asn1_boolean_true,
	    sizeof(asn1_boolean_true)))
		goto failed;

	q = p;
	if (d2i_ASN1_BOOLEAN(NULL, &q, len) != 1) {
		fprintf(stderr, "FAIL: BOOLEAN true did not decode to 1\n");
		goto failed;
	}




















































































































































































































































































































































































































































































	failed = 0;

 failed:

	free(p);
























	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= asn1_bit_string_test();
	failed |= asn1_boolean_test();


	return (failed);
}







>
>
>
>
>









>
>
>
>
>
















>
>
>
>
>










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










>



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
		errx(1, "calloc");
	memset(p, 0xbd, len);
	pp = p;
	if ((i2d_ASN1_BOOLEAN(0, &pp)) != len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN false\n");
		goto failed;
	}
	if (pp != p + len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN pp = %p, want %p\n",
		    pp, p + len);
		goto failed;
	}

	if (!asn1_compare_bytes("BOOLEAN false", p, len, asn1_boolean_false,
	    sizeof(asn1_boolean_false)))
		goto failed;

	q = p;
	if (d2i_ASN1_BOOLEAN(NULL, &q, len) != 0) {
		fprintf(stderr, "FAIL: BOOLEAN false did not decode to 0\n");
		goto failed;
	}
	if (q != p + len) {
		fprintf(stderr, "FAIL: d2i_ASN1_BOOLEAN q = %p, want %p\n",
		    q, p + len);
		goto failed;
	}

	free(p);
	p = NULL;

	if ((len = i2d_ASN1_BOOLEAN(1, NULL)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN true with NULL\n");
		goto failed;
	}
	if ((p = calloc(1, len)) == NULL)
		errx(1, "calloc");
	pp = p;
	if ((i2d_ASN1_BOOLEAN(1, &pp)) != len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN true\n");
		goto failed;
	}
	if (pp != p + len) {
		fprintf(stderr, "FAIL: i2d_ASN1_BOOLEAN pp = %p, want %p\n",
		    pp, p + len);
		goto failed;
	}

	if (!asn1_compare_bytes("BOOLEAN true", p, len, asn1_boolean_true,
	    sizeof(asn1_boolean_true)))
		goto failed;

	q = p;
	if (d2i_ASN1_BOOLEAN(NULL, &q, len) != 1) {
		fprintf(stderr, "FAIL: BOOLEAN true did not decode to 1\n");
		goto failed;
	}
	if (q != p + len) {
		fprintf(stderr, "FAIL: d2i_ASN1_BOOLEAN q = %p, want %p\n",
		    q, p + len);
		goto failed;
	}

	failed = 0;

 failed:
	free(p);

	return failed;
}

struct asn1_integer_test {
	long value;
	uint8_t content[64];
	size_t content_len;
	int content_neg;
	uint8_t der[64];
	size_t der_len;
	int want_error;
};

struct asn1_integer_test asn1_integer_tests[] = {
	{
		.value = 0,
		.content = {0x00},
		.content_len = 1,
		.der = {0x02, 0x01, 0x00},
		.der_len = 3,
	},
	{
		.value = 1,
		.content = {0x01},
		.content_len = 1,
		.der = {0x02, 0x01, 0x01},
		.der_len = 3,
	},
	{
		.value = -1,
		.content = {0x01},
		.content_len = 1,
		.content_neg = 1,
		.der = {0x02, 0x01, 0xff},
		.der_len = 3,
	},
	{
		.value = 127,
		.content = {0x7f},
		.content_len = 1,
		.der = {0x02, 0x01, 0x7f},
		.der_len = 3,
	},
	{
		.value = -127,
		.content = {0x7f},
		.content_len = 1,
		.content_neg = 1,
		.der = {0x02, 0x01, 0x81},
		.der_len = 3,
	},
	{
		.value = 128,
		.content = {0x80},
		.content_len = 1,
		.der = {0x02, 0x02, 0x00, 0x80},
		.der_len = 4,
	},
	{
		.value = -128,
		.content = {0x80},
		.content_len = 1,
		.content_neg = 1,
		.der = {0x02, 0x01, 0x80},
		.der_len = 3,
	},
	{
		/* 2^64 */
		.content = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		.content_len = 9,
		.der = {0x02, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		.der_len = 11,
	},
	{
		/* -2^64 */
		.content = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		.content_len = 9,
		.content_neg = 1,
		.der = {0x02, 0x09, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		.der_len = 11,
	},
	{
		/* Invalid length. */
		.der = {0x02, 0x00},
		.der_len = 2,
		.want_error = 1,
	},
	{
		/* Invalid padding. */
		.der = {0x02, 0x09, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		.der_len = 11,
		.want_error = 1,
	},
	{
		/* Invalid padding. */
		.der = {0x02, 0x09, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		.der_len = 11,
		.want_error = 1,
	},
	{
		/* Invalid encoding (constructed with definite length). */
		.der = {0x22, 0x03, 0x02, 0x01, 0x01},
		.der_len = 5,
		.want_error = 1,
	},
	{
		/* Invalid encoding (constructed with indefinite length). */
		.der = {0x22, 0x80, 0x02, 0x01, 0x01, 0x00, 0x00},
		.der_len = 7,
		.want_error = 1,
	},
};

#define N_ASN1_INTEGER_TESTS \
    (sizeof(asn1_integer_tests) / sizeof(*asn1_integer_tests))

static int
asn1_integer_set_test(struct asn1_integer_test *ait)
{
	ASN1_INTEGER *aint = NULL;
	uint8_t *p = NULL, *pp;
	int len;
	int failed = 1;

	if ((aint = ASN1_INTEGER_new()) == NULL) {
		fprintf(stderr, "FAIL: ASN1_INTEGER_new() == NULL\n");
		goto failed;
	}
	if (!ASN1_INTEGER_set(aint, ait->value)) {
		fprintf(stderr, "FAIL: ASN1_INTEGER_(%ld) failed\n",
		    ait->value);
		goto failed;
	}
	if (ait->value != 0 &&
	    !asn1_compare_bytes("INTEGER set", aint->data, aint->length,
	    ait->content, ait->content_len))
		goto failed;
	if (ait->content_neg && aint->type != V_ASN1_NEG_INTEGER) {
		fprintf(stderr, "FAIL: Not V_ASN1_NEG_INTEGER\n");
		goto failed;
	}
	if (ASN1_INTEGER_get(aint) != ait->value) {
		fprintf(stderr, "FAIL: ASN1_INTEGER_get() = %ld, want %ld\n",
		    ASN1_INTEGER_get(aint), ait->value);
		goto failed;
	}
	if ((len = i2d_ASN1_INTEGER(aint, NULL)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_INTEGER() failed\n");
		goto failed;
	}
	if ((p = malloc(len)) == NULL)
		errx(1, "malloc");
	memset(p, 0xbd, len);
	pp = p;
	if ((len = i2d_ASN1_INTEGER(aint, &pp)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_INTEGER() failed\n");
		goto failed;
	}
	if (!asn1_compare_bytes("INTEGER set", p, len, ait->der,
	    ait->der_len))
		goto failed;

	failed = 0;

 failed:
	ASN1_INTEGER_free(aint);
	free(p);

	return failed;
}

static int
asn1_integer_content_test(struct asn1_integer_test *ait)
{
	ASN1_INTEGER *aint = NULL;
	uint8_t *p = NULL, *pp;
	int len;
	int failed = 1;

	if ((aint = ASN1_INTEGER_new()) == NULL) {
		fprintf(stderr, "FAIL: ASN1_INTEGER_new() == NULL\n");
		goto failed;
	}
	if ((aint->data = malloc(ait->content_len)) == NULL)
		errx(1, "malloc");
	memcpy(aint->data, ait->content, ait->content_len);
	aint->length = ait->content_len;
	if (ait->content_neg)
		aint->type = V_ASN1_NEG_INTEGER;

	if ((len = i2d_ASN1_INTEGER(aint, NULL)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_INTEGER() failed\n");
		goto failed;
	}
	if ((p = malloc(len)) == NULL)
		errx(1, "malloc");
	memset(p, 0xbd, len);
	pp = p;
	if ((len = i2d_ASN1_INTEGER(aint, &pp)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_INTEGER() failed\n");
		goto failed;
	}
	if (!asn1_compare_bytes("INTEGER content", p, len, ait->der,
	    ait->der_len))
		goto failed;
	if (pp != p + len) {
		fprintf(stderr, "FAIL: i2d_ASN1_INTEGER pp = %p, want %p\n",
		    pp, p + len);
		goto failed;
	}

	failed = 0;

 failed:
	ASN1_INTEGER_free(aint);
	free(p);

	return failed;
}

static int
asn1_integer_decode_test(struct asn1_integer_test *ait)
{
	ASN1_INTEGER *aint = NULL;
	const uint8_t *q;
	int failed = 1;

	q = ait->der;
	if (d2i_ASN1_INTEGER(&aint, &q, ait->der_len) != NULL) {
		if (ait->want_error != 0) {
			fprintf(stderr, "FAIL: INTEGER decoded when it should "
			    "have failed\n");
			goto failed;
		}
		if (!asn1_compare_bytes("INTEGER content", aint->data,
		    aint->length, ait->content, ait->content_len))
			goto failed;
		if (q != ait->der + ait->der_len) {
			fprintf(stderr, "FAIL: d2i_ASN1_INTEGER q = %p, want %p\n",
			    q, ait->der + ait->der_len);
			goto failed;
		}
	} else if (ait->want_error == 0) {
		fprintf(stderr, "FAIL: INTEGER failed to decode\n");
		ERR_print_errors_fp(stderr);
		goto failed;
	}

	failed = 0;

 failed:
	ASN1_INTEGER_free(aint);

	return failed;
}

static int
asn1_integer_set_val_test(void)
{
	ASN1_INTEGER *aint = NULL;
	uint64_t uval;
	int64_t val;
	int failed = 1;

	if ((aint = ASN1_INTEGER_new()) == NULL) {
		fprintf(stderr, "FAIL: ASN1_INTEGER_new() == NULL\n");
		goto failed;
	}

	if (!ASN1_INTEGER_set_uint64(aint, 0)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_set_uint64() failed with "
		    "0\n");
		goto failed;
	}
	if (!ASN1_INTEGER_get_uint64(&uval, aint)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_uint64() failed with "
		    "0\n");
		goto failed;
	}
	if (uval != 0) {
		fprintf(stderr, "FAIL: uval != 0\n");
		goto failed;
	}

	if (!ASN1_INTEGER_set_uint64(aint, UINT64_MAX)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_set_uint64() failed with "
		    "UINT64_MAX\n");
		goto failed;
	}
	if (!ASN1_INTEGER_get_uint64(&uval, aint)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_uint64() failed with "
		    "UINT64_MAX\n");
		goto failed;
	}
	if (uval != UINT64_MAX) {
		fprintf(stderr, "FAIL: uval != UINT64_MAX\n");
		goto failed;
	}
	if (ASN1_INTEGER_get_int64(&val, aint)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_int64() succeeded "
		    "with UINT64_MAX\n");
		goto failed;
	}

	if (!ASN1_INTEGER_set_int64(aint, INT64_MIN)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_set_int64() failed with "
		    "INT64_MIN\n");
		goto failed;
	}
	if (!ASN1_INTEGER_get_int64(&val, aint)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_int64() failed with "
		    "INT64_MIN\n");
		goto failed;
	}
	if (val != INT64_MIN) {
		fprintf(stderr, "FAIL: val != INT64_MIN\n");
		goto failed;
	}
	if (ASN1_INTEGER_get_uint64(&uval, aint)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_uint64() succeeded "
		    "with INT64_MIN\n");
		goto failed;
	}

	if (!ASN1_INTEGER_set_int64(aint, INT64_MAX)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_set_int64() failed with "
		    "INT64_MAX\n");
		goto failed;
	}
	if (!ASN1_INTEGER_get_int64(&val, aint)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_int64() failed with "
		    "INT64_MAX\n");
		goto failed;
	}
	if (val != INT64_MAX) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_int64() failed with "
		    "INT64_MAX\n");
		goto failed;
	}
	if (!ASN1_INTEGER_get_uint64(&uval, aint)) {
		fprintf(stderr, "FAIL: ASN_INTEGER_get_uint64() failed with "
		    "INT64_MAX\n");
		goto failed;
	}
	if (uval != INT64_MAX) {
		fprintf(stderr, "FAIL: uval != INT64_MAX\n");
		goto failed;
	}

	failed = 0;

 failed:
	ASN1_INTEGER_free(aint);

	return failed;
}

static int
asn1_integer_cmp_test(void)
{
	ASN1_INTEGER *a = NULL, *b = NULL;
	int failed = 1;

	if ((a = ASN1_INTEGER_new()) == NULL)
		goto failed;
	if ((b = ASN1_INTEGER_new()) == NULL)
		goto failed;

	if (ASN1_INTEGER_cmp(a, b) != 0) {
		fprintf(stderr, "FAIL: INTEGER 0 == 0");
		goto failed;
	}

	if (!ASN1_INTEGER_set(b, 1)) {
		fprintf(stderr, "FAIL: failed to set INTEGER");
		goto failed;
	}
	if (ASN1_INTEGER_cmp(a, b) >= 0) {
		fprintf(stderr, "FAIL: INTEGER 0 < 1");
		goto failed;
	}
	if (ASN1_INTEGER_cmp(b, a) <= 0) {
		fprintf(stderr, "FAIL: INTEGER 1 > 0");
		goto failed;
	}

	if (!ASN1_INTEGER_set(b, -1)) {
		fprintf(stderr, "FAIL: failed to set INTEGER");
		goto failed;
	}
	if (ASN1_INTEGER_cmp(a, b) <= 0) {
		fprintf(stderr, "FAIL: INTEGER 0 > -1");
		goto failed;
	}
	if (ASN1_INTEGER_cmp(b, a) >= 0) {
		fprintf(stderr, "FAIL: INTEGER -1 < 0");
		goto failed;
	}

	if (!ASN1_INTEGER_set(a, 1)) {
		fprintf(stderr, "FAIL: failed to set INTEGER");
		goto failed;
	}
	if (ASN1_INTEGER_cmp(a, b) <= 0) {
		fprintf(stderr, "FAIL: INTEGER 1 > -1");
		goto failed;
	}
	if (ASN1_INTEGER_cmp(b, a) >= 0) {
		fprintf(stderr, "FAIL: INTEGER -1 < 1");
		goto failed;
	}

	if (!ASN1_INTEGER_set(b, 1)) {
		fprintf(stderr, "FAIL: failed to set INTEGER");
		goto failed;
	}
	if (ASN1_INTEGER_cmp(a, b) != 0) {
		fprintf(stderr, "FAIL: INTEGER 1 == 1");
		goto failed;
	}

	failed = 0;

 failed:
	ASN1_INTEGER_free(a);
	ASN1_INTEGER_free(b);

	return failed;
}

static int
asn1_integer_null_data_test(void)
{
	const uint8_t der[] = {0x02, 0x01, 0x00};
	ASN1_INTEGER *aint = NULL;
	uint8_t *p = NULL, *pp;
	int len;
	int failed = 0;

	if ((aint = ASN1_INTEGER_new()) == NULL) {
		fprintf(stderr, "FAIL: ASN1_INTEGER_new() == NULL\n");
		goto failed;
	}
	if ((len = i2d_ASN1_INTEGER(aint, NULL)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_INTEGER() failed\n");
		goto failed;
	}
	if ((p = calloc(1, len)) == NULL)
		errx(1, "calloc");
	pp = p;
	if ((len = i2d_ASN1_INTEGER(aint, &pp)) < 0) {
		fprintf(stderr, "FAIL: i2d_ASN1_INTEGER() failed\n");
		goto failed;
	}
	if (!asn1_compare_bytes("INTEGER NULL data", p, len, der, sizeof(der)))
		goto failed;

	failed = 0;

 failed:
	ASN1_INTEGER_free(aint);
	free(p);

	return failed;
}

static int
asn1_integer_test(void)
{
	struct asn1_integer_test *ait;
	int failed = 0;
	size_t i;

	for (i = 0; i < N_ASN1_INTEGER_TESTS; i++) {
		ait = &asn1_integer_tests[i];
		if (ait->content_len > 0 && ait->content_len <= 4)
			failed |= asn1_integer_set_test(ait);
		if (ait->content_len > 0)
			failed |= asn1_integer_content_test(ait);
		failed |= asn1_integer_decode_test(ait);
	}

	failed |= asn1_integer_cmp_test();
	failed |= asn1_integer_null_data_test();
	failed |= asn1_integer_set_val_test();

	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= asn1_bit_string_test();
	failed |= asn1_boolean_test();
	failed |= asn1_integer_test();

	return (failed);
}
Changes to jni/libressl/tests/asn1complex.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
/* $OpenBSD: asn1complex.c,v 1.1 2021/12/09 16:30:57 jsing Exp $ */
/*
 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/asn1.h>

#include <openssl/err.h>

#include <err.h>
#include <stdio.h>
#include <string.h>

static void
|

















>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* $OpenBSD: asn1complex.c,v 1.4 2022/09/05 21:06:31 tb Exp $ */
/*
 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/err.h>

#include <err.h>
#include <stdio.h>
#include <string.h>

static void
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

static int
asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%i != %i)\n", label, len1, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {
		fprintf(stderr, "FAIL: %s - bytes differ\n", label);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

static int
asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%d != %d)\n", label, len1, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {
		fprintf(stderr, "FAIL: %s - bytes differ\n", label);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
159
160
161
162
163
164
165


166
167
168
169
170
171
172
do_asn1_constructed_test(const struct asn1_constructed_test *act)
{
	ASN1_OCTET_STRING *aos = NULL;
	const uint8_t *p;
	long err;
	int failed = 1;



	p = act->asn1;
	aos = d2i_ASN1_OCTET_STRING(NULL, &p, act->asn1_len);
	if (!act->valid) {
		if (aos != NULL) {
			fprintf(stderr, "FAIL: invalid ASN.1 decoded\n");
			goto failed;
		}







>
>







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
do_asn1_constructed_test(const struct asn1_constructed_test *act)
{
	ASN1_OCTET_STRING *aos = NULL;
	const uint8_t *p;
	long err;
	int failed = 1;

	ERR_clear_error();

	p = act->asn1;
	aos = d2i_ASN1_OCTET_STRING(NULL, &p, act->asn1_len);
	if (!act->valid) {
		if (aos != NULL) {
			fprintf(stderr, "FAIL: invalid ASN.1 decoded\n");
			goto failed;
		}
210
211
212
213
214
215
216
217






























































































218
219
220
221
222
223

224
225
226
	for (i = 0; i < N_CONSTRUCTED_TESTS; i++) {
		act = &asn1_constructed_tests[i];
		failed |= do_asn1_constructed_test(act);
	}

	return failed;
}































































































int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= do_asn1_constructed_tests();


	return (failed);
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






>



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	for (i = 0; i < N_CONSTRUCTED_TESTS; i++) {
		act = &asn1_constructed_tests[i];
		failed |= do_asn1_constructed_test(act);
	}

	return failed;
}

/* Sequence with length. */
const uint8_t asn1_sequence_ber[] = {
	0x30, 0x16,
	0x04, 0x01, 0x01,
	0x04, 0x02, 0x01, 0x02,
	0x04, 0x03, 0x01, 0x02, 0x03,
	0x30, 0x80, 0x04, 0x01, 0x01, 0x00, 0x00,
	0x04, 0x01, 0x01,

	0x04, 0x01, 0x01, /* Trailing data. */
};

const uint8_t asn1_sequence_content[] = {
	0x30, 0x16, 0x04, 0x01, 0x01, 0x04, 0x02, 0x01,
	0x02, 0x04, 0x03, 0x01, 0x02, 0x03, 0x30, 0x80,
	0x04, 0x01, 0x01, 0x00, 0x00, 0x04, 0x01, 0x01,
};

/* Sequence with indefinite length. */
const uint8_t asn1_sequence_indefinite_ber[] = {
	0x30, 0x80,
	0x04, 0x01, 0x01,
	0x04, 0x02, 0x01, 0x02,
	0x04, 0x03, 0x01, 0x02, 0x03,
	0x30, 0x80, 0x04, 0x01, 0x01, 0x00, 0x00,
	0x04, 0x01, 0x01,
	0x00, 0x00,

	0x04, 0x01, 0x01, /* Trailing data. */
};

const uint8_t asn1_sequence_indefinite_content[] = {
	0x30, 0x80, 0x04, 0x01, 0x01, 0x04, 0x02, 0x01,
	0x02, 0x04, 0x03, 0x01, 0x02, 0x03, 0x30, 0x80,
	0x04, 0x01, 0x01, 0x00, 0x00, 0x04, 0x01, 0x01,
	0x00, 0x00,
};

static int
do_asn1_sequence_string_tests(void)
{
	ASN1_STRING *astr = NULL;
	const uint8_t *p;
	long len;
	int failed = 1;

	ERR_clear_error();

	/*
	 * Test decoding of sequence with length and indefinite length into
	 * a string - in this case the ASN.1 is not decoded and is stored
	 * directly as the content for the string.
	 */
	if ((astr = ASN1_STRING_new()) == NULL) {
		fprintf(stderr, "FAIL: ASN1_STRING_new() returned NULL\n");
		goto failed;
	}

	p = asn1_sequence_ber;
	len = sizeof(asn1_sequence_ber);
	if (ASN1_item_d2i((ASN1_VALUE **)&astr, &p, len,
	    &ASN1_SEQUENCE_it) == NULL) {
		fprintf(stderr, "FAIL: failed to decode ASN1_SEQUENCE\n");
		ERR_print_errors_fp(stderr);
		goto failed;
	}

	if (!asn1_compare_bytes("sequence", ASN1_STRING_data(astr),
	    ASN1_STRING_length(astr), asn1_sequence_content,
	    sizeof(asn1_sequence_content)))
		goto failed;

	p = asn1_sequence_indefinite_ber;
	len = sizeof(asn1_sequence_indefinite_ber);
	if (ASN1_item_d2i((ASN1_VALUE **)&astr, &p, len,
	    &ASN1_SEQUENCE_it) == NULL) {
		fprintf(stderr, "FAIL: failed to decode ASN1_SEQUENCE\n");
		ERR_print_errors_fp(stderr);
		goto failed;
	}

	if (!asn1_compare_bytes("sequence indefinite", ASN1_STRING_data(astr),
	    ASN1_STRING_length(astr), asn1_sequence_indefinite_content,
	    sizeof(asn1_sequence_indefinite_content)))
		goto failed;

	failed = 0;

 failed:
	ASN1_STRING_free(astr);

	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= do_asn1_constructed_tests();
	failed |= do_asn1_sequence_string_tests();

	return (failed);
}
Changes to jni/libressl/tests/asn1evp.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1evp.c,v 1.4 2021/04/06 16:30:27 tb Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1evp.c,v 1.5 2022/09/05 21:06:31 tb Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

	if (!ASN1_TYPE_set_int_octetstring(at, num, test_octetstring,
	    sizeof(test_octetstring))) {
		fprintf(stderr, "FAIL: ASN1_TYPE_set_int_octetstring failed\n");
		goto done;
	}
	if (at->type != V_ASN1_SEQUENCE) {
		fprintf(stderr, "FAIL: not a V_ASN1_SEQUENCE (%i != %i)\n",
		    at->type, V_ASN1_SEQUENCE);
		goto done;
	}
	if (at->value.sequence->type != V_ASN1_OCTET_STRING) {
		fprintf(stderr, "FAIL: not a V_ASN1_OCTET_STRING (%i != %i)\n",
		    at->type, V_ASN1_OCTET_STRING);
		goto done;
	}
	if (compare_data("sequence", at->value.sequence->data,
	    at->value.sequence->length, asn1_atios, sizeof(asn1_atios)) == -1)
		goto done;

	memset(&data, 0, sizeof(data));
	num = 0;

	if ((len = ASN1_TYPE_get_int_octetstring(at, &num, data,
	    sizeof(data))) < 0) {
		fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n");
		goto done;
	}
	if (num != TEST_NUM) {
		fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM);
		goto done;
	}
	if (compare_data("octet string", data, len,
	    test_octetstring, sizeof(test_octetstring)) == -1)
		goto done;
	if (data[len] != 0) {
		fprintf(stderr, "FAIL: octet string overflowed buffer\n");
		goto done;
	}

	memset(&data, 0, sizeof(data));
	num = 0;

	/* With a limit buffer, the output should be truncated... */
	if ((len = ASN1_TYPE_get_int_octetstring(at, &num, data, 4)) < 0) {
		fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n");
		goto done;
	}
	if (num != TEST_NUM) {
		fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM);
		goto done;
	}
	if (len != sizeof(test_octetstring)) {
		fprintf(stderr, "FAIL: got length mismatch (%i != %zu)\n",
		    len, sizeof(test_octetstring));
		goto done;
	}
	if (compare_data("octet string", data, 4, test_octetstring, 4) == -1)
		goto done;
	if (data[4] != 0) {
		fprintf(stderr, "FAIL: octet string overflowed buffer\n");







|




|
















|



















|



|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

	if (!ASN1_TYPE_set_int_octetstring(at, num, test_octetstring,
	    sizeof(test_octetstring))) {
		fprintf(stderr, "FAIL: ASN1_TYPE_set_int_octetstring failed\n");
		goto done;
	}
	if (at->type != V_ASN1_SEQUENCE) {
		fprintf(stderr, "FAIL: not a V_ASN1_SEQUENCE (%d != %d)\n",
		    at->type, V_ASN1_SEQUENCE);
		goto done;
	}
	if (at->value.sequence->type != V_ASN1_OCTET_STRING) {
		fprintf(stderr, "FAIL: not a V_ASN1_OCTET_STRING (%d != %d)\n",
		    at->type, V_ASN1_OCTET_STRING);
		goto done;
	}
	if (compare_data("sequence", at->value.sequence->data,
	    at->value.sequence->length, asn1_atios, sizeof(asn1_atios)) == -1)
		goto done;

	memset(&data, 0, sizeof(data));
	num = 0;

	if ((len = ASN1_TYPE_get_int_octetstring(at, &num, data,
	    sizeof(data))) < 0) {
		fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n");
		goto done;
	}
	if (num != TEST_NUM) {
		fprintf(stderr, "FAIL: got num %ld, want %ld\n", num, TEST_NUM);
		goto done;
	}
	if (compare_data("octet string", data, len,
	    test_octetstring, sizeof(test_octetstring)) == -1)
		goto done;
	if (data[len] != 0) {
		fprintf(stderr, "FAIL: octet string overflowed buffer\n");
		goto done;
	}

	memset(&data, 0, sizeof(data));
	num = 0;

	/* With a limit buffer, the output should be truncated... */
	if ((len = ASN1_TYPE_get_int_octetstring(at, &num, data, 4)) < 0) {
		fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n");
		goto done;
	}
	if (num != TEST_NUM) {
		fprintf(stderr, "FAIL: got num %ld, want %ld\n", num, TEST_NUM);
		goto done;
	}
	if (len != sizeof(test_octetstring)) {
		fprintf(stderr, "FAIL: got length mismatch (%d != %zu)\n",
		    len, sizeof(test_octetstring));
		goto done;
	}
	if (compare_data("octet string", data, 4, test_octetstring, 4) == -1)
		goto done;
	if (data[4] != 0) {
		fprintf(stderr, "FAIL: octet string overflowed buffer\n");
Changes to jni/libressl/tests/asn1object.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1object.c,v 1.6 2022/03/19 17:37:10 jsing Exp $ */
/*
 * Copyright (c) 2017, 2021, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1object.c,v 1.9 2022/09/05 21:06:31 tb Exp $ */
/*
 * Copyright (c) 2017, 2021, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

static int
asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%i != %i)\n", label, len1, len2);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

static int
asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%d != %d)\n", label, len1, len2);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {
272
273
274
275
276
277
278





279
280
281
282
283
284
285
	aobj = NULL;

	p = aot->der;
	if ((aobj = d2i_ASN1_OBJECT(NULL, &p, aot->der_len)) == NULL) {
		fprintf(stderr, "FAIL: d2i_ASN1_OBJECT() failed\n");
		goto failed;
	}






	if (aot->txt != NULL) {
		ret = i2t_ASN1_OBJECT(buf, sizeof(buf), aobj);
		if (ret <= 0 || (size_t)ret >= sizeof(buf)) {
			fprintf(stderr, "FAIL: i2t_ASN1_OBJECT() failed\n");
			goto failed;
		}







>
>
>
>
>







272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
	aobj = NULL;

	p = aot->der;
	if ((aobj = d2i_ASN1_OBJECT(NULL, &p, aot->der_len)) == NULL) {
		fprintf(stderr, "FAIL: d2i_ASN1_OBJECT() failed\n");
		goto failed;
	}
	if (p != aot->der + aot->der_len) {
		fprintf(stderr, "FAIL: d2i_ASN1_OBJECT() p = %p, want %p\n",
		    p, aot->der + aot->der_len);
		goto failed;
	}

	if (aot->txt != NULL) {
		ret = i2t_ASN1_OBJECT(buf, sizeof(buf), aobj);
		if (ret <= 0 || (size_t)ret >= sizeof(buf)) {
			fprintf(stderr, "FAIL: i2t_ASN1_OBJECT() failed\n");
			goto failed;
		}
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
	if (aobj == NULL) {
		fprintf(stderr, "FAIL: d2i_ASN1_OBJECT() failed\n");
		goto failed;
	}
	ret = i2t_ASN1_OBJECT(small_buf, sizeof(small_buf), aobj);
	if (ret < 0 || (unsigned long)ret != strlen(obj_txt)) {
		fprintf(stderr, "FAIL: i2t_ASN1_OBJECT() with small buffer "
		    "returned %d, want %lu\n", ret, strlen(obj_txt));
		goto failed;
	}

	if ((bio = BIO_new(BIO_s_mem())) == NULL) {
		fprintf(stderr, "FAIL: BIO_new() returned NULL\n");
		goto failed;
	}







|







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
	if (aobj == NULL) {
		fprintf(stderr, "FAIL: d2i_ASN1_OBJECT() failed\n");
		goto failed;
	}
	ret = i2t_ASN1_OBJECT(small_buf, sizeof(small_buf), aobj);
	if (ret < 0 || (unsigned long)ret != strlen(obj_txt)) {
		fprintf(stderr, "FAIL: i2t_ASN1_OBJECT() with small buffer "
		    "returned %d, want %zu\n", ret, strlen(obj_txt));
		goto failed;
	}

	if ((bio = BIO_new(BIO_s_mem())) == NULL) {
		fprintf(stderr, "FAIL: BIO_new() returned NULL\n");
		goto failed;
	}
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
	if ((ret = BIO_reset(bio)) <= 0) {
		fprintf(stderr, "FAIL: BIO_reset failed: ret = %d\n", ret);
		goto failed;
	}
	ret = i2a_ASN1_OBJECT(bio, aobj);
	if (ret < 0 || (unsigned long)ret != strlen(obj_txt)) {
		fprintf(stderr, "FAIL: i2a_ASN1_OBJECT() returned %d, "
		    "want %lu\n", ret, strlen(obj_txt));
		goto failed;
	}
	data_len = BIO_get_mem_data(bio, &data);
	if (ret != data_len || memcmp(obj_txt, data, data_len) != 0) {
		fprintf(stderr, "FAIL: i2a_ASN1_OBJECT() did not return "
		    "'%s'\n", obj_txt);
		goto failed;







|







417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
	if ((ret = BIO_reset(bio)) <= 0) {
		fprintf(stderr, "FAIL: BIO_reset failed: ret = %d\n", ret);
		goto failed;
	}
	ret = i2a_ASN1_OBJECT(bio, aobj);
	if (ret < 0 || (unsigned long)ret != strlen(obj_txt)) {
		fprintf(stderr, "FAIL: i2a_ASN1_OBJECT() returned %d, "
		    "want %zu\n", ret, strlen(obj_txt));
		goto failed;
	}
	data_len = BIO_get_mem_data(bio, &data);
	if (ret != data_len || memcmp(obj_txt, data, data_len) != 0) {
		fprintf(stderr, "FAIL: i2a_ASN1_OBJECT() did not return "
		    "'%s'\n", obj_txt);
		goto failed;
Changes to jni/libressl/tests/asn1test.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: asn1test.c,v 1.10 2022/01/11 19:08:08 jsing Exp $	*/
/*
 * Copyright (c) 2014, 2016 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: asn1test.c,v 1.11 2022/06/07 18:00:51 tb Exp $	*/
/*
 * Copyright (c) 2014, 2016 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
}

static int
session_cmp(SSL_SESSION *s1, SSL_SESSION *s2)
{
	/* Compare the ASN.1 encoded values from two sessions. */
	if (s1->ssl_version != s2->ssl_version) {
		fprintf(stderr, "ssl_version differs: %i != %i\n",
		    s1->ssl_version, s2->ssl_version);
		return (1);
	}
	if (s1->cipher_id != s2->cipher_id) {
		fprintf(stderr, "cipher_id differs: %li != %li\n",
		    s1->cipher_id, s2->cipher_id);
		return (1);
	}

	if (s1->master_key_length != s2->master_key_length) {
		fprintf(stderr, "master_key_length differs: %i != %i\n",
		    s1->master_key_length, s2->master_key_length);
		return (1);
	}
	if (session_strcmp(s1->master_key, s2->master_key,
	    s1->master_key_length) != 0) {
		fprintf(stderr, "master_key differs\n");
		return (1);
	}

	if (s1->session_id_length != s2->session_id_length) {
		fprintf(stderr, "session_id_length differs: %i != %i\n",
		    s1->session_id_length, s2->session_id_length);
		return (1);
	}
	if (session_strcmp(s1->session_id, s2->session_id,
	    s1->session_id_length) != 0) {
		fprintf(stderr, "session_id differs\n");
		return (1);
	}

	if (s1->sid_ctx_length != s2->sid_ctx_length) {
		fprintf(stderr, "sid_ctx_length differs: %i != %i\n",
		    s1->sid_ctx_length, s2->sid_ctx_length);
		return (1);
	}
	if (session_strcmp(s1->sid_ctx, s2->sid_ctx,
	    s1->sid_ctx_length) != 0) {
		fprintf(stderr, "sid_ctx differs\n");
		return (1);
	}

	/* d2i_SSL_SESSION uses the current time if decoding a zero value. */
	if ((s1->time != s2->time) && s1->time != 0 && s2->time != 0) {
		fprintf(stderr, "time differs: %lli != %lli\n",
		    (long long)s1->time, (long long)s2->time);
		return (1);
	}
	/* d2i_SSL_SESSION uses a timeout of 3 if decoding a zero value. */
	if ((s1->timeout != s2->timeout) &&
	    s1->timeout != 3 && s2->timeout != 3) {
		fprintf(stderr, "timeout differs: %li != %li\n",
		    s1->timeout, s2->timeout);
		return (1);
	}

	/* Ensure that a certificate is or is not present in both. */
	if ((s1->peer_cert != NULL || s2->peer_cert != NULL) &&
	    (s1->peer_cert == NULL || s2->peer_cert == NULL ||
	     X509_cmp(s1->peer_cert, s2->peer_cert) != 0)) {
		fprintf(stderr, "peer_cert differs\n");
		return (1);
	}

	if (s1->verify_result != s2->verify_result) {
		fprintf(stderr, "verify_result differs: %li != %li\n",
		    s1->verify_result, s2->verify_result);
		return (1);
	}

	if (session_strcmp(s1->tlsext_hostname, s2->tlsext_hostname,
	    (s1->tlsext_hostname ? strlen(s1->tlsext_hostname) : 0)) != 0) {
		fprintf(stderr, "sid_ctx differs\n");







|




|





|










|










|











|






|













|







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
}

static int
session_cmp(SSL_SESSION *s1, SSL_SESSION *s2)
{
	/* Compare the ASN.1 encoded values from two sessions. */
	if (s1->ssl_version != s2->ssl_version) {
		fprintf(stderr, "ssl_version differs: %d != %d\n",
		    s1->ssl_version, s2->ssl_version);
		return (1);
	}
	if (s1->cipher_id != s2->cipher_id) {
		fprintf(stderr, "cipher_id differs: %ld != %ld\n",
		    s1->cipher_id, s2->cipher_id);
		return (1);
	}

	if (s1->master_key_length != s2->master_key_length) {
		fprintf(stderr, "master_key_length differs: %zu != %zu\n",
		    s1->master_key_length, s2->master_key_length);
		return (1);
	}
	if (session_strcmp(s1->master_key, s2->master_key,
	    s1->master_key_length) != 0) {
		fprintf(stderr, "master_key differs\n");
		return (1);
	}

	if (s1->session_id_length != s2->session_id_length) {
		fprintf(stderr, "session_id_length differs: %zu != %zu\n",
		    s1->session_id_length, s2->session_id_length);
		return (1);
	}
	if (session_strcmp(s1->session_id, s2->session_id,
	    s1->session_id_length) != 0) {
		fprintf(stderr, "session_id differs\n");
		return (1);
	}

	if (s1->sid_ctx_length != s2->sid_ctx_length) {
		fprintf(stderr, "sid_ctx_length differs: %zu != %zu\n",
		    s1->sid_ctx_length, s2->sid_ctx_length);
		return (1);
	}
	if (session_strcmp(s1->sid_ctx, s2->sid_ctx,
	    s1->sid_ctx_length) != 0) {
		fprintf(stderr, "sid_ctx differs\n");
		return (1);
	}

	/* d2i_SSL_SESSION uses the current time if decoding a zero value. */
	if ((s1->time != s2->time) && s1->time != 0 && s2->time != 0) {
		fprintf(stderr, "time differs: %lld != %lld\n",
		    (long long)s1->time, (long long)s2->time);
		return (1);
	}
	/* d2i_SSL_SESSION uses a timeout of 3 if decoding a zero value. */
	if ((s1->timeout != s2->timeout) &&
	    s1->timeout != 3 && s2->timeout != 3) {
		fprintf(stderr, "timeout differs: %ld != %ld\n",
		    s1->timeout, s2->timeout);
		return (1);
	}

	/* Ensure that a certificate is or is not present in both. */
	if ((s1->peer_cert != NULL || s2->peer_cert != NULL) &&
	    (s1->peer_cert == NULL || s2->peer_cert == NULL ||
	     X509_cmp(s1->peer_cert, s2->peer_cert) != 0)) {
		fprintf(stderr, "peer_cert differs\n");
		return (1);
	}

	if (s1->verify_result != s2->verify_result) {
		fprintf(stderr, "verify_result differs: %ld != %ld\n",
		    s1->verify_result, s2->verify_result);
		return (1);
	}

	if (session_strcmp(s1->tlsext_hostname, s2->tlsext_hostname,
	    (s1->tlsext_hostname ? strlen(s1->tlsext_hostname) : 0)) != 0) {
		fprintf(stderr, "sid_ctx differs\n");
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
	int i, len, rv = 1;

	if (sat->peer_cert)
		sat->session.peer_cert = peer_cert;

	len = i2d_SSL_SESSION(&sat->session, NULL);
	if (len != sat->asn1_len) {
		fprintf(stderr, "FAIL: test %i returned ASN1 length %i, "
		    "want %i\n", test_no, len, sat->asn1_len);
		goto failed;
	}

	/* See if the test is expected to fail... */
	if (sat->asn1_len == -1)
		return (0);

	if ((asn1 = malloc(len)) == NULL)
		errx(1, "failed to allocate memory");

	ap = asn1;
	len = i2d_SSL_SESSION(&sat->session, &ap);

	/* Check the length again since the code path is different. */
	if (len != sat->asn1_len) {
		fprintf(stderr, "FAIL: test %i returned ASN1 length %i, "
		    "want %i\n", test_no, len, sat->asn1_len);
		goto failed;
	}
	/* ap should now point at the end of the buffer. */
	if (ap - asn1 != len) {
		fprintf(stderr, "FAIL: test %i pointer increment does not "
		    "match length (%i != %i)\n", test_no, (int)(ap - asn1), len);
		goto failed;
	}

	if (memcmp(asn1, &sat->asn1, len) != 0) {
		fprintf(stderr, "FAIL: test %i - encoding differs:\n", test_no);
		fprintf(stderr, "encoding:\n");
		for (i = 1; i <= len; i++) {
			fprintf(stderr, " 0x%02hhx,", asn1[i - 1]);
			if (i % 8 == 0)
				fprintf(stderr, "\n");
		}
		fprintf(stderr, "\n");
		fprintf(stderr, "test data:\n");
		for (i = 1; i <= sat->asn1_len; i++) {
			fprintf(stderr, " 0x%02hhx,", sat->asn1[i - 1]);
			if (i % 8 == 0)
				fprintf(stderr, "\n");
		}
		fprintf(stderr, "\n");
		goto failed;
	}

	pp = sat->asn1;

	if ((sp = d2i_SSL_SESSION(NULL, &pp, sat->asn1_len)) == NULL) {
		fprintf(stderr, "FAIL: test %i - decoding failed\n", test_no);
		goto failed;
	}

	if (session_cmp(sp, &sat->session) != 0) {
		fprintf(stderr, "FAIL: test %i - decoding differs\n", test_no);
		goto failed;
	}

	rv = 0;

 failed:
	ERR_print_errors_fp(stderr);







|
|















|
|




|
|




|




















|




|







377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
	int i, len, rv = 1;

	if (sat->peer_cert)
		sat->session.peer_cert = peer_cert;

	len = i2d_SSL_SESSION(&sat->session, NULL);
	if (len != sat->asn1_len) {
		fprintf(stderr, "FAIL: test %d returned ASN1 length %d, "
		    "want %d\n", test_no, len, sat->asn1_len);
		goto failed;
	}

	/* See if the test is expected to fail... */
	if (sat->asn1_len == -1)
		return (0);

	if ((asn1 = malloc(len)) == NULL)
		errx(1, "failed to allocate memory");

	ap = asn1;
	len = i2d_SSL_SESSION(&sat->session, &ap);

	/* Check the length again since the code path is different. */
	if (len != sat->asn1_len) {
		fprintf(stderr, "FAIL: test %d returned ASN1 length %d, "
		    "want %d\n", test_no, len, sat->asn1_len);
		goto failed;
	}
	/* ap should now point at the end of the buffer. */
	if (ap - asn1 != len) {
		fprintf(stderr, "FAIL: test %d pointer increment does not "
		    "match length (%d != %d)\n", test_no, (int)(ap - asn1), len);
		goto failed;
	}

	if (memcmp(asn1, &sat->asn1, len) != 0) {
		fprintf(stderr, "FAIL: test %d - encoding differs:\n", test_no);
		fprintf(stderr, "encoding:\n");
		for (i = 1; i <= len; i++) {
			fprintf(stderr, " 0x%02hhx,", asn1[i - 1]);
			if (i % 8 == 0)
				fprintf(stderr, "\n");
		}
		fprintf(stderr, "\n");
		fprintf(stderr, "test data:\n");
		for (i = 1; i <= sat->asn1_len; i++) {
			fprintf(stderr, " 0x%02hhx,", sat->asn1[i - 1]);
			if (i % 8 == 0)
				fprintf(stderr, "\n");
		}
		fprintf(stderr, "\n");
		goto failed;
	}

	pp = sat->asn1;

	if ((sp = d2i_SSL_SESSION(NULL, &pp, sat->asn1_len)) == NULL) {
		fprintf(stderr, "FAIL: test %d - decoding failed\n", test_no);
		goto failed;
	}

	if (session_cmp(sp, &sat->session) != 0) {
		fprintf(stderr, "FAIL: test %d - decoding differs\n", test_no);
		goto failed;
	}

	rv = 0;

 failed:
	ERR_print_errors_fp(stderr);
Changes to jni/libressl/tests/asn1time.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1time.c,v 1.9 2021/12/09 16:31:33 jsing Exp $ */
/*
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1time.c,v 1.16 2022/09/05 21:06:31 tb Exp $ */
/*
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
62
63
64
65
66
67
68




69
70


























71










72
73
74
75
76
77
78
	{
		/* UTC time cannot have fractional seconds. */
		.str = "150923032700.123Z",
	},
	{
		.str = "aaaaaaaaaaaaaaZ",
	},




};



























struct asn1_time_test asn1_gentime_tests[] = {










	{
		.str = "19700101000000Z",
		.data = "19700101000000Z",
		.time = 0,
		.der = {
			0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31,
			0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,







>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	{
		/* UTC time cannot have fractional seconds. */
		.str = "150923032700.123Z",
	},
	{
		.str = "aaaaaaaaaaaaaaZ",
	},
	/* utc time with omitted seconds, should fail */
	{
		.str = "1609082343Z",
	},
};

struct asn1_time_test asn1_invgentime_tests[] = {
	/* Generalized time with omitted seconds, should fail */
	{
		.str = "201612081934Z",
	},
	/* Valid UTC time, should fail as a generalized time */
	{
		.str = "160908234300Z",
	},
};

struct asn1_time_test asn1_goodtime_tests[] = {
	{
		.str = "99990908234339Z",
		.time = 1,
	},
	{
		.str = "201612081934Z",
		.time = 1,
	},
	{
		.str = "1609082343Z",
		.time = 0,
	},
};

struct asn1_time_test asn1_gentime_tests[] = {
	{
		.str = "20161208193400Z",
		.data = "20161208193400Z",
		.time = 1481225640,
		.der = {
			0x18, 0x0f, 0x32, 0x30, 0x31, 0x36, 0x31, 0x32,
			0x30, 0x38, 0x31, 0x39, 0x33, 0x34, 0x30, 0x30,
			0x5a,
		},
	},
	{
		.str = "19700101000000Z",
		.data = "19700101000000Z",
		.time = 0,
		.der = {
			0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31,
			0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
128
129
130
131
132
133
134


135
136
137
138
139
140
141
			0x31, 0x34, 0x34, 0x35, 0x31, 0x32, 0x5a
		},
	},
};

#define N_INVTIME_TESTS \
    (sizeof(asn1_invtime_tests) / sizeof(*asn1_invtime_tests))


#define N_GENTIME_TESTS \
    (sizeof(asn1_gentime_tests) / sizeof(*asn1_gentime_tests))
#define N_UTCTIME_TESTS \
    (sizeof(asn1_utctime_tests) / sizeof(*asn1_utctime_tests))

static void
hexdump(const unsigned char *buf, size_t len)







>
>







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
			0x31, 0x34, 0x34, 0x35, 0x31, 0x32, 0x5a
		},
	},
};

#define N_INVTIME_TESTS \
    (sizeof(asn1_invtime_tests) / sizeof(*asn1_invtime_tests))
#define N_INVGENTIME_TESTS \
    (sizeof(asn1_invgentime_tests) / sizeof(*asn1_invgentime_tests))
#define N_GENTIME_TESTS \
    (sizeof(asn1_gentime_tests) / sizeof(*asn1_gentime_tests))
#define N_UTCTIME_TESTS \
    (sizeof(asn1_utctime_tests) / sizeof(*asn1_utctime_tests))

static void
hexdump(const unsigned char *buf, size_t len)
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209






210
211
212
213
214
215
216





217
218
219
220
221
222
223
}

static int
asn1_compare_bytes(int test_no, const unsigned char *d1,
    const unsigned char *d2, int len1, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: test %i - byte lengths differ "
		    "(%i != %i)\n", test_no, len1, len2);
		return (1);
	}
	if (memcmp(d1, d2, len1) != 0) {
		fprintf(stderr, "FAIL: test %i - bytes differ\n", test_no);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return (1);
	}
	return (0);
}

static int
asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str)
{
	int length = strlen(str);

	if (asn1str->length != length) {
		fprintf(stderr, "FAIL: test %i - string lengths differ "
		    "(%i != %i)\n", test_no, asn1str->length, length);
		return (1);
	}
	if (strncmp(asn1str->data, str, length) != 0) {
		fprintf(stderr, "FAIL: test %i - strings differ "
		    "('%s' != '%s')\n", test_no, asn1str->data, str);
		return (1);
	}

	return (0);
}

static int
asn1_invtime_test(int test_no, struct asn1_time_test *att)
{
	ASN1_GENERALIZEDTIME *gt = NULL;
	ASN1_UTCTIME *ut = NULL;
	ASN1_TIME *t = NULL;
	int failure = 1;

	if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
		goto done;
	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;
	if ((t = ASN1_TIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) {
		fprintf(stderr, "FAIL: test %i - successfully set "
		    "GENERALIZEDTIME string '%s'\n", test_no, att->str);
		goto done;
	}






	if (ASN1_UTCTIME_set_string(ut, att->str) != 0) {
		fprintf(stderr, "FAIL: test %i - successfully set UTCTIME "
		    "string '%s'\n", test_no, att->str);
		goto done;
	}
	if (ASN1_TIME_set_string(t, att->str) != 0) {
		fprintf(stderr, "FAIL: test %i - successfully set TIME "





		    "string '%s'\n", test_no, att->str);
		goto done;
	}

	failure = 0;

 done:







|
|



|















|
|



|








|














|



>
>
>
>
>
>

|




|
>
>
>
>
>







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
}

static int
asn1_compare_bytes(int test_no, const unsigned char *d1,
    const unsigned char *d2, int len1, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: test %d - byte lengths differ "
		    "(%d != %d)\n", test_no, len1, len2);
		return (1);
	}
	if (memcmp(d1, d2, len1) != 0) {
		fprintf(stderr, "FAIL: test %d - bytes differ\n", test_no);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return (1);
	}
	return (0);
}

static int
asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str)
{
	int length = strlen(str);

	if (asn1str->length != length) {
		fprintf(stderr, "FAIL: test %d - string lengths differ "
		    "(%d != %d)\n", test_no, asn1str->length, length);
		return (1);
	}
	if (strncmp(asn1str->data, str, length) != 0) {
		fprintf(stderr, "FAIL: test %d - strings differ "
		    "('%s' != '%s')\n", test_no, asn1str->data, str);
		return (1);
	}

	return (0);
}

static int
asn1_invtime_test(int test_no, struct asn1_time_test *att, int gen)
{
	ASN1_GENERALIZEDTIME *gt = NULL;
	ASN1_UTCTIME *ut = NULL;
	ASN1_TIME *t = NULL;
	int failure = 1;

	if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
		goto done;
	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;
	if ((t = ASN1_TIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) {
		fprintf(stderr, "FAIL: test %d - successfully set "
		    "GENERALIZEDTIME string '%s'\n", test_no, att->str);
		goto done;
	}

	if (gen)  {
		failure = 0;
		goto done;
	}

	if (ASN1_UTCTIME_set_string(ut, att->str) != 0) {
		fprintf(stderr, "FAIL: test %d - successfully set UTCTIME "
		    "string '%s'\n", test_no, att->str);
		goto done;
	}
	if (ASN1_TIME_set_string(t, att->str) != 0) {
		fprintf(stderr, "FAIL: test %d - successfully set TIME "
		    "string '%s'\n", test_no, att->str);
		goto done;
	}
	if (ASN1_TIME_set_string_X509(t, att->str) != 0) {
		fprintf(stderr, "FAIL: test %d - successfully set x509 TIME "
		    "string '%s'\n", test_no, att->str);
		goto done;
	}

	failure = 0;

 done:
232
233
234
235
236
237
238

239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256















257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
asn1_gentime_test(int test_no, struct asn1_time_test *att)
{
	const unsigned char *der;
	unsigned char *p = NULL;
	ASN1_GENERALIZEDTIME *gt = NULL;
	int failure = 1;
	int len;


	if (ASN1_GENERALIZEDTIME_set_string(NULL, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->str) != 0)
		goto done;
















	if ((len = i2d_ASN1_GENERALIZEDTIME(gt, &p)) <= 0) {
		fprintf(stderr, "FAIL: test %i - i2d_ASN1_GENERALIZEDTIME "
		    "failed\n", test_no);
		goto done;
	}
	der = att->der;
	if (asn1_compare_bytes(test_no, p, der, len, strlen(der)) != 0)
		goto done;

	len = strlen(att->der);
	if (d2i_ASN1_GENERALIZEDTIME(&gt, &der, len) == NULL) {
		fprintf(stderr, "FAIL: test %i - d2i_ASN1_GENERALIZEDTIME "
		    "failed\n", test_no);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->str) != 0)
		goto done;

	ASN1_GENERALIZEDTIME_free(gt);

	if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %i - failed to set time %lli\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->data) != 0)
		goto done;

	failure = 0;







>


|








|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|









|









|







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
asn1_gentime_test(int test_no, struct asn1_time_test *att)
{
	const unsigned char *der;
	unsigned char *p = NULL;
	ASN1_GENERALIZEDTIME *gt = NULL;
	int failure = 1;
	int len;
	struct tm tm;

	if (ASN1_GENERALIZEDTIME_set_string(NULL, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->str) != 0)
		goto done;

	if (ASN1_TIME_to_tm(gt, &tm) == 0)  {
		fprintf(stderr, "FAIL: test %d - ASN1_time_to_tm failed '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if (timegm(&tm) != att->time) {
		/* things with crappy time_t should die in fire */
		int64_t a = timegm(&tm);
		int64_t b = att->time;
		fprintf(stderr, "FAIL: test %d - times don't match, expected %lld got %lld\n",
		    test_no, (long long)b, (long long)a);
		goto done;
	}

	if ((len = i2d_ASN1_GENERALIZEDTIME(gt, &p)) <= 0) {
		fprintf(stderr, "FAIL: test %d - i2d_ASN1_GENERALIZEDTIME "
		    "failed\n", test_no);
		goto done;
	}
	der = att->der;
	if (asn1_compare_bytes(test_no, p, der, len, strlen(der)) != 0)
		goto done;

	len = strlen(att->der);
	if (d2i_ASN1_GENERALIZEDTIME(&gt, &der, len) == NULL) {
		fprintf(stderr, "FAIL: test %d - d2i_ASN1_GENERALIZEDTIME "
		    "failed\n", test_no);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->str) != 0)
		goto done;

	ASN1_GENERALIZEDTIME_free(gt);

	if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %d - failed to set time %lld\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->data) != 0)
		goto done;

	failure = 0;
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371



372
373
374
375
376
377
378
379
380
381
382
























383
384
385
386
387
388

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403






404
405
406
407
408
409
410
	const unsigned char *der;
	unsigned char *p = NULL;
	ASN1_UTCTIME *ut = NULL;
	int failure = 1;
	int len;

	if (ASN1_UTCTIME_set_string(NULL, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;

	if (ASN1_UTCTIME_set_string(ut, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->str) != 0)
		goto done;

	if ((len = i2d_ASN1_UTCTIME(ut, &p)) <= 0) {
		fprintf(stderr, "FAIL: test %i - i2d_ASN1_UTCTIME failed\n",
		    test_no);
		goto done;
	}
	der = att->der;
	if (asn1_compare_bytes(test_no, p, der, len, strlen(der)) != 0)
		goto done;

	len = strlen(att->der);
	if (d2i_ASN1_UTCTIME(&ut, &der, len) == NULL) {
		fprintf(stderr, "FAIL: test %i - d2i_ASN1_UTCTIME failed\n",
		    test_no);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->str) != 0)
		goto done;

	ASN1_UTCTIME_free(ut);

	if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %i - failed to set time %lli\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->data) != 0)
		goto done;

	failure = 0;

 done:
	ASN1_UTCTIME_free(ut);
	free(p);

	return (failure);
}

static int
asn1_time_test(int test_no, struct asn1_time_test *att, int type)
{
	ASN1_TIME *t = NULL;
	int failure = 1;

	if (ASN1_TIME_set_string(NULL, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if ((t = ASN1_TIME_new()) == NULL)
		goto done;




	if (ASN1_TIME_set_string(t, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if (t->type != type) {
		fprintf(stderr, "FAIL: test %i - got type %i, want %i\n",
		    test_no, t->type, type);
		goto done;
	}

























	failure = 0;

 done:

	ASN1_TIME_free(t);


	return (failure);
}

int
main(int argc, char **argv)
{
	struct asn1_time_test *att;
	int failed = 0;
	size_t i;

	fprintf(stderr, "Invalid time tests...\n");
	for (i = 0; i < N_INVTIME_TESTS; i++) {
		att = &asn1_invtime_tests[i];
		failed |= asn1_invtime_test(i, att);






	}

	fprintf(stderr, "GENERALIZEDTIME tests...\n");
	for (i = 0; i < N_GENTIME_TESTS; i++) {
		att = &asn1_gentime_tests[i];
		failed |= asn1_gentime_test(i, att);
	}







|








|







|









|









|


















|



|







>
>
>

|





|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






>














|
>
>
>
>
>
>







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
	const unsigned char *der;
	unsigned char *p = NULL;
	ASN1_UTCTIME *ut = NULL;
	int failure = 1;
	int len;

	if (ASN1_UTCTIME_set_string(NULL, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;

	if (ASN1_UTCTIME_set_string(ut, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->str) != 0)
		goto done;

	if ((len = i2d_ASN1_UTCTIME(ut, &p)) <= 0) {
		fprintf(stderr, "FAIL: test %d - i2d_ASN1_UTCTIME failed\n",
		    test_no);
		goto done;
	}
	der = att->der;
	if (asn1_compare_bytes(test_no, p, der, len, strlen(der)) != 0)
		goto done;

	len = strlen(att->der);
	if (d2i_ASN1_UTCTIME(&ut, &der, len) == NULL) {
		fprintf(stderr, "FAIL: test %d - d2i_ASN1_UTCTIME failed\n",
		    test_no);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->str) != 0)
		goto done;

	ASN1_UTCTIME_free(ut);

	if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %d - failed to set time %lld\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->data) != 0)
		goto done;

	failure = 0;

 done:
	ASN1_UTCTIME_free(ut);
	free(p);

	return (failure);
}

static int
asn1_time_test(int test_no, struct asn1_time_test *att, int type)
{
	ASN1_TIME *t = NULL, *tx509 = NULL;
	int failure = 1;

	if (ASN1_TIME_set_string(NULL, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if ((t = ASN1_TIME_new()) == NULL)
		goto done;

	if ((tx509 = ASN1_TIME_new()) == NULL)
		goto done;

	if (ASN1_TIME_set_string(t, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if (t->type != type) {
		fprintf(stderr, "FAIL: test %d - got type %d, want %d\n",
		    test_no, t->type, type);
		goto done;
	}

	if (ASN1_TIME_normalize(t) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set normalize '%s'\n",
		    test_no, att->str);
		goto done;
	}

	if (ASN1_TIME_set_string_X509(tx509, t->data) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string X509 '%s'\n",
		    test_no, t->data);
		goto done;
	}

	if (t->type != tx509->type) {
		fprintf(stderr, "FAIL: test %d - type %d, different from %d\n",
		    test_no, t->type, tx509->type);
		goto done;
	}

	if (ASN1_TIME_compare(t, tx509) != 0) {
		fprintf(stderr, "FAIL: ASN1_TIME values differ!\n");
		goto done;
	}


	failure = 0;

 done:

	ASN1_TIME_free(t);
	ASN1_TIME_free(tx509);

	return (failure);
}

int
main(int argc, char **argv)
{
	struct asn1_time_test *att;
	int failed = 0;
	size_t i;

	fprintf(stderr, "Invalid time tests...\n");
	for (i = 0; i < N_INVTIME_TESTS; i++) {
		att = &asn1_invtime_tests[i];
		failed |= asn1_invtime_test(i, att, 0);
	}

	fprintf(stderr, "Invalid generalized time tests...\n");
	for (i = 0; i < N_INVGENTIME_TESTS; i++) {
		att = &asn1_invgentime_tests[i];
		failed |= asn1_invtime_test(i, att, 1);
	}

	fprintf(stderr, "GENERALIZEDTIME tests...\n");
	for (i = 0; i < N_GENTIME_TESTS; i++) {
		att = &asn1_gentime_tests[i];
		failed |= asn1_gentime_test(i, att);
	}
Changes to jni/libressl/tests/asn1x509.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: asn1x509.c,v 1.2 2022/01/12 08:45:09 tb Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: asn1x509.c,v 1.3 2022/04/27 17:43:41 jsing Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
158
159
160
161
162
163
164


165
166
167
168
169
170
171
	EVP_PKEY *pkey_a = NULL, *pkey_b = NULL;
	unsigned char *out = NULL, *data = NULL;
	DSA *dsa_a = NULL, *dsa_b = NULL;
	const unsigned char *p;
	BIO *bio_mem = NULL;
	int failure = 1;
	int len;



	if ((bio_mem = BIO_new_mem_buf((void *)dsa_test_key, -1)) == NULL)
		errx(1, "failed to create BIO");

	if ((dsa_a = PEM_read_bio_DSAPrivateKey(bio_mem, NULL, NULL, NULL)) == NULL) {
		ERR_print_errors_fp(stderr);
		errx(1, "failed to decode DSA key from PEM");







>
>







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
	EVP_PKEY *pkey_a = NULL, *pkey_b = NULL;
	unsigned char *out = NULL, *data = NULL;
	DSA *dsa_a = NULL, *dsa_b = NULL;
	const unsigned char *p;
	BIO *bio_mem = NULL;
	int failure = 1;
	int len;

	ERR_clear_error();

	if ((bio_mem = BIO_new_mem_buf((void *)dsa_test_key, -1)) == NULL)
		errx(1, "failed to create BIO");

	if ((dsa_a = PEM_read_bio_DSAPrivateKey(bio_mem, NULL, NULL, NULL)) == NULL) {
		ERR_print_errors_fp(stderr);
		errx(1, "failed to decode DSA key from PEM");
283
284
285
286
287
288
289


290
291
292
293
294
295
296
	EVP_PKEY *pkey_a = NULL, *pkey_b = NULL;
	unsigned char *out = NULL, *data = NULL;
	EC_KEY *ec_a = NULL, *ec_b = NULL;
	const unsigned char *p;
	BIO *bio_mem = NULL;
	int failure = 1;
	int len;



	if ((bio_mem = BIO_new_mem_buf((void *)ec_test_key, -1)) == NULL)
		errx(1, "failed to create BIO");

	if ((ec_a = PEM_read_bio_ECPrivateKey(bio_mem, NULL, NULL, NULL)) == NULL) {
		ERR_print_errors_fp(stderr);
		errx(1, "failed to decode EC key from PEM");







>
>







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
	EVP_PKEY *pkey_a = NULL, *pkey_b = NULL;
	unsigned char *out = NULL, *data = NULL;
	EC_KEY *ec_a = NULL, *ec_b = NULL;
	const unsigned char *p;
	BIO *bio_mem = NULL;
	int failure = 1;
	int len;

	ERR_clear_error();

	if ((bio_mem = BIO_new_mem_buf((void *)ec_test_key, -1)) == NULL)
		errx(1, "failed to create BIO");

	if ((ec_a = PEM_read_bio_ECPrivateKey(bio_mem, NULL, NULL, NULL)) == NULL) {
		ERR_print_errors_fp(stderr);
		errx(1, "failed to decode EC key from PEM");
432
433
434
435
436
437
438


439
440
441
442
443
444
445
	EVP_PKEY *pkey_a = NULL, *pkey_b = NULL;
	RSA *rsa_a = NULL, *rsa_b = NULL;
	unsigned char *out = NULL, *data = NULL;
	const unsigned char *p;
	BIO *bio_mem = NULL;
	int failure = 1;
	int len;



	if ((bio_mem = BIO_new_mem_buf((void *)rsa_test_key, -1)) == NULL)
		errx(1, "failed to create BIO");

	if ((rsa_a = PEM_read_bio_RSAPrivateKey(bio_mem, NULL, NULL, NULL)) == NULL) {
		ERR_print_errors_fp(stderr);
		errx(1, "failed to decode RSA key from PEM");







>
>







436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
	EVP_PKEY *pkey_a = NULL, *pkey_b = NULL;
	RSA *rsa_a = NULL, *rsa_b = NULL;
	unsigned char *out = NULL, *data = NULL;
	const unsigned char *p;
	BIO *bio_mem = NULL;
	int failure = 1;
	int len;

	ERR_clear_error();

	if ((bio_mem = BIO_new_mem_buf((void *)rsa_test_key, -1)) == NULL)
		errx(1, "failed to create BIO");

	if ((rsa_a = PEM_read_bio_RSAPrivateKey(bio_mem, NULL, NULL, NULL)) == NULL) {
		ERR_print_errors_fp(stderr);
		errx(1, "failed to decode RSA key from PEM");
Changes to jni/libressl/tests/base64test.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: base64test.c,v 1.9 2021/03/21 14:06:29 tb Exp $	*/
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: base64test.c,v 1.10 2022/09/05 21:06:31 tb Exp $	*/
/*
 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
	bio_mem = BIO_push(bio_b64, bio_mem);

	if (!test_nl)
		BIO_set_flags(bio_b64, BIO_FLAGS_BASE64_NO_NL);

	len = BIO_write(bio_mem, bt->in, bt->in_len);
	if (len != bt->in_len) {
		fprintf(stderr, "FAIL: test %i - only wrote %zi out of %zi "
		    "characters\n", test_no, len, bt->in_len);
		failure = 1;
		goto done;
	}
	if (BIO_flush(bio_mem) < 0) {
		fprintf(stderr, "FAIL: test %i - flush failed\n", test_no);
		failure = 1;
		goto done;
	}

	b64len = 0;
	for (i = 0; i < bt->out_len; i++) {
		if ((!test_nl ||







|





|







300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
	bio_mem = BIO_push(bio_b64, bio_mem);

	if (!test_nl)
		BIO_set_flags(bio_b64, BIO_FLAGS_BASE64_NO_NL);

	len = BIO_write(bio_mem, bt->in, bt->in_len);
	if (len != bt->in_len) {
		fprintf(stderr, "FAIL: test %d - only wrote %zd out of %zd "
		    "characters\n", test_no, len, bt->in_len);
		failure = 1;
		goto done;
	}
	if (BIO_flush(bio_mem) < 0) {
		fprintf(stderr, "FAIL: test %d - flush failed\n", test_no);
		failure = 1;
		goto done;
	}

	b64len = 0;
	for (i = 0; i < bt->out_len; i++) {
		if ((!test_nl ||
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
	len = BIO_get_mem_data(bio_mem, &out);

	/* An empty string with NL results in no output, rather than '\n'. */
	if (test_nl && b64len == 1 && len == 0)
		goto done;

	if (len != b64len) {
		fprintf(stderr, "FAIL: test %i - encoding resulted in %zi "
		    "characters instead of %zi\n", test_no, len, b64len);
		failure = 1;
		goto done;
	}

	if (memcmp(buf, out, b64len) != 0) {
		fprintf(stderr, "FAIL: test %i - encoding differs:\n", test_no);
		fprintf(stderr, "  encoding: ");
		for (i = 0; i < len; i++)
			fprintf(stderr, "%c", out[i]);
		fprintf(stderr, "\n");
		fprintf(stderr, " test data: ");
		for (i = 0; i < bt->out_len; i++)
			fprintf(stderr, "%c", buf[i]);







|
|





|







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
	len = BIO_get_mem_data(bio_mem, &out);

	/* An empty string with NL results in no output, rather than '\n'. */
	if (test_nl && b64len == 1 && len == 0)
		goto done;

	if (len != b64len) {
		fprintf(stderr, "FAIL: test %d - encoding resulted in %zd "
		    "characters instead of %zd\n", test_no, len, b64len);
		failure = 1;
		goto done;
	}

	if (memcmp(buf, out, b64len) != 0) {
		fprintf(stderr, "FAIL: test %d - encoding differs:\n", test_no);
		fprintf(stderr, "  encoding: ");
		for (i = 0; i < len; i++)
			fprintf(stderr, "%c", out[i]);
		fprintf(stderr, "\n");
		fprintf(stderr, " test data: ");
		for (i = 0; i < bt->out_len; i++)
			fprintf(stderr, "%c", buf[i]);
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429

	/*
	 * If we wrote zero characters then a BIO_read will result in a return
	 * value of -1, hence we need to handle this case.
	 */
	len = BIO_read(bio_mem, buf, BUF_SIZE);
	if (len != bt->valid_len && (bt->in_len != 0 || len != -1)) {
		fprintf(stderr, "FAIL: test %i - decoding resulted in %zi "
		    "characters instead of %zi\n", test_no, len, bt->valid_len);
		fprintf(stderr, "  input: ");
		for (i = 0; i < inlen; i++)
			fprintf(stderr, "%c", input[i]);
		fprintf(stderr, "\n");
		fprintf(stderr, "  decoding: ");
		for (i = 0; i < len; i++)
			fprintf(stderr, "0x%x ", buf[i]);
		fprintf(stderr, "\n");
		failure = 1;
		goto done;
	}

	/* See if we expect this to fail decoding. */
	if (bt->in_len == -1)
		goto done;

	if (memcmp(bt->in, buf, bt->in_len) != 0) {
		fprintf(stderr, "FAIL: test %i - decoding differs:\n", test_no);
		fprintf(stderr, "  decoding: ");
		for (i = 0; i < len; i++)
			fprintf(stderr, "0x%x ", buf[i]);
		fprintf(stderr, "\n");
		fprintf(stderr, " test data: ");
		for (i = 0; i < bt->in_len; i++)
			fprintf(stderr, "0x%x ", bt->in[i]);







|
|

















|







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429

	/*
	 * If we wrote zero characters then a BIO_read will result in a return
	 * value of -1, hence we need to handle this case.
	 */
	len = BIO_read(bio_mem, buf, BUF_SIZE);
	if (len != bt->valid_len && (bt->in_len != 0 || len != -1)) {
		fprintf(stderr, "FAIL: test %d - decoding resulted in %zd "
		    "characters instead of %zd\n", test_no, len, bt->valid_len);
		fprintf(stderr, "  input: ");
		for (i = 0; i < inlen; i++)
			fprintf(stderr, "%c", input[i]);
		fprintf(stderr, "\n");
		fprintf(stderr, "  decoding: ");
		for (i = 0; i < len; i++)
			fprintf(stderr, "0x%x ", buf[i]);
		fprintf(stderr, "\n");
		failure = 1;
		goto done;
	}

	/* See if we expect this to fail decoding. */
	if (bt->in_len == -1)
		goto done;

	if (memcmp(bt->in, buf, bt->in_len) != 0) {
		fprintf(stderr, "FAIL: test %d - decoding differs:\n", test_no);
		fprintf(stderr, "  decoding: ");
		for (i = 0; i < len; i++)
			fprintf(stderr, "0x%x ", buf[i]);
		fprintf(stderr, "\n");
		fprintf(stderr, " test data: ");
		for (i = 0; i < bt->in_len; i++)
			fprintf(stderr, "0x%x ", bt->in[i]);
Changes to jni/libressl/tests/biotest.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: biotest.c,v 1.8 2022/02/19 16:00:57 jsing Exp $	*/
/*
 * Copyright (c) 2014, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: biotest.c,v 1.9 2022/09/05 21:06:31 tb Exp $	*/
/*
 * Copyright (c) 2014, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

	for (i = 0; i < N_BIO_GET_IP_TESTS; i++) {
		bgit = &bio_get_host_ip_tests[i];
		memset(&ip, 0, sizeof(ip));

		ret = BIO_get_host_ip(bgit->input, ip.c);
		if (ret != bgit->ret) {
			fprintf(stderr, "FAIL: test %zi (\"%s\") %s, want %s\n",
			    i, bgit->input, ret ? "success" : "failure",
			    bgit->ret ? "success" : "failure");
			failed = 1;
			continue;
		}
		if (ret && ntohl(ip.i) != bgit->ip) {
			fprintf(stderr, "FAIL: test %zi (\"%s\") returned ip "
			    "%x != %x\n", i, bgit->input,
			    ntohl(ip.i), bgit->ip);
			failed = 1;
		}
	}

	return failed;







|






|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

	for (i = 0; i < N_BIO_GET_IP_TESTS; i++) {
		bgit = &bio_get_host_ip_tests[i];
		memset(&ip, 0, sizeof(ip));

		ret = BIO_get_host_ip(bgit->input, ip.c);
		if (ret != bgit->ret) {
			fprintf(stderr, "FAIL: test %zd (\"%s\") %s, want %s\n",
			    i, bgit->input, ret ? "success" : "failure",
			    bgit->ret ? "success" : "failure");
			failed = 1;
			continue;
		}
		if (ret && ntohl(ip.i) != bgit->ip) {
			fprintf(stderr, "FAIL: test %zd (\"%s\") returned ip "
			    "%x != %x\n", i, bgit->input,
			    ntohl(ip.i), bgit->ip);
			failed = 1;
		}
	}

	return failed;
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

	for (i = 0; i < N_BIO_GET_PORT_TESTS; i++) {
		bgpt = &bio_get_port_tests[i];
		port = 0;

		ret = BIO_get_port(bgpt->input, &port);
		if (ret != bgpt->ret) {
			fprintf(stderr, "FAIL: test %zi (\"%s\") %s, want %s\n",
			    i, bgpt->input, ret ? "success" : "failure",
			    bgpt->ret ? "success" : "failure");
			failed = 1;
			continue;
		}
		if (ret && port != bgpt->port) {
			fprintf(stderr, "FAIL: test %zi (\"%s\") returned port "
			    "%u != %u\n", i, bgpt->input, port, bgpt->port);
			failed = 1;
		}
	}

	return failed;
}







|






|







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

	for (i = 0; i < N_BIO_GET_PORT_TESTS; i++) {
		bgpt = &bio_get_port_tests[i];
		port = 0;

		ret = BIO_get_port(bgpt->input, &port);
		if (ret != bgpt->ret) {
			fprintf(stderr, "FAIL: test %zd (\"%s\") %s, want %s\n",
			    i, bgpt->input, ret ? "success" : "failure",
			    bgpt->ret ? "success" : "failure");
			failed = 1;
			continue;
		}
		if (ret && port != bgpt->port) {
			fprintf(stderr, "FAIL: test %zd (\"%s\") returned port "
			    "%u != %u\n", i, bgpt->input, port, bgpt->port);
			failed = 1;
		}
	}

	return failed;
}
Added jni/libressl/tests/bn_isqrt.c.


























































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
/*	$OpenBSD: bn_isqrt.c,v 1.6 2022/08/12 16:13:40 tb Exp $ */
/*
 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <err.h>
#include <string.h>
#include <unistd.h>

#include <openssl/bn.h>

#include "bn_lcl.h"

#define N_TESTS		400

/* Sample squares between 2^128 and 2^4096. */
#define LOWER_BITS	128
#define UPPER_BITS	4096

extern const uint8_t is_square_mod_11[];
extern const uint8_t is_square_mod_63[];
extern const uint8_t is_square_mod_64[];
extern const uint8_t is_square_mod_65[];

static void
hexdump(const unsigned char *buf, size_t len)
{
	size_t i;

	for (i = 1; i <= len; i++)
		fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n");

	if (len % 8)
		fprintf(stderr, "\n");
}

static const uint8_t *
get_table(int modulus)
{
	switch (modulus) {
	case 11:
		return is_square_mod_11;
	case 63:
		return is_square_mod_63;
	case 64:
		return is_square_mod_64;
	case 65:
		return is_square_mod_65;
	default:
		return NULL;
	}
}

static int
check_tables(int print)
{
	int fill[] = {11, 63, 64, 65};
	const uint8_t *table;
	uint8_t q[65];
	size_t i;
	int j;
	int failed = 0;

	for (i = 0; i < sizeof(fill) / sizeof(fill[0]); i++) {
		memset(q, 0, sizeof(q));

		for (j = 0; j < fill[i]; j++)
			q[(j * j) % fill[i]] = 1;

		if ((table = get_table(fill[i])) == NULL) {
			fprintf(stderr, "failed to get table %d\n", fill[i]);
			failed |= 1;
			continue;
		}

		if (memcmp(table, q, fill[i]) != 0) {
			fprintf(stderr, "table %d does not match:\n", fill[i]);
			fprintf(stderr, "want:\n");
			hexdump(table, fill[i]);
			fprintf(stderr, "got:\n");
			hexdump(q, fill[i]);
			failed |= 1;
			continue;
		}

		if (!print)
			continue;

		printf("const uint8_t is_square_mod_%d[] = {\n\t", fill[i]);
		for (j = 0; j < fill[i]; j++) {
			const char *end = " ";

			if (j % 16 == 15)
				end = "\n\t";
			if (j + 1 == fill[i])
				end = "";

			printf("%d,%s", q[j], end);
		}
		printf("\n};\nCTASSERT(sizeof(is_square_mod_%d) == %d);\n\n",
		    fill[i], fill[i]);
	}

	return failed;
}

static int
validate_tables(void)
{
	int fill[] = {11, 63, 64, 65};
	const uint8_t *table;
	size_t i;
	int j, k;
	int failed = 0;

	for (i = 0; i < sizeof(fill) / sizeof(fill[0]); i++) {
		if ((table = get_table(fill[i])) == NULL) {
			fprintf(stderr, "failed to get table %d\n", fill[i]);
			failed |= 1;
			continue;
		}

		for (j = 0; j < fill[i]; j++) {
			for (k = 0; k < fill[i]; k++) {
				if (j == (k * k) % fill[i])
					break;
			}

			if (table[j] == 0 && k < fill[i]) {
				fprintf(stderr, "%d == %d^2 (mod %d)", j, k,
				    fill[i]);
				failed |= 1;
			}
			if (table[j] == 1 && k == fill[i]) {
				fprintf(stderr, "%d not a square (mod %d)", j,
				    fill[i]);
				failed |= 1;
			}

		}

	}

	return failed;
}

/*
 * Choose a random number n of bit length between LOWER_BITS and UPPER_BITS and
 * check that n == isqrt(n^2). Random numbers n^2 <= testcase < (n + 1)^2 are
 * checked to have isqrt(testcase) == n.
 */
static int
isqrt_test(void)
{
	BN_CTX *ctx;
	BIGNUM *n, *n_sqr, *lower, *upper, *testcase, *isqrt;
	int cmp, i, is_perfect_square;
	int failed = 0;

	if ((ctx = BN_CTX_new()) == NULL)
		errx(1, "BN_CTX_new");

	BN_CTX_start(ctx);

	if ((lower = BN_CTX_get(ctx)) == NULL)
		errx(1, "lower = BN_CTX_get(ctx)");
	if ((upper = BN_CTX_get(ctx)) == NULL)
		errx(1, "upper = BN_CTX_get(ctx)");
	if ((n = BN_CTX_get(ctx)) == NULL)
		errx(1, "n = BN_CTX_get(ctx)");
	if ((n_sqr = BN_CTX_get(ctx)) == NULL)
		errx(1, "n = BN_CTX_get(ctx)");
	if ((isqrt = BN_CTX_get(ctx)) == NULL)
		errx(1, "result = BN_CTX_get(ctx)");
	if ((testcase = BN_CTX_get(ctx)) == NULL)
		errx(1, "testcase = BN_CTX_get(ctx)");

	/* lower = 2^LOWER_BITS, upper = 2^UPPER_BITS. */
	if (!BN_set_bit(lower, LOWER_BITS))
		errx(1, "BN_set_bit(lower, %d)", LOWER_BITS);
	if (!BN_set_bit(upper, UPPER_BITS))
		errx(1, "BN_set_bit(upper, %d)", UPPER_BITS);

	if (!bn_rand_interval(n, lower, upper))
		errx(1, "bn_rand_interval n");

	/* n_sqr = n^2 */
	if (!BN_sqr(n_sqr, n, ctx))
		errx(1, "BN_sqr");

	if (!bn_isqrt(isqrt, &is_perfect_square, n_sqr, ctx))
		errx(1, "bn_isqrt n_sqr");

	if ((cmp = BN_cmp(n, isqrt)) != 0 || !is_perfect_square) {
		fprintf(stderr, "n = ");
		BN_print_fp(stderr, n);
		fprintf(stderr, "\nn^2 is_perfect_square: %d, cmp: %d\n",
		    is_perfect_square, cmp);
		failed = 1;
	}

	/* upper = 2 * n + 1 */
	if (!BN_lshift1(upper, n))
		errx(1, "BN_lshift1(upper, n)");
	if (!BN_add_word(upper, 1))
		errx(1, "BN_sub_word(upper, 1)");

	/* upper = (n + 1)^2 = n^2 + upper */
	if (!BN_add(upper, n_sqr, upper))
		errx(1, "BN_add");

	/*
	 * Check that isqrt((n + 1)^2) - 1 == n.
	 */

	if (!bn_isqrt(isqrt, &is_perfect_square, upper, ctx))
		errx(1, "bn_isqrt(upper)");

	if (!BN_sub_word(isqrt, 1))
		errx(1, "BN_add_word(isqrt, 1)");

	if ((cmp = BN_cmp(n, isqrt)) != 0 || !is_perfect_square) {
		fprintf(stderr, "n = ");
		BN_print_fp(stderr, n);
		fprintf(stderr, "\n(n + 1)^2 is_perfect_square: %d, cmp: %d\n",
		    is_perfect_square, cmp);
		failed = 1;
	}

	/*
	 * Test N_TESTS random numbers n^2 <= testcase < (n + 1)^2 and check
	 * that their isqrt is n.
	 */

	for (i = 0; i < N_TESTS; i++) {
		if (!bn_rand_interval(testcase, n_sqr, upper))
			errx(1, "bn_rand_interval testcase");

		if (!bn_isqrt(isqrt, &is_perfect_square, testcase, ctx))
			errx(1, "bn_isqrt testcase");

		if ((cmp = BN_cmp(n, isqrt)) != 0 || is_perfect_square) {
			fprintf(stderr, "n = ");
			BN_print_fp(stderr, n);
			fprintf(stderr, "\ntestcase = ");
			BN_print_fp(stderr, testcase);
			fprintf(stderr,
			    "\ntestcase is_perfect_square: %d, cmp: %d\n",
			    is_perfect_square, cmp);
			failed = 1;
		}
	}

	/*
	 * Finally check that isqrt(n^2 - 1) + 1 == n.
	 */

	if (!BN_sub(testcase, n_sqr, BN_value_one()))
		errx(1, "BN_sub(testcase, n_sqr, 1)");

	if (!bn_isqrt(isqrt, &is_perfect_square, testcase, ctx))
		errx(1, "bn_isqrt(n_sqr - 1)");

	if (!BN_add_word(isqrt, 1))
		errx(1, "BN_add_word(isqrt, 1)");

	if ((cmp = BN_cmp(n, isqrt)) != 0 || is_perfect_square) {
		fprintf(stderr, "n = ");
		BN_print_fp(stderr, n);
		fprintf(stderr, "\nn_sqr - 1 is_perfect_square: %d, cmp: %d\n",
		    is_perfect_square, cmp);
		failed = 1;
	}

	BN_CTX_end(ctx);
	BN_CTX_free(ctx);

	return failed;
}

static void
usage(void)
{
	fprintf(stderr, "usage: bn_isqrt [-C]\n");
	exit(1);
}

int
main(int argc, char *argv[])
{
	size_t i;
	int ch;
	int failed = 0, print = 0;

#ifndef _MSC_VER
	while ((ch = getopt(argc, argv, "C")) != -1) {
		switch (ch) {
		case 'C':
			print = 1;
			break;
		default:
			usage();
			break;
		}
	}
#endif

	if (print)
		return check_tables(1);

	for (i = 0; i < N_TESTS; i++)
		failed |= isqrt_test();

	failed |= check_tables(0);
	failed |= validate_tables();

	if (!failed)
		printf("SUCCESS\n");

	return failed;
}
Added jni/libressl/tests/bn_primes.c.




















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*	$OpenBSD: bn_primes.c,v 1.1 2022/06/18 19:53:19 tb Exp $ */
/*
 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/bn.h>

#include "bn_prime.h"

static int
test_bn_is_prime_fasttest(int do_trial_division)
{
	BIGNUM *n = NULL;
	char *descr = NULL;
	prime_t i, j, max;
	int is_prime, ret;
	int failed = 1;

	if (asprintf(&descr, "with%s trial divisions",
	    do_trial_division ? "" : "out") == -1) {
		descr = NULL;
		fprintf(stderr, "asprintf failed\n");
		goto err;
	}

	if ((n = BN_new()) == NULL) {
		fprintf(stderr, "BN_new failed\n");
		goto err;
	}

	max = primes[NUMPRIMES - 1] + 1;

	failed = 0;
	for (i = 1, j = 0; i < max && j < NUMPRIMES; i++) {
		if (!BN_set_word(n, i)) {
			fprintf(stderr, "BN_set_word(%d) failed", i);
			failed = 1;
			goto err;
		}

		is_prime = i == primes[j];
		if (is_prime)
			j++;

		ret = BN_is_prime_fasttest_ex(n, BN_prime_checks, NULL,
		    do_trial_division, NULL);
		if (ret != is_prime) {
			fprintf(stderr,
			    "BN_is_prime_fasttest_ex(%d) %s: want %d, got %d\n",
			    i, descr, is_prime, ret);
			failed = 1;
		}
	}

	if (i < max || j < NUMPRIMES) {
		fprintf(stderr, "%s: %d < %d or %d < %d\n", descr, i, max, j,
		    NUMPRIMES);
		failed = 1;
	}

 err:
	BN_free(n);
	free(descr);
	return failed;
}

int
main(void)
{
	int failed = 0;

	failed |= test_bn_is_prime_fasttest(0);
	failed |= test_bn_is_prime_fasttest(1);

	printf("%s\n", failed ? "FAILED" : "SUCCESS");

	return failed;
}
Changes to jni/libressl/tests/bn_rand_interval.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: bn_rand_interval.c,v 1.4 2021/04/06 16:40:34 tb Exp $	*/
/*
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: bn_rand_interval.c,v 1.5 2022/06/19 17:10:02 tb Exp $	*/
/*
 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

			printf("bn_rand_interval(x, b, a) succeeded\n");
			print_triple(a, b, x);
		}
	}

	if (success == 1)
		printf("success\n");
	else
		printf("FAIL");

	BN_free(a);
	BN_free(b);
	BN_free(x);

	return 1 - success;
}







|









101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

			printf("bn_rand_interval(x, b, a) succeeded\n");
			print_triple(a, b, x);
		}
	}

	if (success == 1)
		printf("SUCCESS\n");
	else
		printf("FAIL");

	BN_free(a);
	BN_free(b);
	BN_free(x);

	return 1 - success;
}
Changes to jni/libressl/tests/bntest.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: bntest.c,v 1.24 2021/12/29 23:00:32 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: bntest.c,v 1.25 2022/09/05 21:06:31 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
					}
				}
#endif
			}
		}
	}
	if (s == 0) {
		fprintf(stderr, "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n", num0);
		fprintf(stderr, "this is very unlikely and probably indicates an error.\n");
		goto err;
	}
	rc = 1;
 err:
	BN_free(a);
	BN_free(b[0]);







|







2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
					}
				}
#endif
			}
		}
	}
	if (s == 0) {
		fprintf(stderr, "All %d tests of GF(2^m) modular solve quadratic resulted in no roots;\n", num0);
		fprintf(stderr, "this is very unlikely and probably indicates an error.\n");
		goto err;
	}
	rc = 1;
 err:
	BN_free(a);
	BN_free(b[0]);
Changes to jni/libressl/tests/buffertest.c.

1
2
3
4
5
6
7
8
9

/*
 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
>

|







1
2
3
4
5
6
7
8
9
10
/* $OpenBSD: buffertest.c,v 1.6 2022/07/22 19:34:55 jsing Exp $ */
/*
 * Copyright (c) 2019, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

struct extend_test {
	size_t extend_len;
	size_t read_len;
	ssize_t want_ret;
};

struct extend_test extend_tests[] = {
	{
		.extend_len = 4,
		.read_len = 0,
		.want_ret = TLS_IO_WANT_POLLIN,
	},
	{
		.extend_len = 4,







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

struct extend_test {
	size_t extend_len;
	size_t read_len;
	ssize_t want_ret;
};

const struct extend_test extend_tests[] = {
	{
		.extend_len = 4,
		.read_len = 0,
		.want_ret = TLS_IO_WANT_POLLIN,
	},
	{
		.extend_len = 4,
95
96
97
98
99
100
101
102
103
104

105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130



131

132
133
134
135
136
137
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152


153

154


155
156
157


































































































































































































158
		.read_len = 1,
		.want_ret = TLS_IO_EOF,
	},
};

#define N_EXTEND_TESTS (sizeof(extend_tests) / sizeof(extend_tests[0]))

int
main(int argc, char **argv)
{

	struct tls_buffer *buf;
	struct extend_test *et;
	struct read_state rs;
	uint8_t *data;
	size_t i, data_len;
	ssize_t ret;
	CBS cbs;


	rs.buf = testdata;
	rs.offset = 0;

	if ((buf = tls_buffer_new(0)) == NULL)
		errx(1, "tls_buffer_new");

	for (i = 0; i < N_EXTEND_TESTS; i++) {
		et = &extend_tests[i];
		rs.len = et->read_len;

		ret = tls_buffer_extend(buf, et->extend_len, read_cb, &rs);
		if (ret != extend_tests[i].want_ret) {
			fprintf(stderr, "FAIL: Test %zi - extend returned %zi, "
			    "want %zi\n", i, ret, et->want_ret);
			return 1;
		}

		tls_buffer_cbs(buf, &cbs);





		if (!CBS_mem_equal(&cbs, testdata, CBS_len(&cbs))) {
			fprintf(stderr, "FAIL: Test %zi - extend buffer "
			    "mismatch", i);
			return 1;
		}
	}

	if (!tls_buffer_finish(buf, &data, &data_len)) {
		fprintf(stderr, "FAIL: failed to finish\n");
		return 1;
	}

	tls_buffer_free(buf);


	if (data_len != sizeof(testdata)) {
		fprintf(stderr, "FAIL: got data length %zu, want %zu\n",
		    data_len, sizeof(testdata));
		return 1;
	}
	if (memcmp(data, testdata, data_len) != 0) {
		fprintf(stderr, "FAIL: data mismatch\n");


		return 1;

	}


	free(data);

	return 0;


































































































































































































}







|
|

>

<

|



>













|
|
|


|
>
>
>
|
>

|

|





|



>




|



>
>
|
>
|
>
>


|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

96
97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
		.read_len = 1,
		.want_ret = TLS_IO_EOF,
	},
};

#define N_EXTEND_TESTS (sizeof(extend_tests) / sizeof(extend_tests[0]))

static int
tls_buffer_extend_test(void)
{
	const struct extend_test *et;
	struct tls_buffer *buf;

	struct read_state rs;
	uint8_t *data = NULL;
	size_t i, data_len;
	ssize_t ret;
	CBS cbs;
	int failed = 1;

	rs.buf = testdata;
	rs.offset = 0;

	if ((buf = tls_buffer_new(0)) == NULL)
		errx(1, "tls_buffer_new");

	for (i = 0; i < N_EXTEND_TESTS; i++) {
		et = &extend_tests[i];
		rs.len = et->read_len;

		ret = tls_buffer_extend(buf, et->extend_len, read_cb, &rs);
		if (ret != extend_tests[i].want_ret) {
			fprintf(stderr, "FAIL: Test %zd - extend returned %zd, "
			    "want %zd\n", i, ret, et->want_ret);
			goto failed;
		}

		if (!tls_buffer_data(buf, &cbs)) {
			fprintf(stderr, "FAIL: Test %zd - failed to get data\n",
			    i);
			goto failed;
		}

		if (!CBS_mem_equal(&cbs, testdata, CBS_len(&cbs))) {
			fprintf(stderr, "FAIL: Test %zd - extend buffer "
			    "mismatch", i);
			goto failed;
		}
	}

	if (!tls_buffer_finish(buf, &data, &data_len)) {
		fprintf(stderr, "FAIL: failed to finish\n");
		goto failed;
	}

	tls_buffer_free(buf);
	buf = NULL;

	if (data_len != sizeof(testdata)) {
		fprintf(stderr, "FAIL: got data length %zu, want %zu\n",
		    data_len, sizeof(testdata));
		goto failed;
	}
	if (memcmp(data, testdata, data_len) != 0) {
		fprintf(stderr, "FAIL: data mismatch\n");
		goto failed;
	}

	failed = 0;

 failed:
	tls_buffer_free(buf);
	free(data);

	return failed;
}

struct read_write_test {
	uint8_t pattern;
	size_t read;
	size_t write;
	size_t append;
	ssize_t want;
};

const struct read_write_test read_write_tests[] = {
	{
		.read = 2048,
		.want = TLS_IO_WANT_POLLIN,
	},
	{
		.pattern = 0xdb,
		.write = 2048,
		.want = 2048,
	},
	{
		.pattern = 0xbd,
		.append = 2048,
		.want = 1,
	},
	{
		.pattern = 0xdb,
		.read = 2048,
		.want = 2048,
	},
	{
		.pattern = 0xfe,
		.append = 1024,
		.want = 1,
	},
	{
		.pattern = 0xbd,
		.read = 1000,
		.want = 1000,
	},
	{
		.pattern = 0xbd,
		.read = 1048,
		.want = 1048,
	},
	{
		.pattern = 0xdb,
		.write = 2048,
		.want = 2048,
	},
	{
		.pattern = 0xbd,
		.append = 1024,
		.want = 1,
	},
	{
		.pattern = 0xee,
		.append = 4096,
		.want = 1,
	},
	{
		.pattern = 0xfe,
		.append = 1,
		.want = 0,
	},
	{
		.pattern = 0xfe,
		.write = 1,
		.want = TLS_IO_FAILURE,
	},
	{
		.pattern = 0xfe,
		.read = 1024,
		.want = 1024,
	},
	{
		.pattern = 0xdb,
		.read = 2048,
		.want = 2048,
	},
	{
		.pattern = 0xbd,
		.read = 1024,
		.want = 1024,
	},
	{
		.pattern = 0xee,
		.read = 1024,
		.want = 1024,
	},
	{
		.pattern = 0xee,
		.read = 4096,
		.want = 3072,
	},
	{
		.read = 2048,
		.want = TLS_IO_WANT_POLLIN,
	},
};

#define N_READ_WRITE_TESTS (sizeof(read_write_tests) / sizeof(read_write_tests[0]))

static int
tls_buffer_read_write_test(void)
{
	const struct read_write_test *rwt;
	struct tls_buffer *buf = NULL;
	uint8_t *rbuf = NULL, *wbuf = NULL;
	ssize_t n;
	size_t i;
	int ret;
	int failed = 1;

	if ((buf = tls_buffer_new(0)) == NULL)
		errx(1, "tls_buffer_new");

	tls_buffer_set_capacity_limit(buf, 8192);

	for (i = 0; i < N_READ_WRITE_TESTS; i++) {
		rwt = &read_write_tests[i];

		if (rwt->append > 0) {
			free(wbuf);
			if ((wbuf = malloc(rwt->append)) == NULL)
				errx(1, "malloc");
			memset(wbuf, rwt->pattern, rwt->append);
			if ((ret = tls_buffer_append(buf, wbuf, rwt->append)) !=
			    rwt->want) {
				fprintf(stderr, "FAIL: test %zu - "
				    "tls_buffer_append() = %d, want %zu\n",
				    i, ret, rwt->want);
				goto failed;
			}
		}

		if (rwt->write > 0) {
			free(wbuf);
			if ((wbuf = malloc(rwt->write)) == NULL)
				errx(1, "malloc");
			memset(wbuf, rwt->pattern, rwt->write);
			if ((n = tls_buffer_write(buf, wbuf, rwt->write)) !=
			    rwt->want) {
				fprintf(stderr, "FAIL: test %zu - "
				    "tls_buffer_write() = %zi, want %zu\n",
				    i, n, rwt->want);
				goto failed;
			}
		}

		if (rwt->read > 0) {
			free(rbuf);
			if ((rbuf = calloc(1, rwt->read)) == NULL)
				errx(1, "malloc");
			if ((n = tls_buffer_read(buf, rbuf, rwt->read)) !=
			    rwt->want) {
				fprintf(stderr, "FAIL: test %zu - "
				    "tls_buffer_read() = %zi, want %zu\n",
				    i, n, rwt->want);
				goto failed;
			}
			if (rwt->want > 0) {
				free(wbuf);
				if ((wbuf = malloc(rwt->want)) == NULL)
					errx(1, "malloc");
				memset(wbuf, rwt->pattern, rwt->want);
				if (memcmp(rbuf, wbuf, rwt->want) != 0) {
					fprintf(stderr, "FAIL: test %zu - "
					    "read byte mismatch\n", i);
					goto failed;
				}
			}
		}
	}

	failed = 0;

 failed:
	tls_buffer_free(buf);
	free(rbuf);
	free(wbuf);

	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= tls_buffer_extend_test();
	failed |= tls_buffer_read_write_test();

	return failed;
}
Added jni/libressl/tests/ca-int-ecdsa.crl.
















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
-----BEGIN X509 CRL-----
MIHuMIGUMAoGCCqGSM49BAMCMC4xLDAqBgNVBAMMI0xpYnJlU1NMIFRlc3QgSW50
ZXJtZWRpYXRlIENBIEVDRFNBFw0yMTEyMjcxNDQwNDBaFw0yMjAxMjYxNDQwNDBa
MDgwGgIJAOVssaaTYoH5Fw0yMTEyMjcxNDQwNDBaMBoCCQDlbLGmk2KB+xcNMjEx
MjI3MTQ0MDQwWjAKBggqhkjOPQQDAgNJADBGAiEA9FWkenCgh+6Rz0/nuS7DaiUR
J5imCs0Wx6TiG3YUL3oCIQDfTT+54eKAEFXeYN2oToZtHbTHh5YUici5GA/PDmOG
Ig==
-----END X509 CRL-----
Added jni/libressl/tests/ca-int-ecdsa.pem.


























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
subject= CN = LibreSSL Test Intermediate CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrDCCAVOgAwIBAgIJAOVssaaTYoH3MAkGByqGSM49BAEwJjEkMCIGA1UEAwwb
TGlicmVTU0wgVGVzdCBSb290IENBIEVDRFNBMB4XDTIxMTIyNzE0NDA0MFoXDTMx
MTIyNTE0NDA0MFowLjEsMCoGA1UEAwwjTGlicmVTU0wgVGVzdCBJbnRlcm1lZGlh
dGUgQ0EgRUNEU0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATWRQbJh4aHPzHq
LOAmosW/o83bTpm3Sj1VxM44StmG7c1nnFM/+gS8rp2bVSgjWZQzRtZqGVGJgzbk
7/M1m3x3o2MwYTAdBgNVHQ4EFgQUF1Y9b/xKVxI5QsoCcoGrUA3kwggwHwYDVR0j
BBgwFoAUtvkat4UdcUEipt6L/PBgEFYH6AwwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwCQYHKoZIzj0EAQNIADBFAiBE4NiOdv/XRN3WWMnkE5QccvC6
VThoIQRyBf4I97cRPQIhAK18dvwrLuOOfbhWMdkpNCddMkWZHxS7traw/8+s7OUU
-----END CERTIFICATE-----
Added jni/libressl/tests/ca-int-rsa.crl.






















>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
-----BEGIN X509 CRL-----
MIIBrDCBlTANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0
IEludGVybWVkaWF0ZSBDQSBSU0EXDTIxMTIyNzE0NDAzOFoXDTIyMDEyNjE0NDAz
OFowODAaAgkA5WyxppNigfQXDTIxMTIyNzE0NDAzN1owGgIJAOVssaaTYoH2Fw0y
MTEyMjcxNDQwMzhaMA0GCSqGSIb3DQEBCwUAA4IBAQCGMtlhTlaOK7fK2OHXgoAf
lDr1FQfqfNo5ZNE2+VqOvjYfgwdOgfxIsIuUoNp9/NhzO3e4KNe6P/33axwIsy7o
RofbGYFSlHIYPEf1LyvH8z5mT2L2LAQAi+p+QMFizH6KNc74Oftygyi1bcJlN3CJ
dP9LyvACdJSna7dEh7Snu2hy8tEDAO/RxUrryOZca0+5I4aaD8QCdFwdicDQ8U1s
gTJ5w1gxkEWKv/J/AjCjRAVoAjE2/sUC1PPOJnZy7b0sS2Fv7zV7UAWSzO0KEYv+
vav3UekGIgw0A5PDdWmUqCxE7aK71iy4EmlzMyVNULVcF1qX6qBQT5OpXr0Eo6WR
-----END X509 CRL-----
Added jni/libressl/tests/ca-int-rsa.pem.












































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
subject= CN = LibreSSL Test Intermediate CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIJAOVssaaTYoHyMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0IEludGVybWVk
aWF0ZSBDQSBSU0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD151AI
I+W9MrEP3dO0PEjg6L9E1R6+CG6u0LT3Jobc/rG2RXqKLasEaXoBWYiJoTImVxFT
wtrY+IDDTaEV4/4RGII1fY8Js7v5NpwoEh15jCoJ6/qDjKd4y1s1M48PlWYNNRmv
OBKRIu3Fz7scUa1RSBCp1bZeHbq/V5SzG419nDq2xpyuUrwmfBhDZTH+kUwBNGn8
XVRFCRJQVP3qEAH02Zai2emSVj13KrhEWMtNyA8fa34GIuV23Q40RKW3jUgGBF+D
5jPNN8EZCj34nvvbjCCBs7cxZvD4F/MzGbatKpNmNOKXKibeg/xCq8B/F1uzHcl3
IzJuViNtQ3RjQ/1pAgMBAAGjYzBhMB0GA1UdDgQWBBQ2oaFa//6a3ZNBNV0NlN3n
A9jiZjAfBgNVHSMEGDAWgBQ+S/x79Kw0KqURKAHyiOhdj/8V0TAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAcok2oSct
BOkm75qA8+4eUilGxTaqFPCqY8fk8MKNRKNNzaqirPaLJW62mZaxRHOn1Bw9uzL3
jgz2PaTwA7n5GpKs3r5JLk8BdtRyeqMLmqJVJKKuu4GtJLCA8jhQm+XNA1Z324hg
kVeBHLPpLKvQxb+0lmbRBORq/OtMirq2yK8OlF2USrfQx0jmhSvvLpWyA0hhAXRS
gg1ds9aL57dELvk6gR7Unob+J0O2Xq3FRwz2O1k9fF86a0qrWUkxcnAjobC2BczC
7Fe5B194LgrX2U4IIrzwgJ19kmtrb1Qol2okECxomTYsbQY36sBs+LOKxSuiagu6
ZgJtfcNeVMglYQ==
-----END CERTIFICATE-----
Added jni/libressl/tests/ca-root-ecdsa.pem.


























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
subject= CN = LibreSSL Test Root CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBpjCCAUygAwIBAgIJALqTupYRbYuwMAoGCCqGSM49BAMCMCYxJDAiBgNVBAMM
G0xpYnJlU1NMIFRlc3QgUm9vdCBDQSBFQ0RTQTAeFw0yMTEyMjcxNDQwNDBaFw0z
MTEyMjUxNDQwNDBaMCYxJDAiBgNVBAMMG0xpYnJlU1NMIFRlc3QgUm9vdCBDQSBF
Q0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIxQjA3Gp+4irgwEumPY1/EG
lVy6/olnAc+4elWkj0SqqdjfWanQqO8wHFY0qICKq8lHKhcyw2v9oyOsNVXZj8Kj
YzBhMB0GA1UdDgQWBBS2+Rq3hR1xQSKm3ov88GAQVgfoDDAfBgNVHSMEGDAWgBS2
+Rq3hR1xQSKm3ov88GAQVgfoDDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE
AwIBBjAKBggqhkjOPQQDAgNIADBFAiAqAN8RFQOAIXeJcxCHUCN1n3sUBuYF/XkS
VnTsAEU/kwIhANNk/xjGq9O2YeLEFT1InoltVlwM5P8oa7krPnPbFnwY
-----END CERTIFICATE-----
Added jni/libressl/tests/ca-root-rsa.pem.












































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
subject= CN = LibreSSL Test Root CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDLjCCAhagAwIBAgIJAIuM+uV8F+LtMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAkMSIwIAYDVQQDDBlMaWJyZVNTTCBUZXN0IFJvb3QgQ0Eg
UlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnvrj8h5JmJ+7V33R
wloqhM0nLvmidkmk1sqJaOi0GNXoMLnaut90+2TnRiFDbsblzAjTijQC6PEfaJTB
AEFBgNSQKdhVruYTL5HHhw/XHTjxqftizvJj1FsZh2n6gkTG/QOgbaDMCx+yFF88
wro7Br32TZF+BuDuyzVcSPJUajYT+C9bWSq9jX8Fhvl5M3IOG7olg3gAMmU+E8SY
TaKhoJ7KGLHDEQP9NJknJusV8T72lY/TzacVDDOxEUxpuYtJ1Kayytflhs1065Ua
PkiIReoFnhK/tRAgyxz3bc6HDDmTz4FpyGPcAsSRtEbn1n1417hzH4Neq5eioVmx
hX1HTwIDAQABo2MwYTAdBgNVHQ4EFgQUPkv8e/SsNCqlESgB8ojoXY//FdEwHwYD
VR0jBBgwFoAUPkv8e/SsNCqlESgB8ojoXY//FdEwDwYDVR0TAQH/BAUwAwEB/zAO
BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggEBAEYi6O+l7SS14myiZydm
eP0hS8+ABWz/xqzu81W5Uxo7XD3sNfz5hkhA3S2FrBg5xpDScAzsM9Og6VRuQA7/
StWLc2gLvLI6cZNdOCOH/O4K6IYRGR0kXG7WA4MpBiDrPXZKXI3WcUNyTHM36Un4
ZATRkO+xMLKFpnxHCkY5U9kp8xX5boNxtQsGkWfuG+fm7GVBaQapnvN+WRY4QXKQ
jF10CFUcIUNGG81XTEhQwpcP0b0ruZK6JBah4VG7lUHbJ6/WoYiGYXCToK09ohIX
PuWiVTiT9LH90U58No3NfinQPbE55mJju+YNNqLU4Wk3ub5rYpp0WFmo6T9kXL/z
fO8=
-----END CERTIFICATE-----
Added jni/libressl/tests/chacha20_poly1305_tests.txt.
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# Test vector from RFC 8439 Section 2.8.1.

KEY: 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
NONCE: 070000004041424344454647
IN: "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."
AD: 50515253c0c1c2c3c4c5c6c7
CT: d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e8ca9671282fafb69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c9803aee328091b58fab324e4fad675945585808b4831d7bc3ff4def08e4b7a9de576d26586cec64b6116
TAG: 1ae10b594f09e26a7e902ecbd0600691

# Test padding AD with 15 zeros in the tag calculation.
KEY: 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
NONCE: 070000004041424344454647
IN: "123456789abcdef0"
AD: "1"
CT: ae49da6934cb77822c83ed9852e46c9e
TAG: dac9c841c168379dcf8f2bb8e22d6da2

# Test padding IN with 15 zeros in the tag calculation.
KEY: 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
NONCE: 070000004041424344454647
IN: "1"
AD: "123456789abcdef0"
CT: ae
TAG: 3ed2f824f901a8994052f852127c196a

# Test padding AD with 1 zero in the tag calculation.
KEY: 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
NONCE: 070000004041424344454647
IN: "123456789abcdef0"
AD: "123456789abcdef"
CT: ae49da6934cb77822c83ed9852e46c9e
TAG: 2e9c9b1689adb5ec444002eb920efb66

# Test padding IN with 1 zero in the tag calculation.
KEY: 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
NONCE: 070000004041424344454647
IN: "123456789abcdef"
AD: "123456789abcdef0"
CT: ae49da6934cb77822c83ed9852e46c
TAG: 05b2937f8bbc64fed21f0fb74cd7147c

# Test maximal nonce value.
KEY: 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
NONCE: ffffffffffffffffffffffff
IN: "123456789abcdef0"
AD: "123456789abcdef0"
CT: e275aeb341e1fc9a70c4fd4496fc7cdb
TAG: 41acd0560ea6843d3e5d4e5babf6e946

KEY: 9a97f65b9b4c721b960a672145fca8d4e32e67f9111ea979ce9c4826806aeee6
NONCE: 000000003de9c0da2bd7f91e
IN: ""
AD: ""
CT: ""
TAG: 5a6e21f4ba6dbee57380e79e79c30def

KEY: bcb2639bf989c6251b29bf38d39a9bdce7c55f4b2ac12a39c8a37b5d0a5cc2b5
NONCE: 000000001e8b4c510f5ca083
IN: 8c8419bc27
AD: 34ab88c265
CT: 1a7c2f33f5
TAG: 2a63876a887f4f080c9df418813fc1fd

KEY: 4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd1100a1007
NONCE: 00000000cd7cf67be39c794a
IN: 86d09974840bded2a5ca
AD: 87e229d4500845a079c0
CT: e3e446f7ede9a19b62a4
TAG: 356d9eda66d08016b853d87c08b5c1b3

KEY: 422a5355b56dcf2b436aa8152858106a88d9ba23cdfe087b5e74e817a52388b3
NONCE: 000000001d12d6d91848f2ea
IN: 537a645387f22d6f6dbbea568d3feb
AD: bef267c99aec8af56bc238612bfea6
CT: 281a366705c5a24b94e56146681e44
TAG: 59143dab187449060a3ec2a1681613cc

KEY: ec7b864a078c3d05d970b6ea3ba6d33d6bb73dfa64c622a4727a96ede876f685
NONCE: 000000002bca0e59e39508d3
IN: b76733895c871edd728a45ed1a21f15a9597d49d
AD: cc1243ea54272db602fb0853c8e7027c56338b6c
CT: 1fb9b2958fce47a5cada9d895fbb0c00d3569858
TAG: 219b4252deb16a43b292165aabc5d5ce

KEY: 2c4c0fdb611df2d4d5e7898c6af0022795364adb8749155e2c68776a090e7d5c
NONCE: 0000000013ce7382734c4a71
IN: 0dc6ff21a346e1337dd0db81d8f7d9f6fd1864418b98aadcdb
AD: 0115edcb176ab8bfa947d1f7c3a86a845d310bf6706c59a8f9
CT: dad65e4244a1a17ce59d88b00af4f7434bd7830ffdd4c5558f
TAG: 7ae32f186cf9ec59b41b764b34307d4f

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a84138648a5919a

KEY: a8b9766f404dea8cf7d7dfaf5822f53df9ccd092e332a57f007b301b507d5e14
NONCE: 00000000c7f2f7a233104a2d
IN: 4d6faeaee39179a7c892faae3719656cc614c7e6ecd8fcb570a3b82c4dace969090338
AD: c6d83b6a56408a356e68d0494d4eff150530b09551d008373d6dee2b8d6b5619d67fdb
CT: a15443f083316eef627a371f4c9ac654d0dd75255d8a303125e9f51af4233ff4ceb7fe
TAG: 63c2b4e0973096299488b0a66ffa54c1

KEY: 5e8d0e5f1467f7a750c55144d0c670f7d91075f386795b230c9bf1c04ba250bc
NONCE: 0000000088049f44ba61b88f
IN: 51a1eebcc348e0582196a0bce16ed1f8ac2e91c3e8a690e04a9f4b5cf63313d7ad08d1efbff85c89
AD: 5d09bf0be90026f9fc51f73418d6d864b6d197ea030b3de072bd2c2f5cab5860a342abbd29dba9dc
CT: 35aa4bd4537aa611fd7578fc227df50ebcb00c692a1cf6f02e50ed9270bd93af3bc68f4c75b96638
TAG: 4461139c4055333106cf7f7556fd4171

KEY: 21a9f07ec891d488805e9b92bb1b2286f3f0410c323b07fee1dc6f7379e22e48
NONCE: 00000000066215be6567377a
IN: c1b0affaf2b8d7ef51cca9aacf7969f92f928c2e3cc7db2e15f47ee1f65023910d09f209d007b7436ee898133d
AD: dfdfdf4d3a68b47ad0d48828dc17b2585da9c81c3a8d71d826b5fa8020fee002397e91fc9658e9d61d728b93eb
CT: 8ff4ceb600e7d45696d02467f8e30df0d33864a040a41ffb9e4c2da09b92e88b6f6b850e9f7258d827b9aaf346
TAG: b2ad07b86aca1b3ab34033c12d6a08cc

KEY: 54c93db9aa0e00d10b45041c7a7e41ee9f90ab78ae4c1bba18d673c3b370abde
NONCE: 000000003f2d44e7b352360f
IN: 1241e7d6fbe5eef5d8af9c2fb8b516e0f1dd49aa4ebe5491205194fe5aea3704efaf30d392f44cc99e0925b84460d4873344
AD: f1d1b08dd6fe96c46578c1d1ad38881840b10cb5eae41e5f05fe5287223fa72242aea48cb374a80be937b541f9381efa66bb
CT: 027b86865b80b4c4da823a7d3dbcf5845bf57d58ee334eb357e82369cc628979e2947830d9d4817efd3d0bc4779f0b388943
TAG: 6de01091d749f189c4e25aa315b31495

KEY: 808e0e73e9bcd274d4c6f65df2fe957822a602f039d4752616ba29a28926ef4a
NONCE: 000000001b9cd73d2fc3cb8e
IN: 3436c7b5be2394af7e88320c82326a6db37887ff9de41961c7d654dd22dd1f7d40444d48f5c663b86ff41f3e15b5c8ca1337f97635858f
AD: d57cfbe5f2538044282e53b2f0bb4e86ea2233041fb36adb8338ded092148f8c2e894ef8766a7ec2dd02c6ac5dbab0c3703c5e9119e37c
CT: 9b950b3caf7d25eaf5fca6fa3fe12ed077d80dcd5579851233c766bb8bb613ec91d925a939bb52fb88d5eda803cfe2a8cda2e055b962fd
TAG: 0887ec7d5e1a4e532746ec247a30825a

KEY: 4adfe1a26c5636536cd7cb72aa5bded0b1aa64487ad0e4078f311e8782768e97
NONCE: 00000000d69e54badec11560
IN: 19b3f9411ce875fcb684cbdc07938c4c1347e164f9640d37b22f975b4b9a373c4302ae0e7dfdeba1e0d00ced446e338f4c5bc01b4becef5115825276
AD: bda1b0f6c2f4eb8121dcbd2eebd91a03ae1d6e0523b9b6f34b6f16ceca0d086654fb0552bfd5c8e1887730e1449ea02d7f647ae835bc2dab4bbc65b9
CT: ea765a829d961e08bacaed801237ef4067df38ad3737b7c6de4db587a102a86fc4abbaabea0ee97c95ca7f571c7bab6f38cbae60cd6e6a4ce3c7a320
TAG: a27f18846f5a4f7fcc724656c91cf4f3

KEY: eb3db86c14b7cc2e494345d0dfb4841bbd3aa1e2bc640cca0c6c405520685639
NONCE: 0000000088b54b28d6da8c81
IN: f75c0a357271430b1ecff07a307b6c29325c6e66935046704a19845e629f87a9e3b8aa6c1df55dd426a487d533bb333e46f0d3418464ac1bef059231f8e87e6284
AD: 34b08bb0df821c573dcb56f5b8b4a9920465067f3b5bf3e3254ea1da1a7fc9847fd38bdfe6b30927945263a91fa288c7cf1bee0fddb0fadf5948c5d83eb4623575
CT: 146ec84f5dc1c9fe9de3307a9182dbaa75965bf85f5e64563e68d039a5b659aa8863b89228edb93ff3d8c3323ab0d03300476aa4aca206d4626a6b269b2078912d
TAG: 854cbb42bade86a09597482c8604681a

KEY: dd5b49b5953e04d926d664da3b65ebcffbbf06abbe93a3819dfc1abbecbaab13
NONCE: 00000000c5c8009459b9e31a
IN: f21f6706a4dc33a361362c214defd56d353bcb29811e5819ab3c5c2c13950c7aa0000b9d1fe69bb46454514dcce88a4a5eda097c281b81e51d6a4dba47c80326ba6cea8e2bab
AD: fe6f4cbb00794adea59e9de8b03c7fdf482e46f6c47a35f96997669c735ed5e729a49416b42468777e6a8d7aa173c18b8177418ded600124a98cbb65489f9c24a04f1e7127ce
CT: 911ead61b2aa81d00c5eff53aeea3ab713709ed571765890d558fb59d3993b45f598a39e5eff4be844c4d4bd1ef9622e60412b21140007d54dcf31b2c0e3e98cf33a00fd27f0
TAG: 2865d2a26f413cc92416340f9491e1be

KEY: 3b319e40148a67dc0bb19271d9272b327bc5eee087173d3d134ad56c8c7dc020
NONCE: 00000000ce5cf6fef84d0010
IN: 27b5627b17a2de31ad00fc2ecb347da0a399bb75cc6eadd4d6ee02de8fbd6a2168d4763ba9368ba982e97a2db8126df0343cdad06d2bc7d7e12eec731d130f8b8745c1954bfd1d717b4ea2
AD: a026b6638f2939ec9cc28d935fb7113157f3b5b7e26c12f8f25b36412b0cd560b7f11b62788a76bd171342e2ae858bcecb8266ff8482bbaed593afe818b9829e05e8e2b281ae7799580142
CT: 368fb69892447b75778f1c5236e1e9d5d89255c3d68d565a5bba4f524d6ad27de13087f301e2ef4c08f5e2c6128b1d3e26de845c4ac4869e4c8bd8858ad0d26dec3b5d61a9e3666a3911ba
TAG: 1414f1b91966340417c38226ccca9d3d

KEY: 43bf97407a82d0f684bb85342380d66b85fcc81c3e22f1c0d972cd5bfdf407f4
NONCE: 000000008b6ba494c540fba4
IN: 4b4c7e292a357f56fdf567c32fc0f33608110d7ce5c69112987d7b5a0bd46d8627a721b0aed070b54ea9726084188c518cba829f3920365afc9382c6a5eb0dd332b84612366735be2479b63c9efc7ff5
AD: 1e0acf4070e8d6758b60d81b6d289a4ecdc30e3de4f9090c13691d5b93d5bbcef984f90956de53c5cf44be6c70440661fa58e65dec2734ff51d6d03f57bddda1f47807247e3194e2f7ddd5f3cafd250f
CT: d0076c88ad4bc12d77eb8ae8d9b5bf3a2c5888a8d4c15297b38ece5d64f673191dc81547240a0cbe066c9c563f5c3424809971b5a07dcc70b107305561ce85aecb0b0ea0e8b4ff4d1e4f84836955a945
TAG: c5ca34599c6a8b357c6723ee12b24da8

KEY: 12fc0bc94104ed8150bde1e56856ce3c57cd1cf633954d22552140e1f4e7c65d
NONCE: 00000000d3875d1b6c808353
IN: 24592082d6e73eb65c409b26ceae032e57f6877514947fc45eb007b8a6034494dde5563ac586ea081dc12fa6cda32266be858e4748be40bb20f71320711bf84c3f0e2783a63ad6e25a63b44c373a99af845cdf452c
AD: b8be08463e84a909d071f5ff87213391b7da889dc56fd2f1e3cf86a0a03e2c8eaa2f539bf73f90f5298c26f27ef4a673a12784833acb4d0861562142c974ee37b09ae7708a19f14d1ad8c402bd1ecf5ea280fab280
CT: 9d9ae6328711fb897a88462d20b8aa1b278134cdf7b23e1f1c809fa408b68a7bfc2be61a790008edaa98823381f45ae65f71042689d88acfa5f63332f0fba737c4772c972eba266640056452903d6522cefd3f264e
TAG: e84211b6cfd43543f8b1b4db07a494d1

KEY: 7b6300f7dc21c9fddeaa71f439d53b553a7bf3e69ff515b5cb6495d652a0f99c
NONCE: 0000000040b32e3fdc646453
IN: 572f60d98c8becc8ba80dd6b8d2d0f7b7bbfd7e4abc235f374abd44d9035c7650a79d1dd545fa2f6fb0b5eba271779913e5c5eb450528e4128909a96d11a652bf3f7ae9d0d17adbf612ec9ca32e73ef6e87d7f4e21fe3412ce14
AD: 9ff377545a35cf1bfb77c734ad900c703aee6c3174fdb3736664863036a3a9d09163c2992f093e2408911b8751f001e493decc41e4eeeed04f698b6daed48452a7e1a74ec3b4f3dcf2151ca249fa568aa084c8428a41f20be5fd
CT: 229da76844426639e2fd3ef253a195e0a93f08452ba37219b6773f103134f3f87b1345f9b4bf8cfc11277c311780a2b6e19a363b6ac2efe6c4cc54a39b144e29c94b9ebbde6fd094c30f59d1b770ebf9fcad2a5c695dc003bf51
TAG: 55e025a1eb87bc84d4be00c775c92ad2

KEY: 4aeb62f024e187606ee7cc9f5865c391c43df1963f459c87ba00e44bb163a866
NONCE: 000000009559bd08718b75af
IN: c5d586ceece6f41812c969bcf1e727fe6ff8d1ae8c8c52367c612caa7cdf50e0662f5dffc5ea7d3cc39400dfe3dc1897905f6490fd7747b5f5f9842739c67d07ce7c339a5b3997a7fb4cd0d8e4817ff8916b251c11ef919167f858e41504b9
AD: 51f5b503b73a5de8b96534c2a3f2d859ece0bd063ea6dfa486a7eec99f6c020983f7148cccb86202cf9685cc1cc266930f04e536ad8bc26094252baa4606d883bd2aeed6b430152202e9b6cc797ff24fc365315ed67391374c1357c9a845f2
CT: 252ea42b6e5740306816974a4fe67b66e793ebe0914778ef485d55288eb6c9c45fa34ac853dc7a39252520514c3cb34c72b973b14b32bc257687d398f36f64cc2a668faffa7305ab240171343b5f9f49b6c2197e4fbe187b10540d7cdcfa37
TAG: ab1d8a5a1f3eda9b5609c0028737477f

KEY: 9a19e72f005cae1ae78b8e350d7aabe59fc8845999e8c52fad545b942c225eaf
NONCE: 00000000d9dae2ea8d2ffc31
IN: 2110378d856ded07eb2be8e8f43308e0c75bc8a3fcc7b1773b0725b7de49f6a166c4528e64120bdf7c9776615d3ce6feeb03de964a7b919206a77392f80437faceb6745845cafc166e1c13b68e70ca2a1d00c71737b8fcbbbd50902565c32159e05fcd23
AD: 1cd73b72c4e103afbefd7c777e0480f3f5e68c60b85bd2e71ef5caebb175d7fc6535d39f38f92c24f2eb0fe97d878ed3d5967c0bb4394a5d41f7d34cda6e1523d3848f049cde554a7d31e1afeab5d3e6150f85858335cbd28c8a7f87d528058df50eea06
CT: 5f009fbce4ec8e4ca9d8d42258b1a3e4e920b2fbad33d5e9f07557d9595e841025193b521ba440110dd83958e8ee30219d952b418e98a6c624894aa248aedc0678f2d263e7bfaf54ca379fef6c5d2f7ac422ea4b4369408b82d6225a7a2cf9a9f46fd4ef
TAG: 1c6bdff7d8b9554dc7bf40e50b37d352

KEY: ba1d0b3329ecc009f1da0fab4c854b00ad944870fdca561838e38bad364da507
NONCE: 000000008a81c92b37221f2f
IN: 6289944ffa3ccea4bf25cd601b271f64e6deb0eba77d65efb4d69ca93e01996e4727168b6f74f3ccf17bd44715f23ceb8fc030c0e035e77f53263db025021fd2d04b87a1b54b12229c5e860481452a80a125cb0693a2ba1b47e28ee7cbaf9e683c178232c7f6d34f97
AD: e57883961b8d041d9b9eeaddcfd61fa9f59213f66571fadffffdd1498b9b014f1ef2e7e56c3044d7f9fa7a1403a1169e86430a2a782137093f5456e142aad03a5f7a66d38009dd01b7fc02c9cf61642dedaf7cc8d46066c281ee17780674c3a36eae66c58d2d765075
CT: 9c44d9135db0dbf81c862c1f69bec55a279794cdd29a58e61909aa29ec4c120c9c5a508d856b9e56138095714a4bb58402a1ad06774cf4ecdf2273839c0007cb88b5444b25c76f6d2424281101d043fc6369ebb3b2ff63cdb0f11a6ea1b8a7dafc80cdaef2813fa661
TAG: 689a141bc11159d306dad7a4ecf6ad9d

KEY: 0cf8c73a6cffc1b8b2f5d320da1d859d314374e4a9468db7fd42c8d270b7613a
NONCE: 000000003c4c6f0281841aff
IN: 4434728d234603c916e2faa06b25d83bad3348990ecde2344368d1a7af1309bd04251bb2e0b72044948f8dea33cce2618283b6af742073a9586b26c1089335fe735141e099785a1235810a3a67ff309e2f0ce68220ba0077ad1a5dc1a4aef898a3b9ff8f5ad7fe60149bd0bd6d83
AD: a38d09a4f1c9241623c639b7688d8d35345ea5824080c9d74e4352919db63c74d318f19e1cbb9b14eebd7c74b0ad0119247651911f3551583e749ea50ff648858dcaaa789b7419d9e93a5bf6c8167188dbac2f36804380db325201982b8b06597efeb7684546b272642941591e92
CT: bdfbfea261b1f4c134445321db9e6e40476e2dd2f4e4dbe86e31d6a116d25830762e065b07b11a3799aab93a94b4f98c31c0faeb77ec52c02048e9579257e67f5a6bae9bc65210c25b37fc16ee93bda88fd5f30a533e470b6188c6ce5739fa3e90f77120b490fc1027964f277f40
TAG: 780cc54bb6f1c9b78545c1562cd9d550

KEY: 69f4e5788d486a75adf9207df1bd262dd2fe3dd3a0236420390d16e2a3040466
NONCE: 000000006255bf5c71bb27d1
IN: c15048ca2941ef9600e767a5045aa98ac615225b805a9fbda3ac6301cd5a66aef611400fa3bc04838ead9924d382bef8251a47f1e487d2f3ca4bccd3476a6ca7f13e94fd639a259ef23cc2f8b8d248a471d30ac9219631c3e6985100dc45e0b59b8fc62046309165ddb6f092da3a4f067c8a44
AD: 0c83039504c8464b49d63b7f944802f0d39c85e9f3745e250f10119fa2c960490f75ae4dced8503b156d072a69f20400e9494ab2fa58446c255d82ff0be4b7e43046580bc1cf34060c6f076c72ea455c3687381a3b908e152b10c95c7b94155b0b4b303b7764a8a27d1db0a885f1040d5dbcc3
CT: f0bb2b73d94f2a7cef70fe77e054f206998eacf2b86c05c4fa3f40f2b8cebf034fe17bcbee4dea821f51c18c0aa85b160f8508bd1dc455cc7f49668b1fb25557cdae147bf2399e07fcacaca18eccded741e026ef25365a6b0f44a6b3dd975ee6bb580f5fccd040b73c18b0fbf8f63199ba10fe
TAG: 2ecccea4607d14dbb2d2475792aeb468

KEY: ad7b9409147a896648a2a2fe2128f79022a70d96dc482730cd85c70db492b638
NONCE: 00000000a28a6dedf3f2b01a
IN: 791d293ff0a3b8510b4d494b30f50b38a01638bf130e58c7601904f12cb8900871e8cf3d50abd4d34fda122c76dfee5b7f82cd6e8590647535c915ae08714e427da52f80aef09f40040036034ca52718ea68313c534e7a045cd51745ec52f2e1b59463db07de7ca401c6f6453841d247f370341b2dbc1212
AD: 9a6defddb9b8d5c24a26dd8096f5b8c3af7a89e1f7d886f560fabbe64f14db838d6eb9d6879f4f0b769fe1f9eebf67fcd47b6f9ceb4840b2dba7587e98dc5cae186ef2a0f8601060e8058d9dda812d91387c583da701d2ba3347f285c5d44385a2b0bf07150cbc95e7fcfa8ae07132849a023c98817c03d2
CT: c2f109d6d94f77a7289c8a2ab33bc6a98d976554721b0c726cbf4121069473e62ba36e7090e02414f3edc25c5d83ac80b49ad528cda1e3ad815b5a8c8ae9ad0753de725319df236983abd3f69ab4465d9b806c075b1896d40bdba72d73ba84c4a530896eb94ffccf5fb67eb59119e66a1861872218f928cf
TAG: 17ec6cf2b172f01e3c456ad047196805

KEY: 48470da98228c9b53f58747673504f74ca1737d7d4bb6dbf7c0cba6ca42f80b9
NONCE: 0000000056fb4923a97e9320
IN: bc6626d651e2b237f22ee51608ddcffeba5f31c26df72f443f701f2b085d6f34f806e29673584cb21522179edb62a82427d946acabce065b88b2878e9eb87ed1004e55ef58f51ec46375ac542c5782725ff013136cb506fcf99496e13fcd224b8a74a971cc8ddb8b393ccc6ac910bd1906ea9f2ed8a5d066dc639c20cd
AD: df8ab634d3dca14e2e091b15ecc78f91e229a1a13cba5edd6526d182525ec575aa45bc70fb6193ffcd59bad3c347159099c4f139c323c30a230753d070018786b2e59b758dd4a97d1a88e8f672092bef780b451fd66ba7431cbb5660ea7816cdf26e19a6ebb9aadc3088e6923f29f53f877a6758068f79a6f2a182b4bf
CT: a62e313ecf258cc9087cbb94fcc12643eb722d255c3f98c39f130e10058a375f0809662442c7b18044feb1602d89be40facae8e89ca967015f0b7f8c2e4e4a3855dbb46a066e49abf9cef67e6036400c8ff46b241fc99ba1974ba3ba6ea20dc52ec6753f6fc7697adbccd02b0bbea1df8352629b03b43cc3d632576787
TAG: d29a8968067aeb457ffc114c3a9efb95

KEY: b62fb85c1decd0faf242ce662140ad1b82975e99a3fa01666cac2385ab91da54
NONCE: 000000002f4a5ca096a4faf8
IN: 03b14f13c0065e4a4421de62ab1d842bffb80f3da30bf47d115c09857f5bdd5756fd7c9ac3d9af1c9fb94f2640f7f4386cfba74db468e5288dbe4dd78bfe4f69e41480ca6138e8beacc6eaa3374157c713cfa900c07dd836eaecc8827fa3e70e052ae09e8473e2ae1a10b1bb669ef60a8dd957f6553daa8114918e17371f2ac327bd
AD: cfe3b7ab7550b0e8e2e8235fa0dcef95647ce6814abd3dc3f5a3bd7d6d282504660c34ad8341e4d11402c7d46c83a494d7ddb105e1002979023e0e3dc2978c9ae53e10eb8567e7a02b60e51e945c7040d832ca900d132b4205a35034fed939a1b7965183c25654931a9b744401c4649c945710b0d9733b87451348b32ba81de30ea7
CT: 8965db3d3ae4fb483208f147276e7d81b71a86e7202ffc9b1eaade009bc016838dc09ca4bcf30887b2f4243fbd652cd90ebed1ceef8151ff17ea70518d03b0f2a24960aa7de9b30fa65c2e2d57360061aae6d9376e984e9fcd5e5dd0911a4bc8deca832ffb76f252bd7da523076593ba6b174f7d9fb0377e066ecbb6638036241e86
TAG: 28a5284696ed82714eaa94c9ebe6e815

KEY: de9c657258774d4ebc09d109a0fc79d66493ae578797cac4eb8830a6a4b547e0
NONCE: 00000000b5e35fe3398efa34
IN: 4d68fb683aa4f4c7a16ba1114fc0b1b8d8898610fa2763e435ded8771b3651078bef73d4dfd14e76a34cd5eb9ef4db4ead4da9e83f4ce50fe059977b2d17d687c29335a04d87389d211f8215449749969f7652dc1935a0f9a94538dc81dc9a39af63446a6517609076987920547d0098a9c6766cf5e704883ea32feaea1889b1554b5eb0ce5ecc
AD: 436ea5a5fee8293b93e4e8488116c94d3269c19f1d5050def23d280515457b931bbed64a542b317cc5023d648330a4b7adca14dd6f3783207b94f86ccaa0a0ac39b7db00ac87a99e3cd8a764ed9c75da8454479636ab2b29e770b166a5b75cacc425c919bf1ce9ac34afe6b4425c3d9fd2e48bc81e7d15516d60e592bfcc2ebefb660f0995f2b5
CT: 97a97b8f0f5420845ae8d57567f9bba693d30e6db916fad0b971f553ad7d993f806f27ab8b458d8046062ced4778c004b4f958a4436141637c6039963308dea2f54008b7feab79650295ed41bf9e65e1a2d75ab1c7b2a70ebb9e9f38d07a9a672d3e95ea78afe9ac02f2566b48b0251aef6eeeca8bd15bd8d43b559426aa9d15d960ee35cb3edf
TAG: 4ef49e8a0c2ef85826d7f03e81c577f2

KEY: 6885bd333c336c7672db8ebdf24c1a1b605c5a4ae279f0f698162f47e6c73401
NONCE: 00000000f0c4a213a6168aab
IN: fa905a2bfa5b5bad767239fb070a7bc0b303d1503ecd2b429418cc8feba843e5444ed89022fdb379c3b155a0f9ceab2979000a0f60292a631771f2fde4ef065aa746426609082969530a9c70ad145308c30ba389ea122fd766081511a031ce3a0bd9f9f583c7000b333b79ac004fbde6ec3eb2d905977ff95dcff77858e3c424fe8932a6a12139e6ec8d5e98
AD: 8ded368f919efb522bb6a9ad009e02ffbc6a16536e34d95cdb34f1153d7cb7b0f3c2b13dd05cedae27cfe68ec3aca8047e0930a29c9d0770c1b83c234dcb0385deae7ae85da73a5f8de3dfb28612a001f4e552c4f67ae0e2ec53853289b7017a58591fd6f70b0e954876bb2f7ec33001e298856a64bb16181017ba924648c09fc63c62eff262c80d614679bd
CT: 0cb3d6c31e0f4029eca5524f951244df042fc637c4162511fea512a52d3f7581af097eb642e79e48666cb1086edbd38c4777c535a20945fabc23e7c9277e2b960aac46865f1026eb6da82759108b9baece5da930ccfc1052b1656b0eadaa120ed0c45ad04b24ae8cdb22ceab76c5f180b46a392ab45b1b99c612546e6b947f4d5c06ad5abee92ff96345ad43
TAG: fad7d5a5193dfb121c68529ba8c0c35d

KEY: fbc978abb1240a6937ccc16735b8d6ed5411cdbc1897214165a174e16f4e699b
NONCE: 000000007968379a8ce88117
IN: 1a8196cd4a1389ec916ef8b7da5078a2afa8e9f1081223fa72f6524ac0a1a8019e44a09563a953615587429295052cc904b89f778ef446ed341430d7d8f747cf2db4308478524639f44457253ae5a4451c7efca8ae0b6c5c051aaa781e9c505489b381a6dcba87b157edc7f820a8fbaf2a52e484dc121f33d9d8b9ac59d4901d6ed8996ed4f62d9d4d82274c449cd74efa
AD: 3913cd01299b8a4e507f067d887d7e9a6ded16dd9f9bb3115c5779aa14239fd33ee9f25756d45262dc3011069356425b5c81a4729594e17c9747119f81463e85625d5603d05e00f568b0c800bb181eb717be8d7a93166a504ce1bc817e15530c5bd2b3df1d4222245ea78a38bc10f66c5cf68d661503131f11af885c8a910b6dce70bc3a7448dfae00595beb707fe054d3
CT: d152bcb4c24c3711b0fad28548dc4db605bbc89237cdbea7dbf956b8855d1161a0781f27bd56d798141e2ace339955efb98fe05d9b44cd011e645106bf47726183958cb6df34ce5766695f60bc70b6fe0fabb9afa009a8ef043dbf75f861881368fa07726625448fe608d578cdc48277f2dc53eaaf1bdc075269a42f9302a57cad387a82c6969608acacda20e1cac4596c
TAG: 96ae06cd7c72456e5568a42317046158

KEY: 77d1a857fbadfe01aba7974eea2dfb3dc7bf41de73686aece403993e5016c714
NONCE: 00000000fdd913a321c40eb0
IN: db8915bfe651e2ecb3ce0b27d99a6bfa7a7c507cfcb2987293018636c365a459c6a138b4428be538413db15bda69e697cbb92b154b7f4d2cbb07965225aa6865d7dcd1ba2c17c484b00b1986fed63e889f25a4966dc3ed4273f1577768f665362d7d3e824484f0dded7f82b8be8797ad951719719365e45abbf76324bc7d657799d4d4f4bb1dba67d96ab1c88519a5bee704f7214814
AD: 3cb2c06c20cb0832bbacebfc205d77393ca1816346ea2681de4d3ab1fadb774ad273e4713290454496f5281ebc65e04cfe84ed37cd0aedc4bbe3decbd8d79d04a4e434876650e0d64309e336bfb10e924066a64acb92260b2dbd96735d03af03909aa6a80a6e89fda81037257aec21fe9be7e91a64e88e0a58fa38ecba4c4c4cffb61958f3c486cbb0b1d0b0014a2d1d3df248eec1ca
CT: acb825e6023b44b03b2efc265603e887954e8612b2ee134bdcb61501cfb9492952bf67be597c3a005b09af74d9e421a576d2c65e98104780feab838d8cb1bd135452ea39dc8907a4c1a6a9161805e4fa3e16989e6a418a7eea2582bf895da967028eab7c95d846a6de4b9980785814cf00484baa2f6de609912fff689bce6e854261ffe866bd8e63274605c7c5ad677bd7897ade543e
TAG: bcf523a9bcf772e157941753c6d7401e

KEY: b7e9b90dc02b5cd6df5df7283ef293ed4dc07513d9e67331b606f4d42dec7d29
NONCE: 00000000a6c191f6d1818f8e
IN: 2ada0e3c7ca6db1f780ce8c79472af4e8e951ddc828e0d6e8a67df520638ff5f14a2f95a5e5931749ae2c4e9946ae4d5eb5de42fb5b77d2236e2e2bd817df51be40b1b8a6c21015a7c79fe06dba4a08b34013dfa02747b5f03930268404c455dc54a74d9c6e35485e10026da573cb41cd50b64cfafe4cfcdf3c9684ef877e45d84e22bd5e15fa6c8fd5be921366ff0dc6fe2df45f7252972c9b303
AD: 0f4269ed5ef0bfff7be39946a4e86e8bf79f84b70cd0b14fecb7be3c071316ce86de3d99d6871e0ba5667d9d7bba7dcaba10cb2a36668b6c3e2fb6c102938b75008bb9c213ebf9b85b5e91a802df0d31d7f11d764b2289f6225212694ab6b7c0e3ff36e84245d9f4f43fc5f98e654dea7ba9bd918658879c5bb4a1642af0d83113e3cf935d3c0d5208318f66f654eb17d8c28a602543e77ad3e815
CT: 22586fe7338e99cdaad9f85bd724ba4cfe6249b8a71399f9a3707b5c4323b8d96679568dfc8d230aefb453df596e13eb3e8a439249bd64bc93a58f95089a62b94f6562b821c83d91f56c55147381e9de4beb4ae81bd6fe7caef7e7e9a2078f2fba8f3e70d4910da9accc92b8e81a61b0fefbece4bd89443e66e8ddda8e47a66a62f17fd0e7d0a4852ce1a4d43d72a0b5e8914bbec698f060f2b092
TAG: bd05336ed6426de412aac37661953052

KEY: 6b2cb2678d1102f2fbbd028794a79f14585c223d405e1ae904c0361e9b241e99
NONCE: 000000007b3ae31f8f938251
IN: b3cb745930e05f3ab8c926c0a343a6eb14809fd21b8390a6fcc58adb5579e5432021765b2d249a0ecf6ba678634c4f53f71495865f031ee97aa159f9ead3a3fcb823ee5238bdf12706a9c6137d236e2e7110ce650c321e41daf0afd62bab2a8fe55d7018de49a14efe6d83a15b2f256d595e998d25309f23633360f5745c50c4e5af8ccc9a8a2cb47064105a023e919c7795d2dc331d3f2afb8c42e5c0bcc26d
AD: 1c32fd3df22b3e440e2a3c7a7624990194cb16a5f74af36f87fd6ca7d410ce9064316a2d091945deef7d9b35ceec8396069307caced2b80afd7d53ec479c35cedf2dfd4c95c3dd8400f71ad34028c6e4f8681d93d0774064ba38f3fb9b0c1dfa1f5f0c7d20676a5911d999fb6a1d41367a8e99d852bf3d3b7b3f4c233249ed1ca135389a674ff48232ded3f6800a97b6d409c40e6cd70d09bf9d2ad25d9b9485
CT: ef70c7de98ab1d4ad817024a970be463443640eb0cd7ff234bdd00e653074a77a1d5749e698bd526dc709f82df06f4c0e64046b3dc5f3c7044aef53aebb807d32239d0652dd990362c44ec25bf5aeae641e27bf716e0c4a1c9fbd37bbf602bb0d0c35b0638be20dd5d5891d446137e842f92c0ee075c68225e4dbacb63cc6fb32442b4bcda5e62cb500a4df2741a4059034d2ccb71b0b8b0112bf1c4ca6eec74
TAG: d48657033095db3f873c33445fec8d35

KEY: 4dbc80a402c9fceaa755e1105dc49ef6489016776883e06fcf3aed93bf7f6af7
NONCE: 000000002358ae0ce3fb8e9f
IN: 197c06403eb896d2fa6465e4d64426d24cc7476aa1ae4127cd2bd8a48ce2c99c16b1cbf3064856e84073b6cf12e7406698ef3dd1240c026cbd1ab04ee603e1e6e735c9b7551fd0d355202b4f64b482dd4a7c7d82c4fe2eb494d0d5e17788982d704c1356c41a94655530deda23118cba281d0f717e149fbeb2c59b22d0c0574c1a2e640afad1a6ceb92e1bf1dde71752a1c991e9a5517fe98688a16b073dbf6884cfde61ac
AD: cf6ce7b899fb700a90d2a5466d54d31358ecf0562e02b330a27ba0138006b342b7ed6349d73c4c5c6d29bde75a25089b11dac5b27adea7e7640ca1a7ceb050e3aae84a47e11640a6e485bd54ae9fdb547edc7313d24a0328429fcffd8b18f39880edd616447344ebeec9eadb2dcb1fa7e67179e7f913c194ebd8f5a58aea73b0c5d1133561245b6d9c5cfd8bb0c25b38ffb37db5e2de5cdded6b57355e9d215cb095b8731f
CT: aa87f9a83048b6919c8f2b050315db4e2adae4a9c2ca0109b81961b520e63299dcb028cec0b9d3249a945ee67dd029b40f361245c740f004f8cf0d2214fcfa65e6124a3e74b78aa94345c46fdc158d34823ed249ee550431eaae9218367321cdd6e6a477650469bb3cc137a8f48d9cf27934b16703608b383d2145659922fb83bb2e7ee2ef938a90f2ff846a4a949129b1fb74dde55c5ae013c2f285de84f7dac7d1662f23
TAG: 298f84c8312029a7b1f38c5ea6021f57

KEY: 9e4a62016dae4b3223fed1d01d0787e31d30694f79e8142224fe4c4735248a83
NONCE: 00000000263a2fc06a2872e7
IN: 5a46946601f93a0cee5993c69575e599cc24f51aafa2d7c28d816a5b9b4decda2e59c111075fb60a903d701ad2680bb14aeda14af2ae9c07a759d8388b30446f28b85f0a05cd150050bd2e715ff550ebbd24da3ebb1eac15aba23d448659de34be962ab3ab31cb1758db76c468b5bb8ce44b06c4e4db9bd2f0615b1e727f053f6b4ffb6358d248f022bcad6ca973044bed23d3920906a89a9a9c5d8024ec67d7f061f64529a955ce16b3
AD: 4cd65f68f9f88c0516231f2a425c8f8a287de47d409d5ecde3ad151e906b3839fb01bb91a456f20ea9d394d4b06604ab1f9009ef29019af7968d965d1643161ab33a5354cda2fdc9f1d21ec9cb71c325c65964a14f9b26eb16560beb9792075a1597394000fd5f331bd8b7d20d88e5f89cf8d0b33e4e78e4904bb59c9c8d5d31ac86b893e4a0667af1be85fdb77f7ec3e2594a68048d20c2fb9422f5879078772ee26a1c560cbcbb2113
CT: e944bb2ab06d138ad633c16ce82706ecf0ef5d119be1f3460c9ce101d9c4e04ef1677707fca40d1f8ca181e07273707b06624d6d7063c3b7b0bb0151b757b3e5237fb8004c161233d8bc7e5f28ea1c18da1874b3d54c5ad6ff0835eed35c8853704585cf83996e5e7cec68180af414e04f08134d3b0384ebdf0393c9310b55d8698fe10cb362defc0995e9a13b48b42cff61ffd9fe4c3c8c6dab355713b88f6e98a02e7231a0c6644ec4
TAG: 6234e81e089b779d0d509d14e566b5d7

KEY: 18ca3ea3e8baeed1b341189297d33cef7f4e0a2fab40ec3b6bb67385d0969cfe
NONCE: 00000000b6aef34c75818e7c
IN: ef6d1bb4094782f602fcf41561cba4970679661c63befe35ff2ca7ad1a280bf6b1e7f153fa848edfeffe25153f540b71253e8baba9aeb719a02752cda60ea5938aab339eead5aabf81b19b0fc5c1ed556be6ad8970ea43c303d3046205b12c419dea71c4245cfedd0a31b0f4150b5a9fe80052790188529ab32f5e61d8ccde5973ed30bdf290cbfbd5f073c0c6a020eac0332fced17a9a08cef6f9217bd6bef68c1505d6eed40953e15508d87f08fc
AD: f40f03beaa023db6311bad9b4d5d0d66a58d978e0bcbbf78acebde1f4eb9a284095628955a0b15afc454152f962ec3ea2b9a3b089b99658e68ede4dee5acd56672025eb7323bcbc6ba5d91c94310f18c918e3914bbbf869e1b8721476f9def31b9d32c471a54132481aa89f6c735ab193369496d8dbeb49b130d85fbff3f9cb7dccea4c1da7a2846eef5e6929d9009a9149e39c6c8ec150c9ab49a09c18c4749a0a9fcba77057cdea6efd4d142256c
CT: c531633c0c98230dcf059c1081d1d69c96bab71c3143ae60f9fc2b9cd18762314496ab6e90bf6796252cb9f667a1f08da47fc2b0eecda813228cae00d4c0d71f5e01b6ce762fa636efffe55d0e89fdc89ba42521cc019ab9d408fcd79c14914e8bbf0ea44d8a1d35743ad628327e432fdcfeb0b6679ddca8c92b998473732abd55dba54eefff83c78488eee5f92b145a74b6866531476fc46279d4fde24d049c1ce2b42358ff3ab2ba3a8866e547af
TAG: e3b4192f6e50528c4f4f70267f094c56

KEY: 95fdd2d3d4296069055b6b79e5d1387628254a7be647baafdf99dd8af354d817
NONCE: 00000000cd7ed9e70f608613
IN: 0248284acffa4b2c46636bdf8cc70028dd151a6d8e7a5a5bc2d39acc1020e736885031b252bfe9f96490921f41d1e174bf1ac03707bc2ae5088a1208a7c664583835e8bb93c787b96dea9fc4b884930c57799e7b7a6649c61340376d042b9f5faee8956c70a63cf1cff4fc2c7cb8535c10214e73cec6b79669d824f23ff8c8a2ca1c05974dd6189cfee484d0906df487b6bd85671ce2b23825052e44b84803e2839a96391abc25945cb867b527cdd9b373fbfb83
AD: 24a45a3a0076a5bcfd5afe1c54f7b77496117d29f4c0909f1e6940b81dde3abacb71ec71f0f4db8a7e540bd4c2c60faee21dd3ce72963855be1b0ce54fb20ad82dbc45be20cd6c171e2bebb79e65e7d01567ad0eeb869883e4e814c93688607a12b3b732c1703b09566c308d29ce676a5c762a85700639b70d82aaef408cf98821a372c6a0614a73ba9918a7951ea8b2bb77cd9896d26988086d8586d72edc92af2042ff5e5f1429a22f61065e03cfcd7edc2a93
CT: 40c6318d9e383e107cdd3e1c8951562193c3ef64ee442432a63e2edefc78f32ab07772aeac172cb67ecf4d21f8b448423527bbeb9d8ddd0b46bdb27f74096ceb24e41963b4cdca176676a75bdbe3abc270b349ac0c6cbd9c3a5cd5bce20202fc5cc0c1bdd4fd25e121e0a24bd7bbeb9b19b1912467bf5338ee2ce88aa383c082b42cc399c9654ca325f35523e81438beb3f8926be79c378822d7c8f785614408a5f7cac49e4543188725643e6c1a70b46d0ec400
TAG: 874875c9a0ba3060a0680291c3dc85a2

KEY: 6ae1102f84ed4dc114bb9d63f4dc78d7dbb1ab63f1659dd95f47940a7b7a811f
NONCE: 00000000c965d578ba91d227
IN: b82a8a9209618f1f5be9c2c32aba3dc45b4947007b14c851cd694456b303ad59a465662803006705673d6c3e29f1d3510dfc0405463c03414e0e07e359f1f1816c68b2434a19d3eee0464873e23c43f3ab60a3f606a0e5be81e3ab4aa27fb7707a57b949f00d6cd3a11ae4827d4889dd455a0b6d39e99012fd40db23fb50e79e11f8a6451669beb2fbd913effd49ad1b43926311f6e13a6e7a09cf4bebb1c0bf63ce59cd5a08e4b8d8dbf9d002e8a3d9e80c7995bb0b485280
AD: dfd4ac3e80b2904623ff79ea8ee87862268939decf5306c07a175b6b9da0eb13ac209b4d164755929e03240a0fe26599f136fb2afdffd12bb20354aa1d20e5799839abb68ae46d50c8974e13e361d87ef550fe6d82e8b5b172cf5cd08482efdef793ede3530d24667faf3a1e96348867c2942641f4c036981b83f50236b8e8a10b83ebf6909aad0076302f1083f72de4cf4a1a3183fe6ec6bfe2e73e2af8e1e8c9d85079083fd179ccc2ee9ff002f213dbd7333053a46c5e43
CT: a9aeb8f0a2b3ca141ac71a808dcc0c9798ac117c5d2bd09b3cfe622693a9f8ca62e841b58bddb2042f888e3099b53638b88dfc930b7a6ee4272d77e4b1d7e442bab6afbde96ab0b432f0092d9ca50eef42f63c60c09e7b8de019b32ebe4030c37b8183cc1e3b913b0ce4ee4d744398fa03f9af1c070bed8cdafd65b3a84140cb4deadc70184de757332ce3780af84353f540755227e886a8d7ad980f3dd6fd68263d82e93f883381dec888bc9f4f48349aa2b4c342cb9f48c6
TAG: f6dcad5412b95994f5e4d6829c2eba98

KEY: 405bb7b94715b875df068655f00513cb1ae23ffaac977ce273e57d3f83b43663
NONCE: 000000005c6da1259451119a
IN: f9f143c0c52c94b4ba7b0608b144156a49e7b5d27c97315743d171911e3645ab7957c80924e3c6b9c22ab7a1cac4b7e9c0de84e49fd5e4a2d1ab51d764fc5670318688ec942f7ab34c331dce8f90fea6972e07f0dadec29d8eb3b7b6521ddd678a6527a962f4d8af78c077e27f7a0b2ef7eabd19e92b7f8c1e8fb166d4763ce9c40c888cf49aa9cdfc3e997c8fe1cce3fe802441bbd698de269ff316f31c196e62d12c6bb5cd93fb3c79ca6369f8c1ac9102daf818975ea7f513bb38576a
AD: 6fe6446505677bf08b385e2f6d83ef70e1547712208d9cebc010cba8c16ea4ece058d73c72273eed650afdc9f954f35aa1bdf90f1118b1173368acbc8d38d93ebf85bd30d6dc6d1b90913790c3efa55f34d31531f70c958759b2ba6f956c6fcdd289b58cb4c26e9515bf550f0fd71ab8527f062c9505cbb16e8e037d34de1756bef02a133dbf4a9c00ac03befc3fb7f137af04e12595ce9560f98b612480fcdba3b8be01db56ebec40f9deae532c3b0370b5c23a2a6b02a4de69efa8900c
CT: 1a4b073881922c6366680cc9c2a127b26f264148651b29abb0c388cf6c9b1865dba5a991e1f8309efbdb91bce44b278772c58fd41273526c33fec84beb53d1689b9da8483f71be6db73a73417069bb4cd3f195236e8d0a00d124eed3a6b6f89415b19a27fbe35774f6a1a6ee4bd4350b252b975f0db2d2eea82f4836350850d6290901e726e8af13644e2d98bc1d569c20800521e6affe976bd407049a2e6d9dd23f88d52e651391ecd2fc45b864310824aaadfa203762a77c1d64562dae
TAG: 90fcc2544880250f1c3abe8a3761ba08

KEY: 8c602bd94c630cd00c7a9c508067a5a9f133d12f06d9f6fe2a7b68dce4786d8a
NONCE: 00000000760de0f7b7cb67e2
IN: c3ff559cf1d6ba6c0cc793ca09a0ba573a28359386a6ec93e1bacd8e630209e0b477a20aedec3c9cbf513ee6a1e3887112218d6155b9875f7e6c4bbba2c31972e905d19f529f4f0f9502996199f94f8728ba8d6424bb15f87fcacd88bb42c63fcc513759712bd0172b1e87c9da122f1993ffb7efd3a5c34b240dd3db89dddea36dbeb2836d9f8648f8e7cd428c0f948097af753b35f9876059e7702027bb00dc69071206e785f48fcbf81b39cc0343974ac70784a2e60c0df93b40379bea4ad8cac625
AD: 9e14907c3a8e96c2636db1f3d78eb1f673d6ef043cbbb349467f1fe29bf60f23d5d5d1c3b133a8ad72065d822347541c13d1574baf737eb3cc3382fb479e6d5193b9c8e7d2444c66971ef099dc7f37f6cd97b9f7959d46e2cf25e8a5b3111b4d9e2ef906d905f0ee2d17587f7082d7c8e9a51509bde03d3d64338e1838d71700f1b4fcb100b5e0402969da462f26f974b4f9e766121f8fd54be99fc10beb9a606e13fbb1f960062815d19e67f80093360324013095719273c65542b0e31b1a2a3d928f
CT: 2794e6e133f6892f23837fff60cf7c28ee9942f8982ef8089db117903d0143293fdf12ea1cc014bcd8806fb83c19570eed7af522db0de489bbc87133a13434518bcfb9cda4d9f6d832a69209657a447abf8afd816ae15f313c7ea95ec4bc694efc2386cdd8d915dc475e8fadf3421fbb0319a3c0b3b6dfa80ca3bb22c7aab07fe14a3fea5f0aee17ab1302338eeac010a04e505e20096a95f3347dc2b4510f62d6a4c1fae6b36939503a6ac22780a62d72f2fc3849d4ef21267fffdef23196d88fbb9b
TAG: 7fa630c9bcb455e89f13d7a99d5e8dbe

KEY: bd68ff5eb296c71cfe6bc903c14907f7726bcb1331f0c75f7801cd1b7948f3a1
NONCE: 0000000065a748004b352ba6
IN: 52bf78c00f6e5dca2fc60e2e9a52e827df97808e9cf727773860cafc89f4b64178a19b30b46ed813fe00c8f09b25a6a1b6e350d5b005122934a59bfbd5e6e0c635c84a5226c3f2f7dcf951560f18ac220453d583015fdb2e446c69c6e6fdecf2e595e04fab1b0c506e3c6bd5e4414a35f15021e97f447aa334f54a8f1ef942dec6273511b5668b696fca97188ff15ed84b2f46145cce031c1a7f00bd88bb83d90797edc46161b3fda7a2299173496d73b812139556e8b4eb318078b9eb2ae5046e83b79dd3d45950
AD: 5557b08a5010cbc9f46bb140c2505f68684eb24889324bff44b27234fd7a95a99cfb4ff90a8f9982085b725f78ac42eca6ce7f3314e457dc41f404008681a9d29ba765660de2e05bb679d65b81f5e797d8417b94eb9aabbd0576b5c57f86eae25f6050a7918e4c8021a85b47f7a83b4c8446898441c5cc4e0229776ef3e809cb085d71f3c75ec03378730cb066150f07e60f96aec983c0e7e72bf6bf87ae42228dfda195f97855fcdf4e6d1c4479d978abcfa276d16ed60ecbfbfc664041335ce65a40a2ca3424df
CT: a5c8cf42287d4760fca755e2111817b981c47e85b0047de270ec301ca5f7b3679f4749210892b6ea6568f3a6a4344734a0efc0120ffedecf212d55cbcbb67815ac964875af45f735b70092a8f8435f52fc01b981ae971d486026fb69a9c3927acfe1f2eab0340ae95f8dbee41b2548e400805ece191db5fd1f0804053f1dbfaf7f8d6fded3874cb92d99a2729d3faaa60522060cf0b8101b463b3eb35b380fcddb6406c027d73fe701a5090c8dd531c203ce979e26b9ced3431e2b726a7244a20d9377bd62951bf5
TAG: 82c6194de4d27aac4c54b023b9831634

KEY: 934fd043c32d16a88fad01c3506469b077cb79d258b5664fa55ad8521afdcaa2
NONCE: 00000000c7091f6afbbeb360
IN: 2bdd1fc4f011ef97ea52ec643819941c7e0fb39023c2f3c7683804a0ddee14a5d1784a5246966d533b3538edc7d8742d27061c3cab88df0318ab242102de3a54d03632eeb871b72c7e8f8065b49f4a91e95e15f3f46b29fd76b8fcea0d23570c5530e3bbb8a6aafa9ae32c1b3eac653c5ed5fdb2da5a986075808f6385870c85b1913e26042a9d8e78f5bc2ea6de5a64f8aeafa22adcffc7f6932d543c29bb3a04614783f948680e433a71573568d2ce984d249fb4fc06a9f358c76aa3e64a357f4eae924c1356bd5baccf7e0f
AD: f737dd85638eb324dd3891219c5eef7c2dd053cfd055d447a411eba304a4b27dce981d112c4540590933c153d603022c91ebd2b4a58069d27e6ca17a462ef822ca41bffa80b43a68b1b564644cb3c5a7f0fddf7a13a30ff24437fddd8ef93c6f6f205d054f81890d982bd4d4ece0b1563677e843fe48c1f54e9a57ed4da66061482712e710a401073be5080d5b8b96525bffa67de5af31d50385fbbf1a87c21bf0e0a1fdff69ec32c7b7103e0b8ee6c844245e0fc84b9f89fcce62966cea68e2871d3b82e8df424c76309fc88d
CT: dd13fbf22c8d18354d774bcd18f7eb814e9b528e9e424abc4e3f2463195e8018576565d16ab48845d11c9277f2865ebb4dc412fd5b27078f8325eadf971e6944c66542e34d9dda971e2aba70dbd3e94a1e638d521477a027776b52acf90520ca229ebc760b73128879475d1cbe1f70fc598b549cd92d8a9ac6833e500c138c56474db84cb3d70b7aa4f293a4c2b4d818b0ff9fd85918dc590a12a8c0e375c4d98b7fc87596547eb960676aad5559834588f00f251a9d53f95c47af4df3c4299175d5211779c148cfc988a5e9d9
TAG: aeb0a4eb29886f0a7a12ec0516bd4af5

KEY: f9f6eb9ad736a8f66e7459fef5ec2890188dc26baf34a95f6f0384e79f5c6559
NONCE: 000000007858dfc084fe4b0f
IN: a644ca6e7cc076e87eb2929fd257693fce0f6fb64fd632f7f07c648ebd03696c8e262e6a810d7b7c4e5eef8c65b5323c99dbba50a70b4a9e5c2a9e7315973cd67f35d8052ce9a85a206416dd3031929f4f929b13d0a5fb10cb73c65f6c0ace019da146b51c5274a099f44e3669d26add6f2ff081e886f3cf952fe0dbbe6b0534c23e307574bd35fbd657f5fcbd5dc19fb382a1dc0a2dc8285a0350f71554e4c601497749e35567dd4a273cddc9a48ce53a5f1d297fd8baf8d1b9feb35d9151114345abada4d90db947bb9a743c175f5653d1
AD: 2048d1c2ddfb5ec385b201832c7a993f229ba72ec16d6ebf723ef0c5032b9966209a9e8a63151b40412e96b82f86728ea6588c7e8e11ac71cc8eabab8c4b54de866658d9c5011def61fb3dbe4e630158a45ea41a2ed55ebd1efb1abeda7637de6fa5fd2f151c6d2f385bf6cd002ca8b4a2896e0d65944ee913e3c784669dd201b1985ef3577f7f123a5f9bcffa176c8f557c4f729133cac518642f27d9b22ca9b97faaafe5b669a10b79ace4a7d5727df146c77ce681357d69f9c2d65b4401bd73cd113387e3b3a05d897adad7a24c485e7b
CT: 4146faffd7313f5d9f625370d20413cc62ab65f4acfa3c7ee1125b937dd7a39f638fc46c8ed004fb525698de5d8620ec153435571817c3de257b0d0e648ebb92940c86a98262d54e764f28cbdd4f7d9bea970291f2110414f62064d7229c6332236c507b3dac742e651d85a2a22fb243c0cc7cc2d016e5bea38f33f9a9ce048944a5fe8b078d71d23168e12dfe5a0f0b829771edc7073fb96032b7be471337a37aca0cf7c0cdd543eed686cd34934717fd79a3f18492eef72f9f450b880aa7e2e1b65e3b04c22e72301338b43aa32ceec2e6
TAG: 61c6d4d6918b04fc1b72a7a0e9a3b799

KEY: 29b19636cdd32507fd98ec4ee26caab1a917646fb8f05b0dc01728a9f4a127f0
NONCE: 0000000006699d245916686d
IN: 5fdf913aceab1d6dbaf7d9a29352fa8a3eb22718043a79cffa2fe8c35c820aec7c07644b8785dcf7a433b4189abb257fb12b06fae0662641011a069873c3e3c5ccc78e7358184a62c2005c44b8a92254958eb5ff460d73cd80284d6daba22c3faba046c5426fe8b7cacec64b235a8f8d3e2641e5bc378830594bcfb27c177aea745951ee5780a63705727ef42c4ad3abf556d88e3830f3db6b09e93edd09485cbf907f79de61f8dc5cb5fb7665ffa0ef53cb48702f6a81d8ad421cef20c1dbdf402b8fafed56a5361b2f93f914a2380fdd0557faf1f4de
AD: 39116c49cc13adb065b92cb7635f73d5f6bf6b5ccbf72a3f65a5df6bd4a661105015358d9e69f42e98aed795e8161282bc113058b7ef3b9e23fcd8eeab34a392e03f4d6329c112cb968385ec52a7afc98bb8695785af6b27b700973cc952630b7247ce226b4fbb99b8a486370bf6345d4516c52c64e33f407c4f2d1ba90545c88732d98bbd97972ac5e94c694624a9b3782b0099824651cb7567914d25b3e13181a791dbcd40e76e836b3350d310a52151bf835d3c357c9871482c2928e8404c6e533406d4d6fa8f63366f2c4ed828141f1ff00f01a536
CT: 01e237220b619054a1f3670928fe67d40484b5af40fbd04d032500aac5acaa3b4584dd99a58c390627636a50de5d744f76a56a33205f9e3b00e16162eb47ff3333e1e208ca200f1a5338a86e17bd92dd2d16af8bb022a7dc05b923d019e05247f1a0d0b4bfcfce58dd6d83830705707676d55739abee89fcd5cb94b8fde006a5da02df64b00a467f45970b5ca440f22319b9735a55d454b9fba0588fef0c59d3d83823eba6e0601a96e10233826c5adeea6b2a51d386a07a9e047ad405b23d4c3d89f30c31e3199f0c8f927bfac43ceea1f969de0a8c0f
TAG: b9fec6da464c7b85b2a4726694562fe9

KEY: bae06b9b5456707551c7b0e207aae02a19b4848ad8ca4ce40705bf8c856a6e52
NONCE: 000000009c27065c3ef2d522
IN: 50cdd88137ff428a88e87b5845be4924f6387537bb5c0b654c80107ab5698db75b2e131848e7aec156d31aed0766d31c379fece4095d38264c6d5945974d25f729c3b0ba11ea853e9cebdb6f03bb670fce08adff74d0a8f02d633fb34e0fb7337a8e66e1c12084d914fb6173b8105684db822752c6751a372bb16690284d661b8b8bc6a6dfbddf45ebc2219596f9f2f878c118df69030de38b4d99dde43b9b9e20a3dab691645dd518342f49b06a0fe0a397adf261e99f07af5b0b3798b1022ba0939c42a54d3b93641cffa3c2e174bce9ab7ad7e7c7924308d1a77a
AD: 5d5590db1bd316eb7a0e30e4c7a6dfdbef9d3287fdb8d824389599c3c2ee262b2192eb5b9708e66e22dbc7eca83fa1a995da3ce64c86fe5aa08b826d476dc439497e2d12e2702c63c8d27aa7f09fedee816dc8bffe1351d53271a34d4292b613b7efcedb7e3cf3e6ad389eef12471e9e20e38e7ae22a323abbadfe8f2e84271bffb1819feb4f77b82843cb8757cfae293631bc6d39669107e7015c85d7343ffa6fc1bbe6f5ab4de30cd752a281e03061ea89de2a3f5e90e20da22fd6e8525c100738667f42212b2cf45fcb23bbb54b21c117484b22c6e514685314df
CT: 66b7f69ac49fab4e5975aeb6fa9287d8eac02ac312c4de78f77f59da16cbcf87274e66801c4b862c33ea79cdc76528862bb2956c06db8b8acfac4794ebf39e35ac03cc73a4351a4ff762f681a48d6f25cad36e2814c9b5c40b9ae92509e58429106847789454d376836936bebc7a80e6c66e7aa52936d6b361378a41f849ad4e48f9ee2d3e92217a908fa8eb35736ac8ada7d32ae05391f2d807be3512543c36138a5fe660dd4cd4cd184bb43b6ba6bc0bae634e2fa9669304cd510ed5103f630068ff76d3375738de60a381842b421477e25a490cdd6894b2704125
TAG: 94118ccc68de1921d480aab43d1ef0d1

KEY: 2cb374cb048c168f2e43597f028d9e73cade1b458284ffc260d4fc6b9011c414
NONCE: 000000009fb909169bc9f4e9
IN: 39eb929482784b463546f5d84f80510f2019923d465b99d194246d68c7ae343f91971d8f7059cebb86aa5dd099289aa648248b8c5ca04e66ac5e9bf06776e3883495397618a0227f035666806e636836b47d3d2d255a49db79866cf00d9ddabda259c4f968a1e01e651c7811cebbee2ee71803ea1d9d23487eb221f2d9555756800aba5e6abbefd6fb72b3151cc99ced599cd86df2a9b1ce94f89f347eeb124d9e7f0d9cc48d3dedd819e6d3dbac57ecee199547b266116a2035c9acc4c8ca3271ac74952372897c4a5f2cb84e2d81817fec9d6774f6d8a5b2021684132db4fca3
AD: 0c7bd4f3a30ee944ccf9489181e6911684dcffad4593a9b65a67dfc80718c69b35897d01281016b7731e12c15cad8482e79458e08a755622e3f3f22a23ef6c8487a36ad1771ba06c641f06f85de0db3776cc6df06ad8fe3b4d60d58508de943083f17cbb9dc0d390ac94d8429e8c6fcfe063f424fbde0f62f6a7f91a626d195dc498a6e69bd93109c4e9ba13e7330aba456d710a4b0cc279d4045660406e26d61dff70d4a33c4f1052869f9248024e7a0f85f1effb32f6f7ccb1f860f3ef04e8f7b29096e6bcf9d4b3e0ce703e9bf228fdf515c2ff9cbabd16987be0f9babd3d8a
CT: 91ddadb86b7ebef798ddaa59da51d71316fcf6c9678143178227d778750dc9827fc6cc21e605c505023e6db25849df7fb6fc1ca4d223aa215f8c85b724643c83bf8218815a9f9e2952384e0ca6a80a3760b39daf91a3c6154c4728c2371fd181fa3764753d0b0c23808a82cd8f0497246e3a0f17f8906a07c725d2891ce968a9d432c2b102d85c05510b28e715bb60d0403a77490e7f18be81218bc4f39287b9bb09f50227dd2f55e4fb70c4438da8ba3c8ffbced87d90155913faa9979fc57e6cbeddfaba3d3ab4163c0eebc7d94279c27d3ed56338893dba542eaefba30f8c3b
TAG: 8980e8e4fe796428b733f4f8e1954a45

KEY: f0f16b6f12b3840bbd1c4a6a0811eef237f1521b45de9986daec9f28fca6485c
NONCE: 000000007ac93e754e290323
IN: 0530556424d823f90a7f1c524c4baa706aad2807e289e9479301e3e7a71f2a5e14e6232ea785f339c669af2e6d25f1d5a261096a548d23864945c3a589b67b09b0304a784d61b42b2419139485242e0d51fcbe9e8fed996d214de8717e6a71f8987ccad65eb92e66707034a5ae38e6486e26eb4374c565aad5df949dab209f7f7bcd8eb6fc52761a26cfe5d01fd349e59f4042e6dbe6b232f9301b971dee121d8aa1e62d40f043a42f3aa859d867eb809b1ced5ae1ec62cacf94a69fafd0631a8b5dfd66d855900fb295eec90ae5fcbf77beae267a79d24081bb322d8c4e0630fed252541b36
AD: 13bfcc17b810099cda31ca53a1323db9b07633ceb2088a42263a4cbd6a4d47978776005c9a20203319c3a3ae434e9a26fb541047dc9df38dc36c095267272e203d0b24d119a70a7e96041b6d82b7c4d5570e1e4a1cf2f6e44ae63fe005a1f5b900778c482f7bd89e2e02305e35b8f61b7bb2c78a13aebfce0145d1c5aa0bf1d10d23616d5a3a446de550302f56f81dc56fe4f3700f14242688d9b92d8a427979b403c8de8c493a2cde510eaf6b285e6675b173aa0314a386b635c7577d5aff0d868a0cb3f73c8d2005f8c7c9dab5a060ef80102c9d4a4af988838afe87aff04c0689e8c3c7f9
CT: 2c14c3931e98e84507c4c165c2ed47ad4a178f0e216cd7ac2453bbbf9f85dd06bd8ef54a9ff1fd3dd8e0cafb635d8f2de861a0db5b14d03f17aaea8c89b3010797c71c13a0e666899d7ff6e53c4f08be8ddb3e37688b5afa088079b6c7519b833e16560073e699530302028a3496e05edddec01a23a4c7983956250e8d9e616f7b940856955cde81c1efabf6b7b92f153d03f4cd17e7f7d2907670cfc84d45c1d7936775a3fce47968504278ffaecacea0871b227f250e2979516f6fa310fec0d8df1af7872e5a534e82870aa05f43ef0a455846b93ce938064fa33e92de262e4156dae56775
TAG: 16c972829819b8fb030b2c5f40dab717

KEY: 3792943c0396f1840496917ce8ad89608385007e796febeea3805f3f4cbeccf7
NONCE: 0000000023b2f9068b2c4c85
IN: be6b67eb943ee7b5c785cd882f653e73a8f75b4a41a2a7c56ae5a10f729caf39948fe48ad0e51240e2e7aa43193c7ec6ce7f4909fc94c9f99e38e6a0ad7e98eb29c5c2e61c99e9cbe890f154185cec213a74725d23c1a4e4d0cb9b1a36b78c87e5eee20d2aa29aae80d4759eb0c51c5dc3a95bdbbf7e14eb434419a6c88a954ac03d0c98739f4211b8732acd71c297f578b8cb64ccac45f7235ddc7f2a3f5f997525c1ed39dc550126cdf9cedaf55425489085e91b170be6205a5a395f2dd4084a3e8dbc4fd8b13252f7effae067b571cb94a1e54aba45b1b9841308db0cc75b03cfce4ddafe89ce20f2d1
AD: 7eb6d7b7bbaaa3c202a4f0f1de2263767169eb4a64853240d48c0f8d5d31b08d5baf42977614a57aad99426cde76d242cb37d2956d8c77dc4fd62a3abf30e8ac6cd58c8ef35e67497022960138c57787818892460f3bfc16e37ff388b1edc6ce2bc53c22717edc7a03d4c78b0dbbe9121c7fd8a3e3993b87a4fe389bff13bdae3b349de0b6db561602c53f746022aeb4483c723b67825042f4af20b7dd1e6031cf54215266295c524ac8e1370424c5c5e607fb3e23e97c8eebe64656775edf616422a8b974e1acf13ab45c9a367a7dd9b2d62f48bbc05819b65eccb813ca813f57b22ee4c280dbb5a9d8d5
CT: 0b316ab2bcf5359900fa4082d5d253b49ad94b70e3fab544f98bd111cbcef6766cf953deec08cae1f489fe12f7acc0032db8a6b0c0eee0c206ea5fb973feaebf90f690e840094db5e13fdd7157ba127368c995b426529435a1bcdd1f14ce9125b8a0e4c96b6ec09e3c36a180adf81941c002d19c19d53c2009be803b987504606b7d43bdee5e0b32ff23c466b6cccfcd0d4e88fd1332e73712b5ab725c1a383e584f34f80daff29d285ae5e43cf1d0cc7a828e75c25daced3a581a93d7a50f313b33f38dddfaa23cd5b9914797db820ee2400d52bf5fa982277fe9b5881ac42981633b3957b0e935051828
TAG: c549aa944d6d97e52e0793ed572682c0

KEY: fe4be6054773f634356ac328591fbc6f833b0d1beeb38dd5b6feb7481b4489d4
NONCE: 000000000b3f16f898a5a7d5
IN: 76ced1ade6d1ef4069afddb32e7432d4ff2fd06685121f7b16464e7a72d365744f547d2ccf53486310e38b42d8bacaf711e54c5458d2d68c4dbcc8de31ab6732f4430e88a64565f5b287640775aaa2af1cc461d3e415bb275c6246b1b58517aa72667eae291a2982eda175d1b22c5a58e6fec2b3743d55712f201ca24ba5c0ae8c25724871b2ec2fb914a8da5a52670ab9b43a83b8568ce74db5c634061cb80530c8070c38b8f48c33ba136cb9f2158ee7eda8b65f2192fc94d1291f182f101795b7190c74b319d2d3e02a97c824d9c9471a83797e4936310b207e3a1e0bcf75f7c3e3ee48a747641cdc4377f2d55082
AD: 834cd775cbefe4b33a3ca53a00c06a3c4a666983e4115a029f15729460daa45d1505e95172d3695625a186b28b8be173a925af04665f209267b3c5123e8be13da447ee1ae856bb0925f35aaa76e04a7bca8460f76c2024de2149f38a8cfba81694b854885d72568105571b6b213a0bc188a44cc7fe13153cbf261401b238cf12a95e23cb56f240114f16e2f1e3a514615aab4449c0c49e4d900b0e17d1a8dabb53d43dca32fa052d576b73dd9b40856b515d6d7efc2a5c17e0ebcb17bd59dc86f22ce909301a2652f134e82ef0e4519487ed12d51536024f2ae8f75d937c42d003076e5dea8de0c684cda1f34253d8fc
CT: f8defb6fe95dfec499b909996a1f75a198a90e4d6c6464d00a357a555311c42fe92dbbc4b79c935e4f0b1a95e44fdbc1380bebabca28db4dd0d2870daaafc38ef27908c3509e945714801cc51f1a07b2430c74fa64f2a7c2f7fd1551d258c9c3be020873fc1bf19f33ab6c660911dcf2317195d0efee82d20ec26d22611f9cf86c51a64e28b3a1f344500018e0855c88dae3c07acaeaa10b60388484dce93e16e6e1a6e69e899806648a92568c8780e9f4baacd98cbb353ac2f908e775d92303cfab843f15be0e0c322a958802fb1a60fcc7631f151f4c2b8cb965d2d296acef250275a2fecc0cea803ce7c058b12dd2
TAG: baf9a51180f172e5c0cc2c946ce55055

KEY: a288b11ce5382ec724ce4ab2d7efa8e777e91ebd04367935e15f9dac483e9596
NONCE: 00000000874144dbf648b325
IN: 4c9195280a79a509919af4947e9e07231695fd7c5088539f23936ce88770ce07d9ad3ae4a463b3a57d0634d3a77ceaadf347a334682b04be8e58b8e86fb94a1f93255132b8cdb0df86f5bea354eea4e8315fea83e3fdf6e58aa9f26e93caa08e5e2551a94bd916a51fed29ec16f66800cda6a0aa24ec308bf5fb885afba272685de27c1edcdd3668048ef07b06e90d464a8aa28664903cac45e154e8e1e39c257e1ff506b9d95cef4f300bb73b899e7828602c3c1d290b8cf55ee5fd72ecce9e6efc9293aebf674a70e2a7673e75629c12950622dff71d3ec0992e57776c788c6927d30b4e24b749191c3ce8017f0ada6276e43720
AD: 04abe8588c8c8c39a182092e5e7840442bd1c1149da102c4ee412bd8b82baa5087ef7291b5cd077c177c42770b0023e0e462b06e7553f191bcb0315a34918dcdbffe2b99c3e011b4220cc1775debcc0db55fa60df9b52234f3d3fa9606508badc26f30b47cdb4f1c0f4708d417b6853e66c2f1f67f6200daf760ceb64ffc43db27f057ad3ee973e31d7e5d5deb050315c1c687980c0c148ee1a492d47acfcd6132334176c11258c89b19ba02e6acc55d852f87b6a2169ed34a6147caa60906ac8c0813c0f05522af7b7f0faddb4bc297405e28ecf5a0f6aac6258422d29cfe250d61402840f3c27d0ce39b3e2d5f1e520541d2965e
CT: 0afce770a12f15d67ac104ba0640aab95922390607473cbda71321156a5559906be933fb0980da56f27e89796eaa1054f5aacf1668d9f273cc69071b9e8e22af6a205a6a88f7ad918e22f616bddbb07c78913c7e056e769e6fcf91c7600c2740212e3a176e4110cac9e361a59a773457064d2dc652dd115d04f1c3756c0e1d39f6737a16b4508663e310934c49c58058b3c7b9af7bb2334c8a163608c42499658986927cda365e2aead3ac29de16e47e954383ea566f8fb245a4e5a934c767bb3bf7e0eb8a477fd0e1f61bcb238462a0d19c5cea9293ca58ade76829413216a7882cd2846323046694f78cd8b0347792ebb75abdc1
TAG: eb9b2ee43e9a3ae1e33561800169d868

KEY: 65b63ed53750c88c508c44881ae59e6fff69c66288f3c14cfec503391262cafc
NONCE: 000000007f5e560a1de434ba
IN: 845ef27b6615fb699d37971db6b597930a7ef1e6f90054791eb04ddfe7252b5f88fd60eba5af469bc09661c0987a496fa540621afeec51bebda786826800943d977039dee76235248112ff8b743f25ed5f3cb0d3307f5e118d84fdbb9c3f5531bc177fb84549c994ea4496c65e5249da987dd755d46dc1788f582410266a10f291c1474f732183a2a39afe603771bb9c423fe3e8906f2be44a0c9a7c3f0ceb09d1d0f92d942383a875c0567c7869f045e56dd1a4d6e90c58d44fe0c5760bb4fd01de55439db52b56831e5a26a47de14249453a4f8e7da3cb3282c6622916197ebfaad85dd65c61e7d2d3ba626276366746f396394c1bf75f51ce
AD: 51a3588398808e1d6a98505c6e5601ae2a2766f1f28f8f69d1ccbcad18038c157b41525be58ae4527a073748b7a04809e52a5df0c7988417607738e63d7ead47db795a346b04e740186e73ccad79f725b58ee22dc6e30d1f0a218eda1791e2229b253d4ab2b963a43e12318c8b0785c20fca3abcf220c08745d9f9602f0ece544a05736d76b12d249699c9e3e99f3f13cf4e5dc13a04125c949a5b30d034b23cb364c8781964bc6c30e5e5ca9673d517ef5f35965d8a8cf1be017e343df97b6bee37b30638b154286d1f36d2f9a0eaa23cc484eac5a05b15d9efc537d989dbc8b3106c0dc1a56e97e6aec2eff54a82cf7ae9df2af46b4c860f83
CT: 027b14197b4012256b133b78ddc94e72fb4d724fefa4ae329f5a5fa3fa784fe6d7e1e805e3f7a75557de64de506d38237b467fa577efb59e7cfe2356bed6655c5aa4e238dcfeb75c16549a0917268768a96acb5e20546a1fb7e3a7cff887f49f2cd7a135f72a98a779150f3207bf733e88861fd79eadbf77fa3bfe97bfe8b6a991cb3bcc2cde8287f7e89384846561934b0f3e05e0646e0e1907770df67a7594161a4d0763faa6fa844080932159999d528ee0558710058ce16f97d13ac9fd9bf5044191188bbfb598d0fafbdf790b61ce0781ecc04218a30ded45efd498cc9ba03562ed2b4a993ee98876b3ab7a9bc07829f1c4ca6ead98c06b
TAG: e0bf9b6837428843f5a233ee5ddb8a1e

KEY: 4986fd62d6cb86b2eaf219174bec681bebcdef86c8be291f27d3e5dc69e2feba
NONCE: 00000000d08d486620ed2e84
IN: 3a22ad5de387db4fdd5d62a1b728c23a8dddc50b1e89f54f6198b90499f9da3122ebeb38ebf5fdfe30309734f79aff01e3de1e196b35bffa33bae451f31f74b8aec03763f9e0861a34fe5db0b40c76e57c7fc582bfa19c94ee25b5e168270f379bf9f8a0a18bed05de256f8f0dd7c23ba2ff1c7f721409462f04cc611ad9bd4c3c9acf30742acfb9518a6375cbb15d65a1bc6993ea434894f93d4f6e05996ebc1bd56579296309a2c6b8fde95072168b5fd31927c4c0abaa056bcd16221d5f220be47591f43255013a262dce439817f534830ba82155347e5fe3101f8011b89365a6568214ed0661914e8cb3431d6c8f2347dfc1209a3eca4aaf0a111f47fe
AD: 7dd3f656a03c001b45ca0680bc3ac9d68c6e96b591d3c69eb8c65e489009d845cb331c98b82e627e06d5bf01e74c573df268c2386f12628c019951d42f55991ff20d72a7b2c45f41d0be7af428c92f324aaab8df70d900301cdf09a3d93eb711c919d34a86fff9cb078322ee2e0ad48dbdf3b7884f0f2dc5c36262c59bcfd75ac6200f59c6fcd0ce10ff5005fef5df8f0432377dfbfc1db8f559e27e1aeef3380ea3864867d36a25a18654779a751586cad3b8a46b90864ee697b08605673b8d2123433c020a21c4db243dde2420c12fd4d54a2704a0c8c376454a1b5e80fd6db89aabd56d9b421f29649e474824dfa56cb5c673c504d10be52b53751709fe
CT: c40180afd53001663ff4834110f56e6b0f178cd3c0e7f7de5d0089ee41d8403ffb98e84922706544a344d7e2625b12cf66b9c966f9f57d7b94e3e4b34e6f0aaed1763ce012782e2f5e1682e6c343fc7961fedddd0919d0b910e9923c17e36406979b256b85aec24ee352f03b48c1302eab419c83dccc5372cc059e9de596224fa70098eb32fc9579e97917b923914fa2efc30ab29b457bf14e45583b3771486bdc0876f3ea6e1a646746c4f8c5cb2641a1557c8473e6ea67d4811a67485ae9a678ff3a2408ca845c3b51957e189eef47dfc1d46bde4b9d754d7df13f828ddadb06e4ebddb5f0dafbdb28de4c5e6078926f20cdf9e97ecd58e309e640f74f06
TAG: 2e8eb9ff4467c0f61c2abf6ca10893ef

KEY: 7d28a60810e43d3dfa32e97c07957ec069fc80cc6a50061830aa29b3aa777dfc
NONCE: 0000000047738ac8f10f2c3a
IN: b50278ae0f0fa2f918bb9a5ed3a0797c328e452974d33cbf26a1e213aa20c03d0d89490869754abf84dbbe231d7bccdced77d53fd4527356d8e02b681fc89a535ae87308bf7fbc26197a5ea85bdb3aa033b8da5cd197ea6d72f96f63b03f4ecc7adedf399a5043776cdb32c08f30b77f34df85f8adb8e02649a04b020b03e17d445ca63e4ed73ae432c481392e031eba2f9d2f7f981d1e50917822bd6ff71c239d33444ada3523a59dfbce5457eadec1ab926c9e6c5299c7521e3f204b96901a712504fcc782e8cea80ba12a7f7e71cec3d0871899b6ca059061da037715f7d13fed01c9cade1e687b4fbb1f4ac4b040db3b43800f112fb900e4f772d61b921cbce4da6f
AD: 324292813b7df15bc070cc5d8a4bf74ead036430be63abc43304cf653959a24a91c7de5a671c50fa8a87e21bb82b069999aadfb6895d8bda4c3083d17b8ca55b9ab1511ed8c4b39d8c28c11a22ef90c08a983e3fe2d988df9e02b16a20b24f39ddb28429625f511db08298c4dc321f6c268fc836a6191df6232f51c463a397a8d8b33374abe94e62c0f5c322387e1fc4a1c1980a04a1a3c2c31b32f183a11c3268c6dca521149dc16af120a78be6627210e8ddbc44472bc24d66ce3681c7579b3d9a425212a704a4f5105cb80f0d18ee860953d10b59c114826779bbc368d7a0eece9f223e47cd8e5fd453607d101d9d9c2bd9a658d6520b87d7b4263f6d845a524a36e4
CT: 2c217e969c04740a1acfa30117eb5b32dc573df3354f4cc3bf8f696ff905f1e640f3b2c250473b376622e0c9bda13b94640521be1ef0fc660b4c10dbe2bfc093030753e04f6aaecf813b43b61f960455974b8bb8a9b461d1e8fd3802315e863c00448f24dd38deb90e135493274eb14ccbde15c50dcad734ed815a806be6622492a84cd062e3ba567b909a205a1d0d2bedd40169697d261c7b6c2e0b1f069853fd470e8f364a142c386c439a6dbe192ded5a3d0fbf73799f588c59e58c60249d980ddcf0d9693631cd9b3f972509c3a77123d38d9e267ecad06e1208e3f1c0a69fbca7c3bb1a48fda19493d0f8f48398820057b94120f3ef97d87e9e8a1b301a2534c68f
TAG: ce507bdb0c71f8e89f5078495f7995b8

KEY: a76e9b916f5a67b78a5949651c8c3a9741a1bc3c41cdf85fd2c8f3e9a0616098
NONCE: 000000000808da8292dc14e0
IN: 9c149eeb09345c3c22462b03e49eb4dba6bc98b269b1086d752bcd8eea53b8977b238a04a994baf915591686baab90b79a3bf7d9adb2c6c2e31acd3e72f0813fb745aa5fb2e3da408f78001c9c09bd26a1a2646011b6120aaa2bbacc4a16c39fb5257b9b2ea2ad8bf70bcc9855cf11841116c2767310cf3cd49d1aa44cd505f079761e064d5bc7cea4a7173b086882a77d3fc179efc86fc4db8a373491d2ed81eabc63c950e832db17d09f474d4ec46bde47830caf26fabaa0372b81fccc449c0e19ccd630caf693a7b43bb1c408a54e03f50c44280a05ad89fb6e8f01d8ac278edf556e5d86ceb4b614fb2ef133819c6e1ff6abb86c54a135256204b5cd400b93624d3932e7c2b046
AD: 6aeb7031e4a2e23eea93f05fdc562aa2bf43b8998bea7344377aaddc60fbdb7bcb1491d379ed0cb613ee757cfb66490db61bb431d2fad34b38ddd55bc5b22aa6c4773b9992f34b878c5663f6e8cdb5f80a17f4d312bf342492e48d1ce4c6d754076a634fece61500acf8168d47381af4faf980c6cac2bfd5da8c09b6edb0f543bf0fe02643e38d73fa37d8ae87fb66193f22e57faf4393c007d48c8631a685d520578f8f89db684fb371ea02f3a58b1e2168f0216321139472e0d03b6d90ba8aab65402e1c1ac4f9172a60e27e3d997b9b05e2f672120d6c87bcafa6d4c9b4cf8ba8a82932d92840368fc53dc5b48526103dcab5f1531038aabe89171327ac559b98a3cf4ea70bf051
CT: 9c3faab9261a63cea9477b3269007283995b06ba77ef83d9e693f7e4ee9855550eef94855be39a7a435b6a3584b202973777c7b2482376ba47b49311947a64983b60236756ee4455d4cfada8c36af8eb06b06ba2f6b79ffb1185c89f2b2a831cfaa3855fc1841d8910908be5078352011168a67d36372d851a3217cabf593ea462dcd325cf9a4f67e85418fd5c924e9b92ab026cbee4e7ab1067066cb5949dfc699a68fe539e1abb13cec33904e5207e6963d24f5a0b770613b8b00014e791bfff88f9c25ca126127a2f8d1d1e9794efd28dce98b53e228073faae8d5047530d502184fc341321c3f55fcbf41187fc31262c325b97f519959b6a29b36c71f76f60196bb1457b77c8bb
TAG: 73b00b1705602479aab944dcc1b282a2

KEY: 98cd2477a7a072c69f375b88d09ed9d7b9c3df3f87e36ce621726f76e3b41a1d
NONCE: 0000000077d185aaf715aa48
IN: 42b31eefdacab0f03ef6060156000c8195adb0976cabbe1a42bfcc09f85659c60b98638401f2d2e2facfb9a97a62926bb0cecaf3af0180a01bfb6e576babf7fc43331937a92abd30cddfa3e450f895e9dd914dea3fafd759c136d685310ebce28ac0613ccdbf30115946c9634b67510b77d0e37f07714b2ddac9d7095b8d4bd887c132c4a9127eb01c8dedb4c39c87b98a741316656f9a8d5a5b0c0ac84789aa2347a5f99ca5ad55cd1bcf98f703eb4b00badb8a8555f38b3b368db8ba7ceea94e8b219f51edce75d84166b5602156ed5962a93a51db73c59d87e906179d7a74a2a2a69d8ad99f323225c87e475d3f771b4a203a2e2b03b458401044649fa6536dfab24d7037807dcbf6518e6578
AD: f5bb1496052a4361dddf72a288e36953a3d815d6876c013f1d6ba839e127f721b052b1f7d8ca20c7dc0386a7d459ebd7eb9fc8cb08941e6ca9ddb980f3115f65bc1928a414d441ae71dcb879d5bfe0cde0562bc37f8fde0d5291ad405c92fcbb860c43b55ac0fe663b54b3d0616aca13a5c82b7b5d34125a05c2acb5530141030e6f2aa0c8322b2c8fa307e7518918e550e9f48921c6168f094d8758e16b9f815fd0458095c4143f0922adb1840d0e685636825a9c90ee90ee537f4b8dceecbc4287c82dc9a00d7e51671e37ea284ee3ca501b1b2596459d3f592f70186f41125739e342c9f6be9241973b1414dfe5fb8cba1af82e679278cfcf95420df0c5364af4d7e72ad57d5c871fcbc35462
CT: 7a3bf3e3ad5ae3ab71fb1f7121c3d8fb511099484b50af7ca128ee0337ed4b828dc4cde0b88dc1e8089101fa82c9beb3eb48fdcf0f5b16da441f5a3fce9a590022af95a94aed6a3e71e505f60f303c78c356f274ea85a55354078530664ecda32c80e77dc20974b3b38f4825b8fbee8c3970769a2f42c5181608a8d7d76ef4d093961b665ee42b9708fcafe2c82d3a307173e2a25ad2528c3bf83352b9265e45b70722d7cf8c9b80826d21335234ee3db69d0d37871c83222365900c96c17a7e9f5742d0bfe383be24d0d44590d4b0f29f7abe0c65daaffb968b3f2657b1eb300534eacb52ec7a6b6f9f57a50a91b1799f491361cf613c934b7f520dc4eeeb40ffc45e10be0a95e76f366d4eac14
TAG: 69302888812eea030d621b640e7bcf7c

KEY: 2f0f4631ab1c1bcf8f3ad0559c818d50e0af7d8cd63faa357f2069f30881d9cb
NONCE: 000000007d0ced2fdb1c9173
IN: 6516ba1d29357144eebfa486d21decf223da3aa76ec29bbfcbe7f1eeaf4a847710e5080177f7e5a7c8b4752c219b1cc70aef4db861ba67d0fa6222d9f4a1dc756a0ba44e62906f9374a960c16198866d867854d88f528a60e212eb91645787e75685b2e215c0a41990abc344a77236ec0186ba63a664592938cc5a8ac1d3eb99c95ce00e19fbe249263083d85b052d48bfdffc01585dc57bb2a2c6c4a819604c1ec0548c6f0f78dc05e4418b36277dc07233c7532f9c289d6aed0cc6bc7df4fd0a536c497b982e2dad2c30d2db1c6545a845c5dfa83a4ac49ef06fc9c919079d3e299e31b5c3be370814ae5022ae469d3ee55246a41bd0dc4e64351cc38c3c09af0a1aee3b388a6892deff0df3f93cd92d722b
AD: 1ccfa1ececc8de1e200d0ecc19dcf67b7c96bea3a282c2bccba61035db5c14776387b8b8f58e5757deb0129d4e5e315f64df354a5985d2e47ebbbeafe0c914f7cf1d63dd0311ace19e69a8b6ff0ab25cc8df0408d22132205e89e5eb679268d82b2913e64e3f885bbf4a6d379b760b94590e3140dd7275ab4713cb56d0b716e2718f11316640cb394802862d39e77a46d0c065af3caf7dec14e887039d8aa8c3d3a8ac1ee06026f49d00b2f59d971b54735e95a51f199389a93a4fc24ebaba1f7a2eef7412f61febf79084fbf481afc6fb6b204084e5ef5df71f30506459dea074f11fc055cd2a8c0fc922c4811a849984352a56a15659b7d07a4cc90b88623638ea00c4c8bc13884df2237b359f2877aa41d6
CT: e580093789ba17ffb46672dc326f09278aca08598d3e5458eaa53e6ed45d5c71a396e35b5ea3fe7b7c0496a734d24f1c75420694be2ff095d5172fd3407794e4b99fd7c374fbe8d1564a048614d3f355bfb5866de1a53e1a51f9f5e8312253cfd82f36efaa1898c850ca0d975ad1e8b0d9597a5a9e6516fe2a3c92efb7495557a8afc3da15b0d3e2ba58f612519836946cf2d15b898320d16a026c8c00a1be2e35f0ebe68f28d91c6c45d24c3f3c157cb132fa659b7794df883d90741fa2d2afcc4f27858e13ecd41b154a35d24947ae7361170060c107d8ecacb393ea67104b60457278a392fdf1794bab97d3b02b71a4eb015eaa38a4b4c944c2bc7cd5e329da4a1ab2937a6af81a6caa5fce752331fdefd4
TAG: 19bbacfac768bb0ce71e39c5d4d3e9a0

KEY: a48b9b6df475e566aba7671fbd76772cb0eff0b12499967978ce3e25fac92feb
NONCE: 000000002ccbf0d6c40cb302
IN: 09da1cacd001dce4f7573a065a4406fe0da04ab367a2d87780a2762e168957a88d3fa78f0a4b6978d449026e5a801d32884b6e14fdaaaf864214f928ebc03dead081fee96683ebb032362d5088c4c2a3b1e242f055f2604919f4dd551db777a258cf9da6d95a2bde249247812b9efc7985cf08707620808524d6dd3079b0b63bf0f71ea5de834ccb8b7c6a97125fd6ca49148e866d3134bbf1d8a6b714e9a80fe549c8bfefe342f41be2ba2300e0028f78cefab65274632dfdbe70bf7d655ec4036df561f2d4fc4d56a482bbe2f9f2ae279b3aa216b39afee75e53602de319484db89a51e844f38c361634e474f8f1f01c340f3f3594860d671346449c6d08ee38de22d246309bc7e4a252a29c86aa6d94b5b4fa58904c70
AD: 1c2503d5aa1aad193f0da12874074ea0432bb76a61cd43a3017061514da0759846a0f3ae3a49fdb0b6d29f713de665beacb6568f2694112ca380d13f3c1698316866a7a7f87f1d7503a92176ab84fc08977b46ba664508a858e7525753c45511b3d2f407d5e993c6ede77f13d12975707e5195704970a89f71fc30828049f92f944f3aa93d6a5297e678e08952919beb7eac5919df1919cab3c3da6aa696a1eeab6371f310f7e81143e7d240b0213ae554524b52000306160dd4877bf13ba0f13bbe867da7c7d707f31335eef4cd942938ac890a0829ec66bd30ae01a2188a6e5ea0f17cd7dc875e17f03c0ab5dd18e36db8a1fc1f72859ee046b62368f168b3bea2234e0432c07b7d8e1b9277f21e692c513b9e816e6860
CT: 7d35cfe4be56bd6e0e09dedcd01735b915bc1891a4d1f6a541abc4bcd0ebe89dcb8e365e5813742e8ec65777b6159422fada747da99394252baf8a046fc1b60ad79755f545f4448627b7acaf403000894f5641e78d3f946dfca29ec617f0660dcd6e8d8827e67e1022a245c595d86e60fbd176bf721b171bbe5ecaf4ae671b9f3dd3920146e6ad431bd8fc431820e19454b6ca209723d80fdbee187fca9c937c979206ae97be55f6ba7366a5608770a11d537396485eb0a66586385f4d4cf3905d1fc90831c3e136d5d513fa22be285193142994a3ed477145bacdcbdd791e8b3b88b0d4f1d18b27382550a818c4fd8884bf36f677c6c3ff5677406e510911e696af75e5b3f859bef699bdd16e6215fdb98d874025eada50
TAG: 0fa4cb2bab84336409aa4349ab99a8bd

KEY: 923d4b086b9e43b986f7b65e4cea6113a3d8aabefa89323c5e4d5b6f158bb7e0
NONCE: 00000000a0f73297b87f5deb
IN: 21435e8d5c8edf0684f58c2cba4070c10b4801adf46b6c4d322eb3990a38a9ad338ad704b9df6597f3e68d66cd5b56290c8466db2231e56d6bcb9c44e1bd081f42ca2a894dad369df2bd0d2c63d6c881732d6ea22bb22b5bc9a62eaffa1b094d0845f6b966d2cb095e7b3b8bcbc15e707449d35c8df4aea30c3b7243e977fffd59c80f1c5c9af4bb5a54b9c786fbbe8d21b2b906a87a786caed841a34a3e0cc0ac3209d83c58afba19edd63622dd261532d2cfb0b49d527d8eaa0887a087f5129d897f665264b229f860363d71a88b7d49c8dc6360182b357b0662391bb41337f46010ac32b9fada2d60a2efcb99365d3b27b7ac396900d1c821d0df8b86cc9cc1f2673259a33efea610bf8e1d00d7e9db2afea21da8f58c55f799999d
AD: c853a8b39c0dc597d562f123cd221e4104b65423a062a4f4ba890ba344feb84290f61817e23330c365f58c3583ce08360d3c1171982ead5496d525ac878f23a57480a6ee39d4e65afd6268245bb982a2545fa1195427cdbbcd404cdad5198f55cce2a5a028fae435f71b15921d066e8d43766c32b2f2c3f57c0674e129607dcd3703eca529414adaee79d81fed432153cceb6f3fc53404810d8ec878f7d94be5d379d0e0e1aa9bc404b4b5d396038a9d76a5ce53c9f3759b8e50fb331858ca58cee81bfc3ee58baef5d19c402a3dc8b36370ec1ace5a4aa2527fb94b4f933a4ab8ccaaf6a5af5a779eae5667c2a24ab027e781c8d4f30c377aa5885a2fdaf6507d18cd824a847c35368b4ea984d2c3c3824a5b8ba3042e1852504a21a3
CT: f2e21052eebbb86a4f5e803360855d8632aa727dca6f5e79dd74d7aff106e442001928d113005b030f8446f8eff2ee951db663978abe43090dd5ad2c51ba97a0ecf988c607d95e486d02524f690fa3c28d5c48c1f75c1f555e7b43fe7e46f2ca2b9fdb408ec4ba18b6cdde2af673183cb7b1a3c23ae77eddd4cac75e1ea14743fc571f8d31ce2e96787524cd48aadaa474181c096a032184574ddc25a6e0ac8441c212bc36298708e33c963ae931e6c6241d1affeef7b6ef759495df44b6ab647447693cf703569e69aa72f1def9a342b8978c1edea9703a421ca75b92cac4de14b88c693200022b8a2ed22b1c4678b99f4d695e080dd1196d7168e14f0d0f8ff880d742e97b9f6d00af1f7118e10b77c5ef3ea6c52f84a20fd6ea46dc
TAG: 9bd8b7743c056bb2334833afd6143e18

KEY: df73adab2768559ea983cce85453fe81d79be3b3c57f202b31b94d6635cf2e4b
NONCE: 00000000e7a87e6bf6b5a354
IN: 0032a37abf661faa18c587fd2aa88885c061deeba81105dd221969bed5d59c7204b09b1a8c4c8de3b9f748c7fc70626ebeaca060233a57b102221b1bf0f3d9fdaaad3d2b1439c24d08f9c67f49f3c47128f92ee530abf4c4f4573bc60ae4b38109f55bca3ca9e1ba9f9fd6e34ba0d174892977a53356e1f5c88c614fe3ff3b3dd0818e7a2285412e3b37444bbe8a80942efcfd03958809a6966cda9430b2f0c9e552f4bced6e19eb3e85fc5758bd7b588297ccbed37ed94c3adc8c08ea8b058462aac9d57a939ec711bc4ecfec944d2b653b7cfc7b02a65d7057c9fdadd51b9da8cc4a3c68dae9da8b9c5319c1a2baa3d6c891c5ac4a39461484b5a01abc64df447ada24c04a4363e605eaccf339a9aa515e724206206da6d22bbd2f52e64cd7c895
AD: f833e5ab4f8bc89167f80f576b1d6b22cdd0e30721f5f735799746cf645b6eff531d4c7b03584f3dfcb73cbd35ac42736216dc7f0de098a4f42c61ceb4b227ee288e47d697a0a76afc762f084e8fdbf9351c28340c324771c109a469341ab10ca10483ed2af5e878d7d3dc2bced2f72da3d1a25852b103ee9878e8158eb4309c1ce528f3a178ace153b6d3ae0af0d577cb3cb1540489e80427f792217ad8a09b84f027fca7ceb651b4264e98e94b4cb8a37b133390897233e8ba9103628d05b9609e8552c4a4b11e3f2fa8d56af36957390e88cba44656be3edace798cf8cdf7771bac338a256bc3cba6df97728f222f423ca7c6d149c9372d66163a98f79a234b00d4b75fb2ec860dcc2d1998105e4b9c01d68f079f3e0aa21cc534047fc7b858f8
CT: b842eadfdf431c135bd6581d3eccae54e2267d8890036aa33dfe2d2d9715c44625441210a3a0d666d708d30588fe851ec36e10d8fa3584ed77b095149494b7c54379d62c8935e1d2b9a8f47e4759ad0b3437fdf2cc2fb6c5ea25ad10e0bdc9dc5b0517fc237eb783cc461c46665e2b1d1a5b8008dbf409ea2a63fea0276de23a32c99d92a498807a0f95e208fc6262321a78aafaf0cc3f833fff37bd4efa66f6023a25cdc6702cee3912799563d908a5183c9956a06aa71085d855dc7c809ed6e2889592b361ab3ab39060f8e419152187a794a19c2a1128882201900ea2cd597860674bf78d9720643df8701676718fd201baed4935a88e50558daf86edd08a9ab227ac7afae55c974b68de8dacad4a4d79b13ed6dfe74017a4cb9148e033436fb6
TAG: ee1ec36804e1d5cdbddb52608c711fd8

KEY: 55a4be2448b464c2ea52a2f2664ed6aba865c14ea1fea77f4689331fd105c8d4
NONCE: 00000000db37c0a405b4626d
IN: d266e66272e5d3462081b004cb42429c8b9741e9f678153754d726f6f9aa513464763c5e793b482fe512fece97585f1426120d4cefb3d0a8cc0a8db4bde93fc72c78f44d4fecca14650c660d3e285b327e7cdd813063e7e867b8a2d059a41bab70432b7f857199894da90dca3fe5272bae1ec694a1a07b60b05df275784d4975637e4673109f3ba846dfd1a048b202ed8e89973be608b91ee4743b1e759900f1443038951fe6189e806638985f3c16338c3c60695df58e621154d79bb973859c4558e9dca90470f77c73f004443ad5db0717abbe43266f90e57397b83ac34d1fef2e897e2483d5bcdcb627abd64b0d1aef525835f25e76d6e9158232cdde6dce970b59f58de8a98e653be32fb58edabbcefa5065d73afdf1c9c4fbf50c1022bd22bfcb98e4b422
AD: fd6a3fdd879f8880843eac20ae01c1b9dc3487d270a806572088ef2ddc1f1e0de495e71d4813bf5c501ad31e5d791c4b5b3a0a71b63fdddcc8de4b056064ef467989ecccc5d0160d403bf3a025d4892b3b1de3e062bc3581d4410f273338311eb4637529e4a680a6e4a5e26e308630a5b6d49ead6d543f8f2bf9050aa94ce091318721e1d8b96e279f34b9759b65037bec4bf6ccda6929705aeeeebe49e327e4d7a916620c9faf3765120658af34c53fbb97ec07657b3f088fcbdc401aa7949ddeda34d885018c2c23f4f0bb8218bf0d4fc90643658b4d8834f4a8c08e590c2a790995baa9e77627c342d283e454f84fcc05be15e9627a2d9be340c9d72f222bbdfc47905f56616cd9f936d49e4732f319f020513340fb8b22828db251b102b6b137c9533936d6
CT: bd11ed07b7b4b30eeaf25d6a41a549cca0a5aee71f990ac566a37265d7af2ce3c03703427ee0b2755c2bdfc29f9d826aec6ee4ad28af48079ac23db16580b97424f3a4e35cc23625d39f95699d9ff5143e9a2bc26fcfee4f125f5aa2d968ccfc2faaf9db3c28850f6757f735cbc50c94c498bcde4f23bffafa8dd5f70d1a011e35eb26e905d4e68848fedebeb197be595c085ba33f11ba8398258445051751888e9bba111f800f31b37c447074ca6dce6d54b4dfad6cee5138643d4f6ac045e8047248924e88ea4294c7878bc22c9b41924ce301f22693c33733107bf1ba85e34806c5e4366ea66fc52a5f89dd9bf213239158b3d4d2600dde696c61d76c398b9bf10de9118e812e891c8f3355c0ecc6405f79bc32a58905e37888a1d8395fbedc3ac54eca569f
TAG: 296a397d280d026fc3627f4718971be9

# Tag truncation tests.

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c2

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f3

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f37465

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a84

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a8413

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a841386

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a84138648

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a84138648a5

KEY: c66e89fbab01208f6a60847f4f34b38d27b554c119cf8d9e0b118aa7266ab865
NONCE: 000000005d9856060c54ab06
IN: f9e3e9b5ed07b2080db8c1ffc37e4a6cb3cd544608921e18610d00b17c6e
AD: 85c112a1efe0a20ef3a550526a7afbc98f6367ebbede4e703099abd78f51
CT: b5cc754f6dd19ef2d66f90e6bc9a322ddf216ef248cbe76b5ab6dd53bc36
TAG: d3f7b9c295f374651a84138648a591

Changes to jni/libressl/tests/cipher_list.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: cipher_list.c,v 1.10 2021/01/09 12:39:22 tb Exp $	*/
/*
 * Copyright (c) 2015 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: cipher_list.c,v 1.11 2022/07/07 13:11:45 tb Exp $	*/
/*
 * Copyright (c) 2015 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191




192
193
194
195
196
197
198
199
200
201
202
203
204
	int rv = 1;

	SSL_library_init();

	/* Use TLSv1.2 client to get all ciphers. */
	CHECK_GOTO((ctx = SSL_CTX_new(TLSv1_2_client_method())) != NULL);
	CHECK_GOTO((s = SSL_new(ctx)) != NULL);


	if (!ssl_bytes_to_list_alloc(s, &ciphers))
		goto err;
	if (!ssl_list_to_bytes_scsv(s, &ciphers))
		goto err;
	if (!ssl_list_to_bytes_no_scsv(s, &ciphers))
		goto err;
	if (!ssl_bytes_to_list_invalid(s, &ciphers))
		goto err;





	rv = 0;

err:
	sk_SSL_CIPHER_free(ciphers);
	SSL_CTX_free(ctx);
	SSL_free(s);

	if (!rv)
		printf("PASS %s\n", __FILE__);

	return rv;
}







>









>
>
>
>













176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
	int rv = 1;

	SSL_library_init();

	/* Use TLSv1.2 client to get all ciphers. */
	CHECK_GOTO((ctx = SSL_CTX_new(TLSv1_2_client_method())) != NULL);
	CHECK_GOTO((s = SSL_new(ctx)) != NULL);
	SSL_set_security_level(s, 2);

	if (!ssl_bytes_to_list_alloc(s, &ciphers))
		goto err;
	if (!ssl_list_to_bytes_scsv(s, &ciphers))
		goto err;
	if (!ssl_list_to_bytes_no_scsv(s, &ciphers))
		goto err;
	if (!ssl_bytes_to_list_invalid(s, &ciphers))
		goto err;

	SSL_set_security_level(s, 3);
	if (ssl_list_to_bytes_scsv(s, &ciphers))
		goto err;

	rv = 0;

err:
	sk_SSL_CIPHER_free(ciphers);
	SSL_CTX_free(ctx);
	SSL_free(s);

	if (!rv)
		printf("PASS %s\n", __FILE__);

	return rv;
}
Added jni/libressl/tests/client.pem.






































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
subject= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = Test Client Cert
issuer= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Intermediate CA
-----BEGIN CERTIFICATE-----
MIIDpTCCAo2gAwIBAgIJAPYm3GvOr5eTMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
ZWRpYXRlIENBMB4XDTE0MDUyNDE0NDUxMVoXDTI0MDQwMTE0NDUxMVowZDELMAkG
A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
RVNUSU5HIFBVUlBPU0VTIE9OTFkxGTAXBgNVBAMMEFRlc3QgQ2xpZW50IENlcnQw
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0ranbHRLcLVqN+0BzcZpY
+yOLqxzDWT1LD9eW1stC4NzXX9/DCtSIVyN7YIHdGLrIPr64IDdXXaMRzgZ2rOKs
lmHCAiFpO/ja99gGCJRxH0xwQatqAULfJVHeUhs7OEGOZc2nWifjqKvGfNTilP7D
nwi69ipQFq9oS19FmhwVHk2wg7KZGHI1qDyG04UrfCZMRitvS9+UVhPpIPjuiBi2
x3/FZIpL5gXJvvFK6xHY63oq2asyzBATntBgnP4qJFWWcvRx24wF1PnZabxuVoL2
bPnQ/KvONDrw3IdqkKhYNTul7jEcu3OlcZIMw+7DiaKJLAzKb/bBF5gm/pwW6As9
AgMBAAGjTjBMMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgXgMCwGCWCGSAGG
+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTANBgkqhkiG9w0B
AQUFAAOCAQEAJzA4KTjkjXGSC4He63yX9Br0DneGBzjAwc1H6f72uqnCs8m7jgkE
PQJFdTzQUKh97QPUuayZ2gl8XHagg+iWGy60Kw37gQ0+lumCN2sllvifhHU9R03H
bWtS4kue+yQjMbrzf3zWygMDgwvFOUAIgBpH9qGc+CdNu97INTYd0Mvz51vLlxRn
sC5aBYCWaZFnw3lWYxf9eVFRy9U+DkYFqX0LpmbDtcKP7AZGE6ZwSzaim+Cnoz1u
Cgn+QmpFXgJKMFIZ82iSZISn+JkCCGxctZX1lMvai4Wi8Y0HxW9FTFZ6KBNwwE4B
zjbN/ehBkgLlW/DWfi44DvwUHmuU6QP3cw==
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAtK2p2x0S3C1ajftAc3GaWPsji6scw1k9Sw/XltbLQuDc11/f
wwrUiFcje2CB3Ri6yD6+uCA3V12jEc4GdqzirJZhwgIhaTv42vfYBgiUcR9McEGr
agFC3yVR3lIbOzhBjmXNp1on46irxnzU4pT+w58IuvYqUBavaEtfRZocFR5NsIOy
mRhyNag8htOFK3wmTEYrb0vflFYT6SD47ogYtsd/xWSKS+YFyb7xSusR2Ot6Ktmr
MswQE57QYJz+KiRVlnL0cduMBdT52Wm8blaC9mz50PyrzjQ68NyHapCoWDU7pe4x
HLtzpXGSDMPuw4miiSwMym/2wReYJv6cFugLPQIDAQABAoIBAAZOyc9MhIwLSU4L
p4RgQvM4UVVe8/Id+3XTZ8NsXExJbWxXfIhiqGjaIfL8u4vsgRjcl+v1s/jo2/iT
KMab4o4D8gXD7UavQVDjtjb/ta79WL3SjRl2Uc9YjjMkyq6WmDNQeo2NKDdafCTB
1uzSJtLNipB8Z53ELPuHJhxX9QMHrMnuha49riQgXZ7buP9iQrHJFhImBjSzbxJx
L+TI6rkyLSf9Wi0Pd3L27Ob3QWNfNRYNSeTE+08eSRChkur5W0RuXAcuAICdQlCl
LBvWO/LmmvbzCqiDcgy/TliSb6CGGwgiNG7LJZmlkYNj8laGwalNlYZs3UrVv6NO
Br2loAECgYEA2kvCvPGj0Dg/6g7WhXDvAkEbcaL1tSeCxBbNH+6HS2UWMWvyTtCn
/bbD519QIdkvayy1QjEf32GV/UjUVmlULMLBcDy0DGjtL3+XpIhLKWDNxN1v1/ai
1oz23ZJCOgnk6K4qtFtlRS1XtynjA+rBetvYvLP9SKeFrnpzCgaA2r0CgYEA0+KX
1ACXDTNH5ySX3kMjSS9xdINf+OOw4CvPHFwbtc9aqk2HePlEsBTz5I/W3rKwXva3
NqZ/bRqVVeZB/hHKFywgdUQk2Uc5z/S7Lw70/w1HubNTXGU06Ngb6zOFAo/o/TwZ
zTP1BMIKSOB6PAZPS3l+aLO4FRIRotfFhgRHOoECgYEAmiZbqt8cJaJDB/5YYDzC
mp3tSk6gIb936Q6M5VqkMYp9pIKsxhk0N8aDCnTU+kIK6SzWBpr3/d9Ecmqmfyq7
5SvWO3KyVf0WWK9KH0abhOm2BKm2HBQvI0DB5u8sUx2/hsvOnjPYDISbZ11t0MtK
u35Zy89yMYcSsIYJjG/ROCUCgYEAgI2P9G5PNxEP5OtMwOsW84Y3Xat/hPAQFlI+
HES+AzbFGWJkeT8zL2nm95tVkFP1sggZ7Kxjz3w7cpx7GX0NkbWSE9O+T51pNASV
tN1sQ3p5M+/a+cnlqgfEGJVvc7iAcXQPa3LEi5h2yPR49QYXAgG6cifn3dDSpmwn
SUI7PQECgYEApGCIIpSRPLAEHTGmP87RBL1smurhwmy2s/pghkvUkWehtxg0sGHh
kuaqDWcskogv+QC0sVdytiLSz8G0DwcEcsHK1Fkyb8A+ayiw6jWJDo2m9+IF4Fww
1Te6jFPYDESnbhq7+TLGgHGhtwcu5cnb4vSuYXGXKupZGzoLOBbv1Zw=
-----END RSA PRIVATE KEY-----
Added jni/libressl/tests/client1-ecdsa-chain.pem.






















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
subject= CN = LibreSSL Test Client 1 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrTCCAVKgAwIBAgIJAOVssaaTYoH6MAoGCCqGSM49BAMCMC4xLDAqBgNVBAMM
I0xpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTIxMTIyNzE0
NDA0MFoXDTMxMTIyNTE0NDA0MFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBD
bGllbnQgMSBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABMnRxZ9SVIjF
eygaoub4qyo/tQlHXpQ2U66mhwKhchXD02w3viqOW0qklPSRhwV4nFKsdkVTogCg
Y8AJokxKDU6jYDBeMB0GA1UdDgQWBBTikUU9S7ASdWw7fhaYVdDqUAyH+DAfBgNV
HSMEGDAWgBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1Ud
DwEB/wQEAwIHgDAKBggqhkjOPQQDAgNJADBGAiEA+Aal+cjgT+pknsmAPbivSHY+
9clFV0Ree1c+nPbBz8cCIQCZDS2G/X8QthK7hZwV2mYhwvd6M/8kwet4u39qJYx8
eA==
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrDCCAVOgAwIBAgIJAOVssaaTYoH3MAkGByqGSM49BAEwJjEkMCIGA1UEAwwb
TGlicmVTU0wgVGVzdCBSb290IENBIEVDRFNBMB4XDTIxMTIyNzE0NDA0MFoXDTMx
MTIyNTE0NDA0MFowLjEsMCoGA1UEAwwjTGlicmVTU0wgVGVzdCBJbnRlcm1lZGlh
dGUgQ0EgRUNEU0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATWRQbJh4aHPzHq
LOAmosW/o83bTpm3Sj1VxM44StmG7c1nnFM/+gS8rp2bVSgjWZQzRtZqGVGJgzbk
7/M1m3x3o2MwYTAdBgNVHQ4EFgQUF1Y9b/xKVxI5QsoCcoGrUA3kwggwHwYDVR0j
BBgwFoAUtvkat4UdcUEipt6L/PBgEFYH6AwwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwCQYHKoZIzj0EAQNIADBFAiBE4NiOdv/XRN3WWMnkE5QccvC6
VThoIQRyBf4I97cRPQIhAK18dvwrLuOOfbhWMdkpNCddMkWZHxS7traw/8+s7OUU
-----END CERTIFICATE-----
Added jni/libressl/tests/client1-ecdsa.pem.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
subject= CN = LibreSSL Test Client 1 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrTCCAVKgAwIBAgIJAOVssaaTYoH6MAoGCCqGSM49BAMCMC4xLDAqBgNVBAMM
I0xpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTIxMTIyNzE0
NDA0MFoXDTMxMTIyNTE0NDA0MFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBD
bGllbnQgMSBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABMnRxZ9SVIjF
eygaoub4qyo/tQlHXpQ2U66mhwKhchXD02w3viqOW0qklPSRhwV4nFKsdkVTogCg
Y8AJokxKDU6jYDBeMB0GA1UdDgQWBBTikUU9S7ASdWw7fhaYVdDqUAyH+DAfBgNV
HSMEGDAWgBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1Ud
DwEB/wQEAwIHgDAKBggqhkjOPQQDAgNJADBGAiEA+Aal+cjgT+pknsmAPbivSHY+
9clFV0Ree1c+nPbBz8cCIQCZDS2G/X8QthK7hZwV2mYhwvd6M/8kwet4u39qJYx8
eA==
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQghOgzNmZV/rLf5+I5
pnOXJ3N6W8QE5biANh/RVNNmNImhRANCAATJ0cWfUlSIxXsoGqLm+KsqP7UJR16U
NlOupocCoXIVw9NsN74qjltKpJT0kYcFeJxSrHZFU6IAoGPACaJMSg1O
-----END PRIVATE KEY-----
Added jni/libressl/tests/client1-rsa-chain.pem.
























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
subject= CN = LibreSSL Test Client 1 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoH1MA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzhaFw0zMTEyMjUxNDQwMzhaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
Q2xpZW50IDEgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyct5
l3L4GIzbFPszUioY0/+W9IGnQqOlBtFJQSzJtM96/UcJ/9MEkz08UUaf07CTYWy/
Qbwl3DizPV9yymiae64oe9RBc2Hh/Z88473Q6UZvPrdoexoVb159tTdvF8IDfIER
HEB2VAtssFvszERa04ndpDqS8tHfBcLGUCu2kZQ0FSCKbNSDLLwoQmyNgnWo8PDY
XshJGdABaTmnhpkrhJq2zeYiUResoWo8z08iVn7vLgjRNTi9mtXr5eC4L0DfEuZB
exaC8frQXH2rXKvojFrFwJ67QLwCOiUKbGlUQBeKS6iahgDL/dRprHqbNZFI7in4
QiokqixjfzYSmALFqwIDAQABo2AwXjAdBgNVHQ4EFgQUNRNEZs+zkqBu6va5XyGv
UfzSKZQwHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBACmIu0ppKw1T
hzGAoyjxK0y1ffbIDvObcwAMtXSHprMNhkdk7jyQBiXpx4ngEg1LhalUUDkp9Yt1
qUVjyM4cphJL7ni3N/SyoUtuYWY4s8mqIhloT5adaUJ24kHJ2eFzNBLDuno5wen4
dXKevTZPNqkkNohbVHrrFewsqS8CYw+rfiNerOJYZzSMbueWK5Pck0od05STZlAE
/B2zesXgd3ZmRKM8jrlZS6gan1FaJOzwErccP7jWnrOeW9uLysRg0ww26/H8Q9xS
dm0L8IXjzmE/yodk/nrt9G72mJnUITt4uHW/1ibMi4+iUR0Ff4oeqrBHQAbRawMK
XKRzXhtI9sI=
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIJAOVssaaTYoHyMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0IEludGVybWVk
aWF0ZSBDQSBSU0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD151AI
I+W9MrEP3dO0PEjg6L9E1R6+CG6u0LT3Jobc/rG2RXqKLasEaXoBWYiJoTImVxFT
wtrY+IDDTaEV4/4RGII1fY8Js7v5NpwoEh15jCoJ6/qDjKd4y1s1M48PlWYNNRmv
OBKRIu3Fz7scUa1RSBCp1bZeHbq/V5SzG419nDq2xpyuUrwmfBhDZTH+kUwBNGn8
XVRFCRJQVP3qEAH02Zai2emSVj13KrhEWMtNyA8fa34GIuV23Q40RKW3jUgGBF+D
5jPNN8EZCj34nvvbjCCBs7cxZvD4F/MzGbatKpNmNOKXKibeg/xCq8B/F1uzHcl3
IzJuViNtQ3RjQ/1pAgMBAAGjYzBhMB0GA1UdDgQWBBQ2oaFa//6a3ZNBNV0NlN3n
A9jiZjAfBgNVHSMEGDAWgBQ+S/x79Kw0KqURKAHyiOhdj/8V0TAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAcok2oSct
BOkm75qA8+4eUilGxTaqFPCqY8fk8MKNRKNNzaqirPaLJW62mZaxRHOn1Bw9uzL3
jgz2PaTwA7n5GpKs3r5JLk8BdtRyeqMLmqJVJKKuu4GtJLCA8jhQm+XNA1Z324hg
kVeBHLPpLKvQxb+0lmbRBORq/OtMirq2yK8OlF2USrfQx0jmhSvvLpWyA0hhAXRS
gg1ds9aL57dELvk6gR7Unob+J0O2Xq3FRwz2O1k9fF86a0qrWUkxcnAjobC2BczC
7Fe5B194LgrX2U4IIrzwgJ19kmtrb1Qol2okECxomTYsbQY36sBs+LOKxSuiagu6
ZgJtfcNeVMglYQ==
-----END CERTIFICATE-----
Added jni/libressl/tests/client1-rsa.pem.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
subject= CN = LibreSSL Test Client 1 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoH1MA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzhaFw0zMTEyMjUxNDQwMzhaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
Q2xpZW50IDEgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyct5
l3L4GIzbFPszUioY0/+W9IGnQqOlBtFJQSzJtM96/UcJ/9MEkz08UUaf07CTYWy/
Qbwl3DizPV9yymiae64oe9RBc2Hh/Z88473Q6UZvPrdoexoVb159tTdvF8IDfIER
HEB2VAtssFvszERa04ndpDqS8tHfBcLGUCu2kZQ0FSCKbNSDLLwoQmyNgnWo8PDY
XshJGdABaTmnhpkrhJq2zeYiUResoWo8z08iVn7vLgjRNTi9mtXr5eC4L0DfEuZB
exaC8frQXH2rXKvojFrFwJ67QLwCOiUKbGlUQBeKS6iahgDL/dRprHqbNZFI7in4
QiokqixjfzYSmALFqwIDAQABo2AwXjAdBgNVHQ4EFgQUNRNEZs+zkqBu6va5XyGv
UfzSKZQwHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBACmIu0ppKw1T
hzGAoyjxK0y1ffbIDvObcwAMtXSHprMNhkdk7jyQBiXpx4ngEg1LhalUUDkp9Yt1
qUVjyM4cphJL7ni3N/SyoUtuYWY4s8mqIhloT5adaUJ24kHJ2eFzNBLDuno5wen4
dXKevTZPNqkkNohbVHrrFewsqS8CYw+rfiNerOJYZzSMbueWK5Pck0od05STZlAE
/B2zesXgd3ZmRKM8jrlZS6gan1FaJOzwErccP7jWnrOeW9uLysRg0ww26/H8Q9xS
dm0L8IXjzmE/yodk/nrt9G72mJnUITt4uHW/1ibMi4+iUR0Ff4oeqrBHQAbRawMK
XKRzXhtI9sI=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDJy3mXcvgYjNsU
+zNSKhjT/5b0gadCo6UG0UlBLMm0z3r9Rwn/0wSTPTxRRp/TsJNhbL9BvCXcOLM9
X3LKaJp7rih71EFzYeH9nzzjvdDpRm8+t2h7GhVvXn21N28XwgN8gREcQHZUC2yw
W+zMRFrTid2kOpLy0d8FwsZQK7aRlDQVIIps1IMsvChCbI2Cdajw8NheyEkZ0AFp
OaeGmSuEmrbN5iJRF6yhajzPTyJWfu8uCNE1OL2a1evl4LgvQN8S5kF7FoLx+tBc
fatcq+iMWsXAnrtAvAI6JQpsaVRAF4pLqJqGAMv91Gmseps1kUjuKfhCKiSqLGN/
NhKYAsWrAgMBAAECggEAahMtnXDv/We9mi/Z8Gz0lCwcm/azh5IiI41MJph2hzcx
fYYkOXghRYzA8jBfv5VoQ6Q4fUN722Fqxu4vlzqZSj5oRX9z0EU52GomRcj30kgW
Hi+nGl7BucM/7Uxwd1qjHoVyCxnPmapPvfz0YwPjgqNMARJRQJcV1x9lw6rW03rW
qvoQKwnQ5vZRYldFnvYXRM0VUu8GdruaidWJ2Ra6FUFbEH+I77oIIoyWgXniq9jq
h0VJNRVCLwV4rFzmMkOAz1yxvJ+4UG9/wHYsZVhJDkyos1FVf0klKipKTS7Z87Em
aFlZ01JrM//kS/qdgohllCU8Xt1uVtvsYmJY9T6IEQKBgQD1IJzdopCI+BL7PfWf
qSpyUOgp+8J50CnIJ42ZdBWDhPZSbBqWmqbgBlnXEyPwkKVOhHde6td9DtxRVOiE
Zfy0gpUp4xWUxFdMKyW0+JmsmXiUJKIck6LxqfYDZUTzD2wp1/AhLGJ2M/J5e4IP
umr6IQ4BbDfKGp2NiHEQElCmdwKBgQDSvtOy71EhewJQ9slazR+10skSBbc5Ks9W
cy1fZKcnNB/dPenak5i8Gr04nPhhNvgAwmtDGb9hH1mwjHCUz/TaoPsbTKvtTN2N
MxFzQEsE9F803ULOvFOppe5YEy/M2OaDLHVil1bMwbrg3pGKD4TUfy5cE2NfCDi3
JwlKk6uDbQKBgQCLAQ9zb7hes66v4pbjD18OrGq7RBUoVq8a3bMijf2VM1UrsDnz
pYd0CqXvnN8IkD3tpJi8rpe8Ry0QwgGI8vy2sEY+FpQqZJzMiLs9QKyEgBMsjwmP
Avmn6SWlD0xmORyxLc7yQOUk+phJ44wBt0jqxsvWarPIXAd0NydGYdxySQKBgAWo
B4iS8cuDQLGpngfo34QCz1DDhIJtSrlYSAx6aB4eQQiwI7mxInVSBmghlm0Ni6SB
k11usHtL2x1o95CW8Ex566N08FxjJsMmbr54KEtOv8tscOGZnmk8QeRtR2gpHi7B
H7lwtGy0em6UqrVY60jEzRq9jno7f0IzMwWkZwMVAoGAL9mQ8xVIaDNyhK477NvD
ZF2AWrHHLXDeTfwdI+HTCUdeDC208kgTx4Z/AX1cN7KQtWZfKIW0bWtCDnKsIwbK
zheDR2AjuDEbT9HWLtYgQvx5/fEc/yxJqtQk+n4CTrDY+rNeow51kziBKWFnu8Je
m38SJSK7uNLz5ZWNgj3XIUE=
-----END PRIVATE KEY-----
Added jni/libressl/tests/client2-ecdsa-chain.pem.




















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
subject= CN = LibreSSL Test Client 2 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBpjCCAUygAwIBAgIDEAACMAoGCCqGSM49BAMCMC4xLDAqBgNVBAMMI0xpYnJl
U1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTEwMDEwMTAwMDAwMFoX
DTIwMDEwMTAwMDAwMFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBDbGllbnQg
MiBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL7oVxdDfyspO7ozwbv+
2QKCXR8Z1+JWKj6lLmAkN6GY/gXPYcCAtXOWRoVt5yg4YrH0eOJalah7yGjAeHLq
EHijYDBeMB0GA1UdDgQWBBRO8eCtJ/+3xfn+3qY31gP3Ch5JvDAfBgNVHSMEGDAW
gBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE
AwIHgDAKBggqhkjOPQQDAgNIADBFAiEA10kcAL7I/Y0KVNryJGrfVa1er0uiUXxS
2GmnKWFCQKECID9PY+LK4+DNvxyn4ld47AGJZjdolx6mwLFHK8RvtLo9
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrDCCAVOgAwIBAgIJAOVssaaTYoH3MAkGByqGSM49BAEwJjEkMCIGA1UEAwwb
TGlicmVTU0wgVGVzdCBSb290IENBIEVDRFNBMB4XDTIxMTIyNzE0NDA0MFoXDTMx
MTIyNTE0NDA0MFowLjEsMCoGA1UEAwwjTGlicmVTU0wgVGVzdCBJbnRlcm1lZGlh
dGUgQ0EgRUNEU0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATWRQbJh4aHPzHq
LOAmosW/o83bTpm3Sj1VxM44StmG7c1nnFM/+gS8rp2bVSgjWZQzRtZqGVGJgzbk
7/M1m3x3o2MwYTAdBgNVHQ4EFgQUF1Y9b/xKVxI5QsoCcoGrUA3kwggwHwYDVR0j
BBgwFoAUtvkat4UdcUEipt6L/PBgEFYH6AwwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwCQYHKoZIzj0EAQNIADBFAiBE4NiOdv/XRN3WWMnkE5QccvC6
VThoIQRyBf4I97cRPQIhAK18dvwrLuOOfbhWMdkpNCddMkWZHxS7traw/8+s7OUU
-----END CERTIFICATE-----
Added jni/libressl/tests/client2-ecdsa.pem.




































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
subject= CN = LibreSSL Test Client 2 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBpjCCAUygAwIBAgIDEAACMAoGCCqGSM49BAMCMC4xLDAqBgNVBAMMI0xpYnJl
U1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTEwMDEwMTAwMDAwMFoX
DTIwMDEwMTAwMDAwMFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBDbGllbnQg
MiBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL7oVxdDfyspO7ozwbv+
2QKCXR8Z1+JWKj6lLmAkN6GY/gXPYcCAtXOWRoVt5yg4YrH0eOJalah7yGjAeHLq
EHijYDBeMB0GA1UdDgQWBBRO8eCtJ/+3xfn+3qY31gP3Ch5JvDAfBgNVHSMEGDAW
gBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE
AwIHgDAKBggqhkjOPQQDAgNIADBFAiEA10kcAL7I/Y0KVNryJGrfVa1er0uiUXxS
2GmnKWFCQKECID9PY+LK4+DNvxyn4ld47AGJZjdolx6mwLFHK8RvtLo9
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgGJcFF0AYtzYr190f
tXnGfakMTr5zk0UO1nAfVSLMW2OhRANCAAS+6FcXQ38rKTu6M8G7/tkCgl0fGdfi
Vio+pS5gJDehmP4Fz2HAgLVzlkaFbecoOGKx9HjiWpWoe8howHhy6hB4
-----END PRIVATE KEY-----
Added jni/libressl/tests/client2-rsa-chain.pem.
























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
subject= CN = LibreSSL Test Client 2 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDLjCCAhagAwIBAgIDEAACMA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNVBAMMIUxp
YnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0xMDAxMDEwMDAwMDBa
Fw0yMDAxMDEwMDAwMDBaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3QgQ2xpZW50
IDIgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6TPjTtVn4l/2
3g+XVWUMpxZWu1G3GJ1TY14loqG2lLcyFwHfbxPgjdeUYUXgKw2v3LKdK1xlwohi
7adKmf8ZsqgWYd+SWtvzyoEEEvWQVj5bbs2+EI9CTP4L96lqsiBYZoHxCI+TG3pY
6JOZQT2wmJEL0zeK9cmUXoaV6fQOcEtSmp6m8XWLEEyUZvVHG3OX+7FtcV0snDfz
XrnvpRpu4zolbCC6jysufU46VoJNrrKdPlDu4PbF8PKrJl7jOSULaYHqugIeniMV
V9enkg9t0Bb8bW5sW8/c4vwS52dlRNLHXkwGE7u9+XEVOGDJ+a01eRjVOxQwqptn
qrWTF++D0QIDAQABo2AwXjAdBgNVHQ4EFgQUmUxF57QtRFh9JBPTMx5rUvRjj+4w
HwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/BAIwADAO
BgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAMAvLchG7tWtNXPK3+Ie
u+htMMPhgJCsHhEC0ssZezD3BfYHaJh7ayQwI1KWKrQOwu9z+oOGWQjoVmhBzoi2
hmvH9vT4GFVnM5agf68USNLxQvlQiShfnqPZiy3EduwY0q+uNvvNYlHeLTp/Au7F
SesJqWoaMr3130n8QqiO8myNjUj3GVrmBBpFogU5qxQAHkcy2AbpkATjRtfG4Jn2
DWXR9Yd56KuvmkpdVkw+DScOXbIgXmHyutJ7qDbm6lwXLD3U5ulvbSxXW/MhJpb9
72UjtpQbhMzcyQwCvNrKnST+QqKMisAdkOOhCdEYTj8flpCbMA5bqwBRX+t+AMeD
4lY=
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIJAOVssaaTYoHyMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0IEludGVybWVk
aWF0ZSBDQSBSU0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD151AI
I+W9MrEP3dO0PEjg6L9E1R6+CG6u0LT3Jobc/rG2RXqKLasEaXoBWYiJoTImVxFT
wtrY+IDDTaEV4/4RGII1fY8Js7v5NpwoEh15jCoJ6/qDjKd4y1s1M48PlWYNNRmv
OBKRIu3Fz7scUa1RSBCp1bZeHbq/V5SzG419nDq2xpyuUrwmfBhDZTH+kUwBNGn8
XVRFCRJQVP3qEAH02Zai2emSVj13KrhEWMtNyA8fa34GIuV23Q40RKW3jUgGBF+D
5jPNN8EZCj34nvvbjCCBs7cxZvD4F/MzGbatKpNmNOKXKibeg/xCq8B/F1uzHcl3
IzJuViNtQ3RjQ/1pAgMBAAGjYzBhMB0GA1UdDgQWBBQ2oaFa//6a3ZNBNV0NlN3n
A9jiZjAfBgNVHSMEGDAWgBQ+S/x79Kw0KqURKAHyiOhdj/8V0TAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAcok2oSct
BOkm75qA8+4eUilGxTaqFPCqY8fk8MKNRKNNzaqirPaLJW62mZaxRHOn1Bw9uzL3
jgz2PaTwA7n5GpKs3r5JLk8BdtRyeqMLmqJVJKKuu4GtJLCA8jhQm+XNA1Z324hg
kVeBHLPpLKvQxb+0lmbRBORq/OtMirq2yK8OlF2USrfQx0jmhSvvLpWyA0hhAXRS
gg1ds9aL57dELvk6gR7Unob+J0O2Xq3FRwz2O1k9fF86a0qrWUkxcnAjobC2BczC
7Fe5B194LgrX2U4IIrzwgJ19kmtrb1Qol2okECxomTYsbQY36sBs+LOKxSuiagu6
ZgJtfcNeVMglYQ==
-----END CERTIFICATE-----
Added jni/libressl/tests/client2-rsa.pem.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
subject= CN = LibreSSL Test Client 2 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDLjCCAhagAwIBAgIDEAACMA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNVBAMMIUxp
YnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0xMDAxMDEwMDAwMDBa
Fw0yMDAxMDEwMDAwMDBaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3QgQ2xpZW50
IDIgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6TPjTtVn4l/2
3g+XVWUMpxZWu1G3GJ1TY14loqG2lLcyFwHfbxPgjdeUYUXgKw2v3LKdK1xlwohi
7adKmf8ZsqgWYd+SWtvzyoEEEvWQVj5bbs2+EI9CTP4L96lqsiBYZoHxCI+TG3pY
6JOZQT2wmJEL0zeK9cmUXoaV6fQOcEtSmp6m8XWLEEyUZvVHG3OX+7FtcV0snDfz
XrnvpRpu4zolbCC6jysufU46VoJNrrKdPlDu4PbF8PKrJl7jOSULaYHqugIeniMV
V9enkg9t0Bb8bW5sW8/c4vwS52dlRNLHXkwGE7u9+XEVOGDJ+a01eRjVOxQwqptn
qrWTF++D0QIDAQABo2AwXjAdBgNVHQ4EFgQUmUxF57QtRFh9JBPTMx5rUvRjj+4w
HwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/BAIwADAO
BgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAMAvLchG7tWtNXPK3+Ie
u+htMMPhgJCsHhEC0ssZezD3BfYHaJh7ayQwI1KWKrQOwu9z+oOGWQjoVmhBzoi2
hmvH9vT4GFVnM5agf68USNLxQvlQiShfnqPZiy3EduwY0q+uNvvNYlHeLTp/Au7F
SesJqWoaMr3130n8QqiO8myNjUj3GVrmBBpFogU5qxQAHkcy2AbpkATjRtfG4Jn2
DWXR9Yd56KuvmkpdVkw+DScOXbIgXmHyutJ7qDbm6lwXLD3U5ulvbSxXW/MhJpb9
72UjtpQbhMzcyQwCvNrKnST+QqKMisAdkOOhCdEYTj8flpCbMA5bqwBRX+t+AMeD
4lY=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDpM+NO1WfiX/be
D5dVZQynFla7UbcYnVNjXiWiobaUtzIXAd9vE+CN15RhReArDa/csp0rXGXCiGLt
p0qZ/xmyqBZh35Ja2/PKgQQS9ZBWPltuzb4Qj0JM/gv3qWqyIFhmgfEIj5Mbeljo
k5lBPbCYkQvTN4r1yZRehpXp9A5wS1KanqbxdYsQTJRm9Ucbc5f7sW1xXSycN/Ne
ue+lGm7jOiVsILqPKy59TjpWgk2usp0+UO7g9sXw8qsmXuM5JQtpgeq6Ah6eIxVX
16eSD23QFvxtbmxbz9zi/BLnZ2VE0sdeTAYTu735cRU4YMn5rTV5GNU7FDCqm2eq
tZMX74PRAgMBAAECggEAGghk06QXGLpFwLxU1H+XTf+8ZuTUX7cQXANiiCktTKS2
vsLCwo+hfbQXKFS4lZXNkAGQcgq6gWDgSk9mkJJduAfzl7FxkRsEuBJ29fbbygTk
CBaHpSmY6SdjBp6u/nuF4suWsLH2ZhbeXfg8H4BXenCWtVl59b4vBe5YRemswvQv
DJzV9gVKDf7HnvcjUMBXNKNWk0cLlodKX6bRhpPbq/WNPAubA3z4Z0JZqnW9uuWa
wTd7QPeKxVbQmz5Y5hifKMI4ML5i1+Fo6Xvcdt1TwfeHYy+iPNtB8fEu1VdH25DN
iN5iiMOr7go8MOc4LxCZGsXqIDd6WYOg/DmCEsSiEQKBgQD78UT9ezhI7TLVmUdC
eQd8+oi1qXykHXpMvobCJUrEulF6/iZSICcVVdH/DcvGRPv7A+90QZWGcY2Bzhtz
8C2XFLqLvSyHegSA4P57PbHjBOqowFAWntLTn/gSOb+nYKSM5XzOQq7RQctYX3EO
jZb4GKhPOUwzy2Ugd9zNhqD8gwKBgQDs9VtAYvM2i3ylRLH/UdAu/E+oA05ydxT1
dt4tK6R54KSZk+E/LM/k8D3p70tyiRbfky6DtGrGZSpyecCPdkNF0FJTRER1eDsb
Au2uH6zP0nn2FUnQnL5fcIkVlclukf8pMox5fbFcoZjIWti9TURIdMTkaQVX9LKf
Gme84UX2GwKBgQCqsJZuKbpDZjinkDZAKeFR4icW9KIWSkZekkKYbE2QpS6o5mEu
CMyR3tfsNfuV84zITq0/lWNpd6tIg0wEK3enwQp1vA/cJWXBry2ab30CcoVNGSXp
fWcWq22VY3yeOJKjRqNc1r671RigYeEl2/WpVoNJUWd4O9fivHJi6FBPYwKBgQDI
3B5y0K27gbex3C5J8A7ZlTTshYj8zGZuwEkK3yC30y2TpV/dDl5XgTHqV9aLixth
f0CBkfCkpeK6UOxib2wNBM6UGJ0zOixX9D6HSABT1eVeLKN6ezOAcUMykdrCqG0z
fc7HuT0b+TsqMp/gr1t/U8QGneNSsHCtH1PqLscAGwKBgFdecOiUhKezd6mReDYc
cBKBN/2EBPNCSKlzuskSGoU/mC0H+2Mj1XX4fx5Wjvjp3hqKEVgs/L8Eth1KYfgF
CaQzGAkavihH03L73to1Wj/K4XineBAKZLtXkdzWdB+kM8zkYJqmagh6h6BlXFun
TJvYJYIK9U3kvhZtsD6w1slZ
-----END PRIVATE KEY-----
Added jni/libressl/tests/client3-ecdsa-chain.pem.




















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
subject= CN = LibreSSL Test Client 3 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBqjCCAVGgAwIBAgIJAOVssaaTYoH7MAkGByqGSM49BAEwLjEsMCoGA1UEAwwj
TGlicmVTU0wgVGVzdCBJbnRlcm1lZGlhdGUgQ0EgRUNEU0EwHhcNMjExMjI3MTQ0
MDQwWhcNMzExMjI1MTQ0MDQwWjAnMSUwIwYDVQQDDBxMaWJyZVNTTCBUZXN0IENs
aWVudCAzIEVDRFNBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqlNqEjPuPpw3
HaWxXbWql6f9g2HPei7RGZRfEAeNrnWT+Y4okVoqcxjeLNBA6dNl3uALWbSmDu6a
kmBSU1aY9KNgMF4wHQYDVR0OBBYEFKxGR7LhwxXUGYyxjqBrxi5RKHamMB8GA1Ud
IwQYMBaAFBdWPW/8SlcSOULKAnKBq1AN5MIIMAwGA1UdEwEB/wQCMAAwDgYDVR0P
AQH/BAQDAgeAMAkGByqGSM49BAEDSAAwRQIhAMFzwaCpvWiXD+zEZ/mUBdbMQq2W
JLELD9Mv11NiBhi6AiAN/QNQjluNEUTkxCH6p9bQiOYCQ3DOnPTxrSly/RQOSQ==
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrDCCAVOgAwIBAgIJAOVssaaTYoH3MAkGByqGSM49BAEwJjEkMCIGA1UEAwwb
TGlicmVTU0wgVGVzdCBSb290IENBIEVDRFNBMB4XDTIxMTIyNzE0NDA0MFoXDTMx
MTIyNTE0NDA0MFowLjEsMCoGA1UEAwwjTGlicmVTU0wgVGVzdCBJbnRlcm1lZGlh
dGUgQ0EgRUNEU0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATWRQbJh4aHPzHq
LOAmosW/o83bTpm3Sj1VxM44StmG7c1nnFM/+gS8rp2bVSgjWZQzRtZqGVGJgzbk
7/M1m3x3o2MwYTAdBgNVHQ4EFgQUF1Y9b/xKVxI5QsoCcoGrUA3kwggwHwYDVR0j
BBgwFoAUtvkat4UdcUEipt6L/PBgEFYH6AwwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwCQYHKoZIzj0EAQNIADBFAiBE4NiOdv/XRN3WWMnkE5QccvC6
VThoIQRyBf4I97cRPQIhAK18dvwrLuOOfbhWMdkpNCddMkWZHxS7traw/8+s7OUU
-----END CERTIFICATE-----
Added jni/libressl/tests/client3-ecdsa.pem.




































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
subject= CN = LibreSSL Test Client 3 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBqjCCAVGgAwIBAgIJAOVssaaTYoH7MAkGByqGSM49BAEwLjEsMCoGA1UEAwwj
TGlicmVTU0wgVGVzdCBJbnRlcm1lZGlhdGUgQ0EgRUNEU0EwHhcNMjExMjI3MTQ0
MDQwWhcNMzExMjI1MTQ0MDQwWjAnMSUwIwYDVQQDDBxMaWJyZVNTTCBUZXN0IENs
aWVudCAzIEVDRFNBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqlNqEjPuPpw3
HaWxXbWql6f9g2HPei7RGZRfEAeNrnWT+Y4okVoqcxjeLNBA6dNl3uALWbSmDu6a
kmBSU1aY9KNgMF4wHQYDVR0OBBYEFKxGR7LhwxXUGYyxjqBrxi5RKHamMB8GA1Ud
IwQYMBaAFBdWPW/8SlcSOULKAnKBq1AN5MIIMAwGA1UdEwEB/wQCMAAwDgYDVR0P
AQH/BAQDAgeAMAkGByqGSM49BAEDSAAwRQIhAMFzwaCpvWiXD+zEZ/mUBdbMQq2W
JLELD9Mv11NiBhi6AiAN/QNQjluNEUTkxCH6p9bQiOYCQ3DOnPTxrSly/RQOSQ==
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgfaMOzQZ+d1yL3ToI
VPcHtdkIVhqatu/rDcJLuJcNnQehRANCAASqU2oSM+4+nDcdpbFdtaqXp/2DYc96
LtEZlF8QB42udZP5jiiRWipzGN4s0EDp02Xe4AtZtKYO7pqSYFJTVpj0
-----END PRIVATE KEY-----
Added jni/libressl/tests/client3-rsa-chain.pem.
























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
subject= CN = LibreSSL Test Client 3 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoH2MA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzhaFw0zMTEyMjUxNDQwMzhaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
Q2xpZW50IDMgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp1vW
q3L63zPi8RJaJ07LsR05gCBYJ7FrnprqKbo7swLra3HE5WQFTxxOPkzBBnCUEaa2
tqPtov34mrOmnYTQDBxpljx5u6AzjgMfwJZfh7CtGf893nbbP7T2f3pXAFBR0A32
xmEvso5afyLNRvmxCsrdr2u73bETmBqFQFgGrhtBpTeGqsixgOegZzKHVF67ZjJi
e+faM24GAtkOiPB7PfVgZFyTfe8HQsqqcMRVtjd7JxuN33k8cFIWqv5i8oqVLBME
mLFM2WFIYNTsMtQ38eA7xieuuK6OPTp+cJKQY6jA3wUJOTRt9UE7pEjxOTumckfM
u/ZE1+AODHkH97FptwIDAQABo2AwXjAdBgNVHQ4EFgQUz44RRa+P1oRBVI6lla3o
VsVQq7swHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAFgL5955qwHN
vFGnAKoHhoszX3qf2h8zc5HvFfnbvZbBbsuRFW1/QGfQPGWDq8YUlb6wu8NjLjSM
qTSYd1CvWXO1s91kr3LM5k7+9x+whOgbzWjGiprloS9pXcZ+ljTunW4o7jE7pPjZ
opk7W2WmD7/dEDg10x0yDZnKbzea5PMpp6kLqNjtENW4SETtcnwBdi/MZ09ApuUC
E+XWK/uKmxbIJ7Rt/Vi5H3BE74w7souq7fMwGGk7NL8Fmha78VQApKvZV/Rsfrio
D0vVU8djTlEJyXCeqFYU2eKWhc0bfiONIFJ6Wtg/1cR6Jn12+6X36J+wW1G3ibMu
ey+V9oVpM2U=
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIJAOVssaaTYoHyMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0IEludGVybWVk
aWF0ZSBDQSBSU0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD151AI
I+W9MrEP3dO0PEjg6L9E1R6+CG6u0LT3Jobc/rG2RXqKLasEaXoBWYiJoTImVxFT
wtrY+IDDTaEV4/4RGII1fY8Js7v5NpwoEh15jCoJ6/qDjKd4y1s1M48PlWYNNRmv
OBKRIu3Fz7scUa1RSBCp1bZeHbq/V5SzG419nDq2xpyuUrwmfBhDZTH+kUwBNGn8
XVRFCRJQVP3qEAH02Zai2emSVj13KrhEWMtNyA8fa34GIuV23Q40RKW3jUgGBF+D
5jPNN8EZCj34nvvbjCCBs7cxZvD4F/MzGbatKpNmNOKXKibeg/xCq8B/F1uzHcl3
IzJuViNtQ3RjQ/1pAgMBAAGjYzBhMB0GA1UdDgQWBBQ2oaFa//6a3ZNBNV0NlN3n
A9jiZjAfBgNVHSMEGDAWgBQ+S/x79Kw0KqURKAHyiOhdj/8V0TAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAcok2oSct
BOkm75qA8+4eUilGxTaqFPCqY8fk8MKNRKNNzaqirPaLJW62mZaxRHOn1Bw9uzL3
jgz2PaTwA7n5GpKs3r5JLk8BdtRyeqMLmqJVJKKuu4GtJLCA8jhQm+XNA1Z324hg
kVeBHLPpLKvQxb+0lmbRBORq/OtMirq2yK8OlF2USrfQx0jmhSvvLpWyA0hhAXRS
gg1ds9aL57dELvk6gR7Unob+J0O2Xq3FRwz2O1k9fF86a0qrWUkxcnAjobC2BczC
7Fe5B194LgrX2U4IIrzwgJ19kmtrb1Qol2okECxomTYsbQY36sBs+LOKxSuiagu6
ZgJtfcNeVMglYQ==
-----END CERTIFICATE-----
Added jni/libressl/tests/client3-rsa.pem.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
subject= CN = LibreSSL Test Client 3 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoH2MA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzhaFw0zMTEyMjUxNDQwMzhaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
Q2xpZW50IDMgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp1vW
q3L63zPi8RJaJ07LsR05gCBYJ7FrnprqKbo7swLra3HE5WQFTxxOPkzBBnCUEaa2
tqPtov34mrOmnYTQDBxpljx5u6AzjgMfwJZfh7CtGf893nbbP7T2f3pXAFBR0A32
xmEvso5afyLNRvmxCsrdr2u73bETmBqFQFgGrhtBpTeGqsixgOegZzKHVF67ZjJi
e+faM24GAtkOiPB7PfVgZFyTfe8HQsqqcMRVtjd7JxuN33k8cFIWqv5i8oqVLBME
mLFM2WFIYNTsMtQ38eA7xieuuK6OPTp+cJKQY6jA3wUJOTRt9UE7pEjxOTumckfM
u/ZE1+AODHkH97FptwIDAQABo2AwXjAdBgNVHQ4EFgQUz44RRa+P1oRBVI6lla3o
VsVQq7swHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAFgL5955qwHN
vFGnAKoHhoszX3qf2h8zc5HvFfnbvZbBbsuRFW1/QGfQPGWDq8YUlb6wu8NjLjSM
qTSYd1CvWXO1s91kr3LM5k7+9x+whOgbzWjGiprloS9pXcZ+ljTunW4o7jE7pPjZ
opk7W2WmD7/dEDg10x0yDZnKbzea5PMpp6kLqNjtENW4SETtcnwBdi/MZ09ApuUC
E+XWK/uKmxbIJ7Rt/Vi5H3BE74w7souq7fMwGGk7NL8Fmha78VQApKvZV/Rsfrio
D0vVU8djTlEJyXCeqFYU2eKWhc0bfiONIFJ6Wtg/1cR6Jn12+6X36J+wW1G3ibMu
ey+V9oVpM2U=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCnW9arcvrfM+Lx
ElonTsuxHTmAIFgnsWuemuopujuzAutrccTlZAVPHE4+TMEGcJQRpra2o+2i/fia
s6adhNAMHGmWPHm7oDOOAx/All+HsK0Z/z3edts/tPZ/elcAUFHQDfbGYS+yjlp/
Is1G+bEKyt2va7vdsROYGoVAWAauG0GlN4aqyLGA56BnModUXrtmMmJ759ozbgYC
2Q6I8Hs99WBkXJN97wdCyqpwxFW2N3snG43feTxwUhaq/mLyipUsEwSYsUzZYUhg
1Owy1Dfx4DvGJ664ro49On5wkpBjqMDfBQk5NG31QTukSPE5O6ZyR8y79kTX4A4M
eQf3sWm3AgMBAAECggEBAJV3HddtDsR8sHegbkegxaXeddYKDPEWMQkrTWoK2vpa
5ynEJ5a+p0cp/m8BWXqI3JSPEas36CmjLH3taCZR0QSf82SrigSZZLG19IupQJQM
o+wN2pFuEQ1qbqMW/dBX61kmv3gYn+KV5BibWj3DDeyXlTjvvI6XcOps9QisFPs0
BqPC7U4B3DaILeK+cLS9ONjXv4WgGi1LB8dpSR3HgT+qKs/bceCWGCcjfi3PQVJw
8Ahv8wce71rwIWxhnh6hcHq8iiGUj2CAtOA9E4qtxgQ5VkhR049pPQ0CkcrFBRT8
wTDF5ffzSAbU9QRp/cL7k/eeEAiNQg0aL2GUHhmO/KECgYEA1PxATAFTzX6K4nM/
yRU769vegTiblYjzUB5JL7baMUgSGgXrZ4UomtQQiYZSDhho8bDSEKM7cNzddMTo
BFyKTvV4Won6LtF2R/JiFbUfDxhGS1+uoLXGciAFdB+NABLrmTQ0jp0N3y53UBmr
jwMDz9BqXq+6QoM3lLUsL4V2j08CgYEAySiax4D3pkr3T6iTuEaLqW9vTV58vWUY
sDstNA2YONYTPHUtFMpVfPgMmrraWHl3yNC2LB9W3SjJ+05oRYObUBI1oAg68u9z
T2+jcxM3fN8HFwyFMm5gd3tygawdwGsvCjLPMJaHdtwlbg8lYfHyEl1hJRA+cnKg
Y5hrfWtpJRkCgYEApWeBR4WAX4Z2tYZrcu5aqsEF+7TKn0bMLtxWWgfXS459AFi4
iJyQ/CzU6vi1oNy0I37+pI0gDHZ6RcTlqv1zK/7WiPm+ob1p7lX+dn1CsaZYcRDN
vWFtzBOyKIyYJAaNkV1Js7eknj6nyj0lTts4ipuBACfYru7Yq1RIDF/Jw2ECgYA9
qTWwu+at0cL3ZwxI6076VA9BHxqLj8a+lpUnpJcprO1eleiIu/DyirKKZ4ZwomNG
aju9UKn2xv8LCqDJ1iqwo7ROZtdzClVFX0oyBwz2OQNaXFsj91OYrH2QJCtGhVR5
AtQh57KEi7zpfLkPyfNTD86sZstNl7d0cA9a9abYWQKBgQCPESj1LojjkEvGKtiD
9w+ZMaDf+mYK+RYQnjEthUMpAPI+mhm9cAl8mMJu3FaNgviOX9oB1/1XGl1Pj5od
KWej9CF1ltoW/PcjsSTeeRFye5jvXn9BLr3w6iUl9pwyo4sVyLHgMzZpiQvGoRNy
u80tjy6bVP3dGa5VHm36pENC4Q==
-----END PRIVATE KEY-----
Changes to jni/libressl/tests/clienttest.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: clienttest.c,v 1.36 2021/11/20 16:32:55 tb Exp $ */
/*
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: clienttest.c,v 1.39 2022/07/19 20:16:50 tb Exp $ */
/*
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#define SSL3_RANDOM_OFFSET (SSL3_HM_OFFSET + 2)
#define SSL3_CIPHER_OFFSET (SSL3_HM_OFFSET + 37)

#define TLS13_HM_OFFSET (SSL3_RT_HEADER_LENGTH + SSL3_HM_HEADER_LENGTH)
#define TLS13_RANDOM_OFFSET (TLS13_HM_OFFSET + 2)
#define TLS13_SESSION_OFFSET (TLS13_HM_OFFSET + 34)
#define TLS13_CIPHER_OFFSET (TLS13_HM_OFFSET + 69)
#define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 194)
#define TLS13_ONLY_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 98)

#define TLS1_3_VERSION_ONLY (TLS1_3_VERSION | 0x10000)

static const uint8_t cipher_list_dtls1[] = {
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84,







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#define SSL3_RANDOM_OFFSET (SSL3_HM_OFFSET + 2)
#define SSL3_CIPHER_OFFSET (SSL3_HM_OFFSET + 37)

#define TLS13_HM_OFFSET (SSL3_RT_HEADER_LENGTH + SSL3_HM_HEADER_LENGTH)
#define TLS13_RANDOM_OFFSET (TLS13_HM_OFFSET + 2)
#define TLS13_SESSION_OFFSET (TLS13_HM_OFFSET + 34)
#define TLS13_CIPHER_OFFSET (TLS13_HM_OFFSET + 69)
#define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 192)
#define TLS13_ONLY_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 98)

#define TLS1_3_VERSION_ONLY (TLS1_3_VERSION | 0x10000)

static const uint8_t cipher_list_dtls1[] = {
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84,
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
};

static const uint8_t cipher_list_tls10[] = {
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x33, 0x00, 0x45,
	0x00, 0x2f, 0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07,
	0x00, 0x05, 0x00, 0x04, 0xc0, 0x12, 0xc0, 0x08,
	0x00, 0x16, 0x00, 0x0a, 0x00, 0xff,
};

static const uint8_t client_hello_tls10[] = {
	0x16, 0x03, 0x01, 0x00, 0x73, 0x01, 0x00, 0x00,
	0x6f, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85, 0x00, 0x88,
	0x00, 0x81, 0x00, 0x35, 0x00, 0x84, 0xc0, 0x13,
	0xc0, 0x09, 0x00, 0x33, 0x00, 0x45, 0x00, 0x2f,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0x00, 0x04, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16,
	0x00, 0x0a, 0x00, 0xff, 0x01, 0x00, 0x00, 0x18,
	0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x0a,
	0x00, 0x0a, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x17,
	0x00, 0x18, 0x00, 0x19, 0x00, 0x23, 0x00, 0x00,
};

static const uint8_t cipher_list_tls11[] = {
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x33, 0x00, 0x45,
	0x00, 0x2f, 0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07,
	0x00, 0x05, 0x00, 0x04, 0xc0, 0x12, 0xc0, 0x08,
	0x00, 0x16, 0x00, 0x0a, 0x00, 0xff,
};

static const uint8_t client_hello_tls11[] = {
	0x16, 0x03, 0x01, 0x00, 0x73, 0x01, 0x00, 0x00,
	0x6f, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85, 0x00, 0x88,
	0x00, 0x81, 0x00, 0x35, 0x00, 0x84, 0xc0, 0x13,
	0xc0, 0x09, 0x00, 0x33, 0x00, 0x45, 0x00, 0x2f,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0x00, 0x04, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16,
	0x00, 0x0a, 0x00, 0xff, 0x01, 0x00, 0x00, 0x18,
	0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x0a,
	0x00, 0x0a, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x17,
	0x00, 0x18, 0x00, 0x19, 0x00, 0x23, 0x00, 0x00,
};

static const uint8_t cipher_list_tls12_aes[] = {
	0xc0, 0x30, 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24,
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b,
	0x00, 0x39, 0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa,
	0xff, 0x85, 0x00, 0xc4, 0x00, 0x88, 0x00, 0x81,
	0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0,
	0x00, 0x84, 0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27,
	0xc0, 0x23, 0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e,
	0x00, 0x67, 0x00, 0x33, 0x00, 0xbe, 0x00, 0x45,
	0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0x00, 0x04, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16,
	0x00, 0x0a, 0x00, 0xff,
};

static const uint8_t cipher_list_tls12_chacha[] = {
	0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xc0, 0x30,
	0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39,
	0xff, 0x85, 0x00, 0xc4, 0x00, 0x88, 0x00, 0x81,
	0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0,
	0x00, 0x84, 0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27,
	0xc0, 0x23, 0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e,
	0x00, 0x67, 0x00, 0x33, 0x00, 0xbe, 0x00, 0x45,
	0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0x00, 0x04, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16,
	0x00, 0x0a, 0x00, 0xff,
};

static const uint8_t client_hello_tls12[] = {
	0x16, 0x03, 0x01, 0x00, 0xbd, 0x01, 0x00, 0x00,
	0xb9, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0xc0, 0x30,
	0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39,
	0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xff, 0x85,
	0x00, 0xc4, 0x00, 0x88, 0x00, 0x81, 0x00, 0x9d,
	0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0, 0x00, 0x84,
	0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67,
	0x00, 0x33, 0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c,
	0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41,
	0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05, 0x00, 0x04,
	0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a,
	0x00, 0xff, 0x01, 0x00, 0x00, 0x34, 0x00, 0x0b,
	0x00, 0x02, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a,
	0x00, 0x08, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18,
	0x00, 0x19, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0d,
	0x00, 0x18, 0x00, 0x16, 0x08, 0x06, 0x06, 0x01,
	0x06, 0x03, 0x08, 0x05, 0x05, 0x01, 0x05, 0x03,
	0x08, 0x04, 0x04, 0x01, 0x04, 0x03, 0x02, 0x01,
	0x02, 0x03,
};

static const uint8_t cipher_list_tls13_aes[] = {
	0x13, 0x02, 0x13, 0x03, 0x13, 0x01, 0xc0, 0x30,
	0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39,
	0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xff, 0x85,
	0x00, 0xc4, 0x00, 0x88, 0x00, 0x81, 0x00, 0x9d,
	0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0, 0x00, 0x84,
	0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67,
	0x00, 0x33, 0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c,
	0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41,
	0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05, 0x00, 0x04,
	0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a,
	0x00, 0xff
};

static const uint8_t cipher_list_tls13_chacha[] = {
	0x13, 0x03, 0x13, 0x02, 0x13, 0x01, 0xcc, 0xa9,
	0xcc, 0xa8, 0xcc, 0xaa, 0xc0, 0x30, 0xc0, 0x2c,
	0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, 0xc0, 0x0a,
	0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39, 0xff, 0x85,
	0x00, 0xc4, 0x00, 0x88, 0x00, 0x81, 0x00, 0x9d,
	0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0, 0x00, 0x84,
	0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67,
	0x00, 0x33, 0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c,
	0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41,
	0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05, 0x00, 0x04,
	0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a,
	0x00, 0xff,
};

static const uint8_t client_hello_tls13[] = {
	0x16, 0x03, 0x01, 0x01, 0x1a, 0x01, 0x00, 0x01,
	0x16, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x13, 0x03,
	0x13, 0x02, 0x13, 0x01, 0xcc, 0xa9, 0xcc, 0xa8,
	0xcc, 0xaa, 0xc0, 0x30, 0xc0, 0x2c, 0xc0, 0x28,
	0xc0, 0x24, 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x9f,
	0x00, 0x6b, 0x00, 0x39, 0xff, 0x85, 0x00, 0xc4,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x9d, 0x00, 0x3d,
	0x00, 0x35, 0x00, 0xc0, 0x00, 0x84, 0xc0, 0x2f,
	0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, 0xc0, 0x13,
	0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67, 0x00, 0x33,
	0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c, 0x00, 0x3c,
	0x00, 0x2f, 0x00, 0xba, 0x00, 0x41, 0xc0, 0x11,
	0xc0, 0x07, 0x00, 0x05, 0x00, 0x04, 0xc0, 0x12,
	0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff,
	0x01, 0x00, 0x00, 0x6b, 0x00, 0x2b, 0x00, 0x09,
	0x08, 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x03,
	0x01, 0x00, 0x33, 0x00, 0x26, 0x00, 0x24, 0x00,
	0x1d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x02, 0x01,
	0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00,
	0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x00,
	0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x18, 0x00,
	0x16, 0x08, 0x06, 0x06, 0x01, 0x06, 0x03, 0x08,
	0x05, 0x05, 0x01, 0x05, 0x03, 0x08, 0x04, 0x04,
	0x01, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03,
};

static const uint8_t cipher_list_tls13_only_aes[] = {
	0x13, 0x02, 0x13, 0x03, 0x13, 0x01,
};

static const uint8_t cipher_list_tls13_only_chacha[] = {







|
|



|
|



|




|
|
|
|
|







|
|



|
|



|




|
|
|
|
|













|
|













|
|



|
|



|









|
|
|
|
|
|
|
|
|
<













|
|
<













|
|
<



|
|







|










|
|
|
|
|
|



|
|
|
|
|
|
|







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
260
261
262
263
264
265
266
267

268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
};

static const uint8_t cipher_list_tls10[] = {
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x33, 0x00, 0x45,
	0x00, 0x2f, 0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07,
	0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16,
	0x00, 0x0a, 0x00, 0xff,
};

static const uint8_t client_hello_tls10[] = {
	0x16, 0x03, 0x01, 0x00, 0x71, 0x01, 0x00, 0x00,
	0x6d, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85, 0x00, 0x88,
	0x00, 0x81, 0x00, 0x35, 0x00, 0x84, 0xc0, 0x13,
	0xc0, 0x09, 0x00, 0x33, 0x00, 0x45, 0x00, 0x2f,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a,
	0x00, 0xff, 0x01, 0x00, 0x00, 0x18, 0x00, 0x0b,
	0x00, 0x02, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a,
	0x00, 0x08, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18,
	0x00, 0x19, 0x00, 0x23, 0x00, 0x00,
};

static const uint8_t cipher_list_tls11[] = {
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x33, 0x00, 0x45,
	0x00, 0x2f, 0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07,
	0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16,
	0x00, 0x0a, 0x00, 0xff,
};

static const uint8_t client_hello_tls11[] = {
	0x16, 0x03, 0x01, 0x00, 0x71, 0x01, 0x00, 0x00,
	0x6d, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85, 0x00, 0x88,
	0x00, 0x81, 0x00, 0x35, 0x00, 0x84, 0xc0, 0x13,
	0xc0, 0x09, 0x00, 0x33, 0x00, 0x45, 0x00, 0x2f,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a,
	0x00, 0xff, 0x01, 0x00, 0x00, 0x18, 0x00, 0x0b,
	0x00, 0x02, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a,
	0x00, 0x08, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18,
	0x00, 0x19, 0x00, 0x23, 0x00, 0x00,
};

static const uint8_t cipher_list_tls12_aes[] = {
	0xc0, 0x30, 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24,
	0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b,
	0x00, 0x39, 0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa,
	0xff, 0x85, 0x00, 0xc4, 0x00, 0x88, 0x00, 0x81,
	0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0,
	0x00, 0x84, 0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27,
	0xc0, 0x23, 0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e,
	0x00, 0x67, 0x00, 0x33, 0x00, 0xbe, 0x00, 0x45,
	0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a,
	0x00, 0xff,
};

static const uint8_t cipher_list_tls12_chacha[] = {
	0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xc0, 0x30,
	0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39,
	0xff, 0x85, 0x00, 0xc4, 0x00, 0x88, 0x00, 0x81,
	0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0,
	0x00, 0x84, 0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27,
	0xc0, 0x23, 0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e,
	0x00, 0x67, 0x00, 0x33, 0x00, 0xbe, 0x00, 0x45,
	0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba,
	0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05,
	0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a,
	0x00, 0xff,
};

static const uint8_t client_hello_tls12[] = {
	0x16, 0x03, 0x01, 0x00, 0xbb, 0x01, 0x00, 0x00,
	0xb7, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xc0, 0x30,
	0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39,
	0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xff, 0x85,
	0x00, 0xc4, 0x00, 0x88, 0x00, 0x81, 0x00, 0x9d,
	0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0, 0x00, 0x84,
	0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67,
	0x00, 0x33, 0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c,
	0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41,
	0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05, 0xc0, 0x12,
	0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff,
	0x01, 0x00, 0x00, 0x34, 0x00, 0x0b, 0x00, 0x02,
	0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08,
	0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19,
	0x00, 0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x18,
	0x00, 0x16, 0x08, 0x06, 0x06, 0x01, 0x06, 0x03,
	0x08, 0x05, 0x05, 0x01, 0x05, 0x03, 0x08, 0x04,
	0x04, 0x01, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03,

};

static const uint8_t cipher_list_tls13_aes[] = {
	0x13, 0x02, 0x13, 0x03, 0x13, 0x01, 0xc0, 0x30,
	0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14,
	0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39,
	0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xff, 0x85,
	0x00, 0xc4, 0x00, 0x88, 0x00, 0x81, 0x00, 0x9d,
	0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0, 0x00, 0x84,
	0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67,
	0x00, 0x33, 0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c,
	0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41,
	0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05, 0xc0, 0x12,
	0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff,

};

static const uint8_t cipher_list_tls13_chacha[] = {
	0x13, 0x03, 0x13, 0x02, 0x13, 0x01, 0xcc, 0xa9,
	0xcc, 0xa8, 0xcc, 0xaa, 0xc0, 0x30, 0xc0, 0x2c,
	0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, 0xc0, 0x0a,
	0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39, 0xff, 0x85,
	0x00, 0xc4, 0x00, 0x88, 0x00, 0x81, 0x00, 0x9d,
	0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0, 0x00, 0x84,
	0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23,
	0xc0, 0x13, 0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67,
	0x00, 0x33, 0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c,
	0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41,
	0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05, 0xc0, 0x12,
	0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff,

};

static const uint8_t client_hello_tls13[] = {
	0x16, 0x03, 0x01, 0x01, 0x18, 0x01, 0x00, 0x01,
	0x14, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x13, 0x03,
	0x13, 0x02, 0x13, 0x01, 0xcc, 0xa9, 0xcc, 0xa8,
	0xcc, 0xaa, 0xc0, 0x30, 0xc0, 0x2c, 0xc0, 0x28,
	0xc0, 0x24, 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x9f,
	0x00, 0x6b, 0x00, 0x39, 0xff, 0x85, 0x00, 0xc4,
	0x00, 0x88, 0x00, 0x81, 0x00, 0x9d, 0x00, 0x3d,
	0x00, 0x35, 0x00, 0xc0, 0x00, 0x84, 0xc0, 0x2f,
	0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, 0xc0, 0x13,
	0xc0, 0x09, 0x00, 0x9e, 0x00, 0x67, 0x00, 0x33,
	0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c, 0x00, 0x3c,
	0x00, 0x2f, 0x00, 0xba, 0x00, 0x41, 0xc0, 0x11,
	0xc0, 0x07, 0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08,
	0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, 0x01, 0x00,
	0x00, 0x6b, 0x00, 0x2b, 0x00, 0x09, 0x08, 0x03,
	0x04, 0x03, 0x03, 0x03, 0x02, 0x03, 0x01, 0x00,
	0x33, 0x00, 0x26, 0x00, 0x24, 0x00, 0x1d, 0x00,
	0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00,
	0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x1d, 0x00,
	0x17, 0x00, 0x18, 0x00, 0x19, 0x00, 0x23, 0x00,
	0x00, 0x00, 0x0d, 0x00, 0x18, 0x00, 0x16, 0x08,
	0x06, 0x06, 0x01, 0x06, 0x03, 0x08, 0x05, 0x05,
	0x01, 0x05, 0x03, 0x08, 0x04, 0x04, 0x01, 0x04,
	0x03, 0x02, 0x01, 0x02, 0x03,
};

static const uint8_t cipher_list_tls13_only_aes[] = {
	0x13, 0x02, 0x13, 0x03, 0x13, 0x01,
};

static const uint8_t cipher_list_tls13_only_chacha[] = {
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
	0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x13, 0x03,
	0x13, 0x02, 0x13, 0x01, 0x00, 0xff, 0x01, 0x00,
	0x00, 0x61, 0x00, 0x2b, 0x00, 0x03, 0x02, 0x03,
	0x04, 0x00, 0x33, 0x00, 0x26, 0x00, 0x24, 0x00,
	0x1d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       
	0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x02, 0x01,
	0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00,
	0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x00,
	0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x14, 0x00,
	0x12, 0x08, 0x06, 0x06, 0x01, 0x06, 0x03, 0x08,
	0x05, 0x05, 0x01, 0x05, 0x03, 0x08, 0x04, 0x04,
	0x01, 0x04, 0x03,







|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
	0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x13, 0x03,
	0x13, 0x02, 0x13, 0x01, 0x00, 0xff, 0x01, 0x00,
	0x00, 0x61, 0x00, 0x2b, 0x00, 0x03, 0x02, 0x03,
	0x04, 0x00, 0x33, 0x00, 0x26, 0x00, 0x24, 0x00,
	0x1d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x02, 0x01,
	0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00,
	0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x00,
	0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x14, 0x00,
	0x12, 0x08, 0x06, 0x06, 0x01, 0x06, 0x03, 0x08,
	0x05, 0x05, 0x01, 0x05, 0x03, 0x08, 0x04, 0x04,
	0x01, 0x04, 0x03,
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
	char *client_hello = NULL;
	size_t client_hello_len;
	size_t session_len;
	char *wbuf, rbuf[1];
	int ret = 1;
	long len;

	fprintf(stderr, "Test %i - %s\n", testno, cht->desc);

	/* Providing a small buf causes *_get_server_hello() to return. */
	if ((rbio = BIO_new_mem_buf(rbuf, sizeof(rbuf))) == NULL) {
		fprintf(stderr, "Failed to setup rbio\n");
		goto failure;
	}
	if ((wbio = BIO_new(BIO_s_mem())) == NULL) {







|







621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
	char *client_hello = NULL;
	size_t client_hello_len;
	size_t session_len;
	char *wbuf, rbuf[1];
	int ret = 1;
	long len;

	fprintf(stderr, "Test %d - %s\n", testno, cht->desc);

	/* Providing a small buf causes *_get_server_hello() to return. */
	if ((rbio = BIO_new_mem_buf(rbuf, sizeof(rbuf))) == NULL) {
		fprintf(stderr, "Failed to setup rbio\n");
		goto failure;
	}
	if ((wbio = BIO_new(BIO_s_mem())) == NULL) {
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
	len = BIO_get_mem_data(wbio, &wbuf);

	if (make_client_hello(cht->protocol, &client_hello,
	    &client_hello_len) != 0)
		errx(1, "failed to make client hello");

	if ((size_t)len != client_hello_len) {
		fprintf(stderr, "FAIL: test returned ClientHello length %li, "
		    "want %zu\n", len, client_hello_len);
		fprintf(stderr, "received:\n");
		hexdump(wbuf, len, NULL);
		fprintf(stderr, "test data:\n");
		hexdump(client_hello, client_hello_len, NULL);
		fprintf(stderr, "\n");
		goto failure;







|







661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
	len = BIO_get_mem_data(wbio, &wbuf);

	if (make_client_hello(cht->protocol, &client_hello,
	    &client_hello_len) != 0)
		errx(1, "failed to make client hello");

	if ((size_t)len != client_hello_len) {
		fprintf(stderr, "FAIL: test returned ClientHello length %ld, "
		    "want %zu\n", len, client_hello_len);
		fprintf(stderr, "received:\n");
		hexdump(wbuf, len, NULL);
		fprintf(stderr, "test data:\n");
		hexdump(client_hello, client_hello_len, NULL);
		fprintf(stderr, "\n");
		goto failure;
Changes to jni/libressl/tests/cmstest.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: cmstest.c,v 1.4 2021/03/22 20:31:34 tb Exp $	*/
/*
 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: cmstest.c,v 1.5 2022/06/22 09:56:45 tb Exp $	*/
/*
 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
	if (!CMS_decrypt(ci, pkey, cert, NULL, bio_mem, 0)) {
		fprintf(stderr, "FAIL: CMS_decrypt failed\n");
		ERR_print_errors_fp(stderr);
		goto failure;
	}

	if ((len = BIO_get_mem_data(bio_mem, &p)) != strlen(cms_msg)) {
		fprintf(stderr, "FAIL: CMS decrypt returned %li bytes, "
		    "want %zi bytes\n", len, strlen(cms_msg));
		fprintf(stderr, "Got CMS data:\n");
		hexdump(p, len);
		fprintf(stderr, "Want CMS data:\n");
		hexdump(cms_msg, strlen(cms_msg));
		goto failure;
	}
	if (memcmp(p, cms_msg, len) != 0) {







|
|







163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
	if (!CMS_decrypt(ci, pkey, cert, NULL, bio_mem, 0)) {
		fprintf(stderr, "FAIL: CMS_decrypt failed\n");
		ERR_print_errors_fp(stderr);
		goto failure;
	}

	if ((len = BIO_get_mem_data(bio_mem, &p)) != strlen(cms_msg)) {
		fprintf(stderr, "FAIL: CMS decrypt returned %zu bytes, "
		    "want %zu bytes\n", len, strlen(cms_msg));
		fprintf(stderr, "Got CMS data:\n");
		hexdump(p, len);
		fprintf(stderr, "Want CMS data:\n");
		hexdump(cms_msg, strlen(cms_msg));
		goto failure;
	}
	if (memcmp(p, cms_msg, len) != 0) {
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
	if (!CMS_verify(ci, certs, store, NULL, bio_mem, 0)) {
		fprintf(stderr, "FAIL: CMS_verify failed\n");
		ERR_print_errors_fp(stderr);
		goto failure;
	}

	if ((len = BIO_get_mem_data(bio_mem, &p)) != strlen(cms_msg)) {
		fprintf(stderr, "FAIL: CMS verify returned %li bytes, "
		    "want %zi bytes\n", len, strlen(cms_msg));
		fprintf(stderr, "Got CMS data:\n");
		hexdump(p, len);
		fprintf(stderr, "Want CMS data:\n");
		hexdump(cms_msg, strlen(cms_msg));
		goto failure;
	}
	if (memcmp(p, cms_msg, len) != 0) {







|
|







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
	if (!CMS_verify(ci, certs, store, NULL, bio_mem, 0)) {
		fprintf(stderr, "FAIL: CMS_verify failed\n");
		ERR_print_errors_fp(stderr);
		goto failure;
	}

	if ((len = BIO_get_mem_data(bio_mem, &p)) != strlen(cms_msg)) {
		fprintf(stderr, "FAIL: CMS verify returned %zu bytes, "
		    "want %zu bytes\n", len, strlen(cms_msg));
		fprintf(stderr, "Got CMS data:\n");
		hexdump(p, len);
		fprintf(stderr, "Want CMS data:\n");
		hexdump(cms_msg, strlen(cms_msg));
		goto failure;
	}
	if (memcmp(p, cms_msg, len) != 0) {
Changes to jni/libressl/tests/constraints.c.
392
393
394
395
396
397
398




399
400
401
402
403
404
405
		"https://org#",
		"herp://beck@org:",
		"///",
		"//",
		"/",
		"",
		NULL,




	};
	for (i = 0; constraints[i] != NULL; i++) {
		char *constraint = constraints[i];
		size_t clen = strlen(constraints[i]);
		for (j = 0; matching[j] != NULL; j++) {
			if (!x509_constraints_domain(matching[j],
			    strlen(matching[j]), constraint, clen)) {







>
>
>
>







392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
		"https://org#",
		"herp://beck@org:",
		"///",
		"//",
		"/",
		"",
		NULL,
	};
	unsigned char *noauthority[] = {
		"urn:open62541.server.application",
		NULL,
	};
	for (i = 0; constraints[i] != NULL; i++) {
		char *constraint = constraints[i];
		size_t clen = strlen(constraints[i]);
		for (j = 0; matching[j] != NULL; j++) {
			if (!x509_constraints_domain(matching[j],
			    strlen(matching[j]), constraint, clen)) {
437
438
439
440
441
442
443






















444
445
446
447
448
449
450
			    strlen(failinguri[j]), constraint, clen, &error)) {
				FAIL("constraint '%s' should not have matched URI"
				    " '%s' (error %d)\n",
				    constraint, failinguri[j], error);
				failure = 1;
				goto done;
			}






















		}
	}
	c = ".openbsd.org";
	cl = strlen(".openbsd.org");
	d = "*.openbsd.org";
	dl = strlen("*.openbsd.org");
	if (!x509_constraints_domain(d, dl, c, cl)) {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
			    strlen(failinguri[j]), constraint, clen, &error)) {
				FAIL("constraint '%s' should not have matched URI"
				    " '%s' (error %d)\n",
				    constraint, failinguri[j], error);
				failure = 1;
				goto done;
			}
		}
		for (j = 0; noauthority[j] != NULL; j++) {
			error = 0;
			char *hostpart = NULL;
			if (!x509_constraints_uri_host(noauthority[j],
				strlen(noauthority[j]), &hostpart)) {
				FAIL("name '%s' should parse as a URI",
				    noauthority[j]);
				failure = 1;
				free(hostpart);
				goto done;
			}
			free(hostpart);

			if (x509_constraints_uri(noauthority[j],
			    strlen(noauthority[j]), constraint, clen, &error)) {
				FAIL("constraint '%s' should not have matched URI"
				    " '%s' (error %d)\n",
				    constraint, failinguri[j], error);
				failure = 1;
				goto done;
			}
		}
	}
	c = ".openbsd.org";
	cl = strlen(".openbsd.org");
	d = "*.openbsd.org";
	dl = strlen("*.openbsd.org");
	if (!x509_constraints_domain(d, dl, c, cl)) {
Changes to jni/libressl/tests/ecdsatest.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: ecdsatest.c,v 1.9 2022/03/31 09:36:09 tb Exp $	*/
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: ecdsatest.c,v 1.14 2022/09/02 11:47:25 tb Exp $	*/
/*
 * Written by Nils Larsch for the OpenSSL project.
 */
/* ====================================================================
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124

125
126
127
128

129
130
131
132
133
134
135

136
137
138
139
140

141
142
143
144
145


146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

164
165
166
167
168
169
170
171
172
173
174
175
176

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215

216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270

271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319

320

321
322
323
324
325
326
327
328
329
330
331
332
333
334






335
336

337
338
339
340
341
342
343
344
345
346
347
348
349
350
351






352
353

354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

379



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405

406

407
408
409
410
411
412
413


414
415
416
417
418
419
420
421
#include <openssl/ecdsa.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
#include <openssl/err.h>

/* declaration of the test functions */
int x9_62_test_internal(BIO *out, int nid, const char *r, const char *s);
int test_builtin(BIO *);

/* some tests from the X9.62 draft */
int
x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
{
	int	ret = 0;
	const char message[] = "abc";
	unsigned char digest[20];
	unsigned int  dgst_len = 0;
	EVP_MD_CTX *md_ctx = NULL;
	EC_KEY    *key = NULL;
	ECDSA_SIG *signature = NULL;
	BIGNUM    *r = NULL, *s = NULL;


	if ((md_ctx = EVP_MD_CTX_new()) == NULL)
		goto x962_int_err;
	/* get the message digest */
	if (!EVP_DigestInit(md_ctx, EVP_sha1()))
		goto x962_int_err;
	if (!EVP_DigestUpdate(md_ctx, (const void*)message, 3))
		goto x962_int_err;
	if (!EVP_DigestFinal(md_ctx, digest, &dgst_len))
		goto x962_int_err;

	BIO_printf(out, "testing %s: ", OBJ_nid2sn(nid));
	/* create the key */
	if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
		goto x962_int_err;
	if (!EC_KEY_generate_key(key))
		goto x962_int_err;

	BIO_printf(out, ".");
	(void)BIO_flush(out);
	/* create the signature */
	signature = ECDSA_do_sign(digest, 20, key);
	if (signature == NULL)
		goto x962_int_err;

	BIO_printf(out, ".");
	(void)BIO_flush(out);
	/* compare the created signature with the expected signature */
	if ((r = BN_new()) == NULL || (s = BN_new()) == NULL)

		goto x962_int_err;
	if (!BN_dec2bn(&r, r_in) ||
	    !BN_dec2bn(&s, s_in))
		goto x962_int_err;
	if (BN_cmp(ECDSA_SIG_get0_r(signature), r) ||
	    BN_cmp(ECDSA_SIG_get0_s(signature), s))
		goto x962_int_err;

	BIO_printf(out, ".");
	(void)BIO_flush(out);
	/* verify the signature */
	if (ECDSA_do_verify(digest, 20, signature, key) != 1)
		goto x962_int_err;

	BIO_printf(out, ".");
	(void)BIO_flush(out);

	BIO_printf(out, " ok\n");
	ret = 1;


 x962_int_err:
	if (!ret)
		BIO_printf(out, " failed\n");
	if (key)
		EC_KEY_free(key);
	if (signature)
		ECDSA_SIG_free(signature);
	if (r)
		BN_free(r);
	if (s)
		BN_free(s);
	EVP_MD_CTX_free(md_ctx);
	return ret;
}

int
test_builtin(BIO *out)
{

	EC_builtin_curve *curves = NULL;
	size_t		num_curves = 0, n = 0;
	EC_KEY		*eckey = NULL, *wrong_eckey = NULL;
	EC_GROUP	*group;
	ECDSA_SIG	*ecdsa_sig = NULL;
	BIGNUM		*r = NULL, *s = NULL;
	unsigned char	digest[20], wrong_digest[20];
	unsigned char	*signature = NULL;
	const unsigned char	*sig_ptr;
	unsigned char	*sig_ptr2;
	unsigned char	*raw_buf = NULL;
	unsigned int	sig_len, degree, r_len, s_len, bn_len, buf_len;
	int		nid, ret =  0;


	/* fill digest values with some random data */
	arc4random_buf(digest, 20);
	arc4random_buf(wrong_digest, 20);

	/* create and verify a ecdsa signature with every available curve */
	BIO_printf(out, "\ntesting ECDSA_sign() and ECDSA_verify() "
		"with some internal curves:\n");

	/* get a list of all internal curves */
	num_curves = EC_get_builtin_curves(NULL, 0);

	curves = reallocarray(NULL, sizeof(EC_builtin_curve), num_curves);

	if (curves == NULL) {
		BIO_printf(out, "reallocarray error\n");
		goto builtin_err;
	}

	if (!EC_get_builtin_curves(curves, num_curves)) {
		BIO_printf(out, "unable to get internal curves\n");
		goto builtin_err;
	}

	/* now create and verify a signature for every curve */
	for (n = 0; n < num_curves; n++) {
		unsigned char dirt, offset;

		nid = curves[n].nid;
		if (nid == NID_ipsec4)
			continue;
		/* create new ecdsa key (== EC_KEY) */
		if ((eckey = EC_KEY_new()) == NULL)
			goto builtin_err;
		group = EC_GROUP_new_by_curve_name(nid);
		if (group == NULL)
			goto builtin_err;
		if (EC_KEY_set_group(eckey, group) == 0)
			goto builtin_err;

		EC_GROUP_free(group);
		degree = EC_GROUP_get_degree(EC_KEY_get0_group(eckey));
		if (degree < 160) {
			/* drop the curve */
			EC_KEY_free(eckey);
			eckey = NULL;
			continue;
		}
		BIO_printf(out, "%s: ", OBJ_nid2sn(nid));
		/* create key */
		if (!EC_KEY_generate_key(eckey)) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		/* create second key */
		if ((wrong_eckey = EC_KEY_new()) == NULL)
			goto builtin_err;
		group = EC_GROUP_new_by_curve_name(nid);
		if (group == NULL)
			goto builtin_err;
		if (EC_KEY_set_group(wrong_eckey, group) == 0)
			goto builtin_err;
		EC_GROUP_free(group);
		if (!EC_KEY_generate_key(wrong_eckey)) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}

		BIO_printf(out, ".");
		(void)BIO_flush(out);
		/* check key */
		if (!EC_KEY_check_key(eckey)) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		BIO_printf(out, ".");
		(void)BIO_flush(out);
		/* create signature */
		sig_len = ECDSA_size(eckey);

		if ((signature = malloc(sig_len)) == NULL)
			goto builtin_err;
		if (!ECDSA_sign(0, digest, 20, signature, &sig_len, eckey)) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		BIO_printf(out, ".");
		(void)BIO_flush(out);
		/* verify signature */
		if (ECDSA_verify(0, digest, 20, signature, sig_len,
		    eckey) != 1) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		BIO_printf(out, ".");
		(void)BIO_flush(out);

		/* verify signature with the wrong key */
		if (ECDSA_verify(0, digest, 20, signature, sig_len,
			wrong_eckey) == 1) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		BIO_printf(out, ".");
		(void)BIO_flush(out);
		/* wrong digest */
		if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,
		    eckey) == 1) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		BIO_printf(out, ".");
		(void)BIO_flush(out);
		/* wrong length */
		if (ECDSA_verify(0, digest, 20, signature, sig_len - 1,
		    eckey) == 1) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		BIO_printf(out, ".");
		(void)BIO_flush(out);

		/*
		 * Modify a single byte of the signature: to ensure we don't
		 * garble the ASN1 structure, we read the raw signature and
		 * modify a byte in one of the bignums directly.
		 */
		sig_ptr = signature;
		if ((ecdsa_sig = d2i_ECDSA_SIG(NULL, &sig_ptr,
		    sig_len)) == NULL) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}

		/* Store the two BIGNUMs in raw_buf. */
		r_len = BN_num_bytes(ECDSA_SIG_get0_r(ecdsa_sig));
		s_len = BN_num_bytes(ECDSA_SIG_get0_s(ecdsa_sig));
		bn_len = (degree + 7) / 8;
		if ((r_len > bn_len) || (s_len > bn_len)) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		buf_len = 2 * bn_len;
		if ((raw_buf = calloc(1, buf_len)) == NULL)
			goto builtin_err;
		BN_bn2bin(ECDSA_SIG_get0_r(ecdsa_sig), raw_buf + bn_len - r_len);

		BN_bn2bin(ECDSA_SIG_get0_s(ecdsa_sig), raw_buf + buf_len - s_len);


		/* Modify a single byte in the buffer. */
		offset = raw_buf[10] % buf_len;
		dirt   = raw_buf[11] ? raw_buf[11] : 1;
		raw_buf[offset] ^= dirt;
		/* Now read the BIGNUMs back in from raw_buf. */
		if ((r = BN_bin2bn(raw_buf, bn_len, NULL)) == NULL ||
		    (s = BN_bin2bn(raw_buf + bn_len, bn_len, NULL)) == NULL)
			goto builtin_err;
		if (!ECDSA_SIG_set0(ecdsa_sig, r, s))
			goto builtin_err;
		r = NULL;
		s = NULL;







		sig_ptr2 = signature;
		sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);

		if (ECDSA_verify(0, digest, 20, signature, sig_len,
		    eckey) == 1) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		/* Sanity check: undo the modification and verify signature. */
		raw_buf[offset] ^= dirt;
		if ((r = BN_bin2bn(raw_buf, bn_len, NULL)) == NULL ||
		    (s = BN_bin2bn(raw_buf + bn_len, bn_len, NULL)) == NULL)
			goto builtin_err;
		if (!ECDSA_SIG_set0(ecdsa_sig, r, s))
			goto builtin_err;
		r = NULL;
		s = NULL;







		sig_ptr2 = signature;
		sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);

		if (ECDSA_verify(0, digest, 20, signature, sig_len,
		    eckey) != 1) {
			BIO_printf(out, " failed\n");
			goto builtin_err;
		}
		BIO_printf(out, ".");
		(void)BIO_flush(out);

		BIO_printf(out, " ok\n");
		/* cleanup */
		/* clean bogus errors */
		ERR_clear_error();
		free(signature);
		signature = NULL;
		EC_KEY_free(eckey);
		eckey = NULL;
		EC_KEY_free(wrong_eckey);
		wrong_eckey = NULL;
		ECDSA_SIG_free(ecdsa_sig);
		ecdsa_sig = NULL;
		free(raw_buf);
		raw_buf = NULL;
	}

	ret = 1;

 builtin_err:



	BN_free(r);
	BN_free(s);
	EC_KEY_free(eckey);
	EC_KEY_free(wrong_eckey);
	ECDSA_SIG_free(ecdsa_sig);
	free(signature);
	free(raw_buf);
	free(curves);

	return ret;
}

int
main(void)
{
	int 	ret = 1;
	BIO	*out;

	out = BIO_new_fp(stdout, BIO_NOCLOSE);

	ERR_load_crypto_strings();

	/* the tests */
	if (!test_builtin(out))
		goto err;


	ret = 0;

 err:
	if (ret)
		BIO_printf(out, "\nECDSA test failed\n");
	else
		BIO_printf(out, "\nECDSA test passed\n");
	if (ret)
		ERR_print_errors(out);


	CRYPTO_cleanup_all_ex_data();
	ERR_remove_thread_state(NULL);
	ERR_free_strings();
	CRYPTO_mem_leaks(out);
	if (out != NULL)
		BIO_free(out);
	return ret;
}







|
|



|

|


|
<
|

|
>


|
|

|
|
|

|

|
|

|

|
>
|
|
|
|
<
|
>
|
|
|
<
>
|
<
<
<


|
>
|
|
|

|
>
|
|

|
|
>
>
|
|
|
<
|
<
|
<
|
<
|

|



|

>

|
|
|
|
|
<
|
|
|
|
|
|
>






|
|





<

|
|



|
|









|

|


|

|
>

<






|
|

<
|

|

|


|

|

|
<
|
|
<
|
|
|
|
<
|
|
|
|
|
|
>

|
|
<
|
|
|
|
|
|
<
<
|
|
|
|
>


|
<
|
|
|
|
|

|
<
|
|
|
|
|

|
<
|
|
|
|








|
<
|
<





|
<
|
|


|
|
>
|
>



|




|

|



>
>
>
>
>
>

|
>
|
<
<
|
|




|

|



>
>
>
>
>
>

|
>

|
<
|
|
|
|

|
|
<













|
>
|
>
>
>









|





<
<
|
<

<
<

|


>
|
>

|
|
<
<
<
|
>
>



|
<
<
|

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

124
125
126
127
128

129
130



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

151

152

153

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215

216
217
218
219
220
221
222
223
224

225
226
227
228
229
230
231
232
233
234
235
236

237
238

239
240
241
242

243
244
245
246
247
248
249
250
251
252

253
254
255
256
257
258


259
260
261
262
263
264
265
266

267
268
269
270
271
272
273

274
275
276
277
278
279
280

281
282
283
284
285
286
287
288
289
290
291
292
293

294

295
296
297
298
299
300

301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333


334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

357
358
359
360
361
362
363

364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397


398

399


400
401
402
403
404
405
406
407
408
409



410
411
412
413
414
415
416


417
418
#include <openssl/ecdsa.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
#include <openssl/err.h>

/* declaration of the test functions */
int x9_62_test_internal(int nid, const char *r, const char *s);
int test_builtin(void);

/* some tests from the X9.62 draft */
int
x9_62_test_internal(int nid, const char *r_in, const char *s_in)
{
	EVP_MD_CTX *md_ctx = NULL;
	const char message[] = "abc";
	unsigned char digest[20];
	unsigned int dgst_len = 0;

	EC_KEY *key = NULL;
	ECDSA_SIG *signature = NULL;
	BIGNUM *r = NULL, *s = NULL;
	int failed = 1;

	if ((md_ctx = EVP_MD_CTX_new()) == NULL)
		goto err;

	if (!EVP_DigestInit(md_ctx, EVP_sha1()))
		goto err;
	if (!EVP_DigestUpdate(md_ctx, message, 3))
		goto err;
	if (!EVP_DigestFinal(md_ctx, digest, &dgst_len))
		goto err;

	printf("testing %s: ", OBJ_nid2sn(nid));

	if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
		goto err;
	if (!EC_KEY_generate_key(key))
		goto err;

	printf(".");
	fflush(stdout);

	if ((signature = ECDSA_do_sign(digest, 20, key)) == NULL)

		goto err;

	printf(".");
	fflush(stdout);


	if (!BN_dec2bn(&r, r_in) || !BN_dec2bn(&s, s_in))
		goto err;



	if (BN_cmp(ECDSA_SIG_get0_r(signature), r) ||
	    BN_cmp(ECDSA_SIG_get0_s(signature), s))
		goto err;

	printf(".");
	fflush(stdout);

	if (ECDSA_do_verify(digest, 20, signature, key) != 1)
		goto err;

	printf(".");
	fflush(stdout);

	printf(" ok\n");

	failed = 0;

 err:
	if (failed)
		printf(" failed\n");

	EC_KEY_free(key);

	ECDSA_SIG_free(signature);

	BN_free(r);

	BN_free(s);
	EVP_MD_CTX_free(md_ctx);
	return failed;
}

int
test_builtin(void)
{
	unsigned char digest[20], wrong_digest[20];
	EC_builtin_curve *curves = NULL;
	size_t num_curves = 0, n = 0;
	EC_KEY *eckey = NULL, *wrong_eckey = NULL;
	EC_GROUP *group;
	ECDSA_SIG *ecdsa_sig = NULL;
	BIGNUM *r = NULL, *s = NULL;

	unsigned char *signature = NULL;
	const unsigned char *sig_ptr;
	unsigned char *sig_ptr2;
	unsigned char *raw_buf = NULL;
	unsigned int sig_len, degree, r_len, s_len, bn_len, buf_len;
	int nid;
	int failed = 1;

	/* fill digest values with some random data */
	arc4random_buf(digest, 20);
	arc4random_buf(wrong_digest, 20);

	/* create and verify a ecdsa signature with every available curve */
	printf("\ntesting ECDSA_sign() and ECDSA_verify() "
	    "with some internal curves:\n");

	/* get a list of all internal curves */
	num_curves = EC_get_builtin_curves(NULL, 0);

	curves = reallocarray(NULL, sizeof(EC_builtin_curve), num_curves);

	if (curves == NULL) {
		printf("reallocarray error\n");
		goto err;
	}

	if (!EC_get_builtin_curves(curves, num_curves)) {
		printf("unable to get internal curves\n");
		goto err;
	}

	/* now create and verify a signature for every curve */
	for (n = 0; n < num_curves; n++) {
		unsigned char dirt, offset;

		nid = curves[n].nid;
		if (nid == NID_ipsec4)
			continue;

		if ((eckey = EC_KEY_new()) == NULL)
			goto err;
		group = EC_GROUP_new_by_curve_name(nid);
		if (group == NULL)
			goto err;
		if (EC_KEY_set_group(eckey, group) == 0)
			goto err;
		degree = EC_GROUP_get_degree(group);
		EC_GROUP_free(group);

		if (degree < 160) {
			/* drop the curve */
			EC_KEY_free(eckey);
			eckey = NULL;
			continue;
		}
		printf("%s: ", OBJ_nid2sn(nid));

		if (!EC_KEY_generate_key(eckey)) {

			goto err;
		}

		if ((wrong_eckey = EC_KEY_new()) == NULL)
			goto err;
		group = EC_GROUP_new_by_curve_name(nid);
		if (group == NULL)
			goto err;
		if (EC_KEY_set_group(wrong_eckey, group) == 0)
			goto err;
		EC_GROUP_free(group);
		if (!EC_KEY_generate_key(wrong_eckey))

			goto err;


		printf(".");
		fflush(stdout);

		if (!EC_KEY_check_key(eckey))

			goto err;

		printf(".");
		fflush(stdout);

		if ((sig_len = ECDSA_size(eckey)) == 0)
			goto err;
		if ((signature = malloc(sig_len)) == NULL)
			goto err;
		if (!ECDSA_sign(0, digest, 20, signature, &sig_len, eckey))

			goto err;

		printf(".");
		fflush(stdout);

		if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)


			goto err;

		printf(".");
		fflush(stdout);

		/* verify signature with the wrong key */
		if (ECDSA_verify(0, digest, 20, signature, sig_len,
		    wrong_eckey) == 1)

			goto err;

		printf(".");
		fflush(stdout);

		if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,
		    eckey) == 1)

			goto err;

		printf(".");
		fflush(stdout);

		if (ECDSA_verify(0, digest, 20, signature, sig_len - 1,
		    eckey) == 1)

			goto err;

		printf(".");
		fflush(stdout);

		/*
		 * Modify a single byte of the signature: to ensure we don't
		 * garble the ASN1 structure, we read the raw signature and
		 * modify a byte in one of the bignums directly.
		 */
		sig_ptr = signature;
		if ((ecdsa_sig = d2i_ECDSA_SIG(NULL, &sig_ptr,
		    sig_len)) == NULL)

			goto err;


		/* Store the two BIGNUMs in raw_buf. */
		r_len = BN_num_bytes(ECDSA_SIG_get0_r(ecdsa_sig));
		s_len = BN_num_bytes(ECDSA_SIG_get0_s(ecdsa_sig));
		bn_len = (degree + 7) / 8;
		if ((r_len > bn_len) || (s_len > bn_len))

			goto err;

		buf_len = 2 * bn_len;
		if ((raw_buf = calloc(1, buf_len)) == NULL)
			goto err;
		BN_bn2bin(ECDSA_SIG_get0_r(ecdsa_sig),
		    raw_buf + bn_len - r_len);
		BN_bn2bin(ECDSA_SIG_get0_s(ecdsa_sig),
		    raw_buf + buf_len - s_len);

		/* Modify a single byte in the buffer. */
		offset = raw_buf[10] % buf_len;
		dirt = raw_buf[11] ? raw_buf[11] : 1;
		raw_buf[offset] ^= dirt;
		/* Now read the BIGNUMs back in from raw_buf. */
		if ((r = BN_bin2bn(raw_buf, bn_len, NULL)) == NULL ||
		    (s = BN_bin2bn(raw_buf + bn_len, bn_len, NULL)) == NULL)
			goto err;
		if (!ECDSA_SIG_set0(ecdsa_sig, r, s))
			goto err;
		r = NULL;
		s = NULL;

		if ((sig_len = i2d_ECDSA_SIG(ecdsa_sig, NULL)) <= 0)
			goto err;
		free(signature);
		if ((signature = calloc(1, sig_len)) == NULL)
			goto err;

		sig_ptr2 = signature;
		if ((sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2)) <= 0)
			goto err;
		if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1)


			goto err;

		/* Sanity check: undo the modification and verify signature. */
		raw_buf[offset] ^= dirt;
		if ((r = BN_bin2bn(raw_buf, bn_len, NULL)) == NULL ||
		    (s = BN_bin2bn(raw_buf + bn_len, bn_len, NULL)) == NULL)
			goto err;
		if (!ECDSA_SIG_set0(ecdsa_sig, r, s))
			goto err;
		r = NULL;
		s = NULL;

		if ((sig_len = i2d_ECDSA_SIG(ecdsa_sig, NULL)) <= 0)
			goto err;
		free(signature);
		if ((signature = calloc(1, sig_len)) == NULL)
			goto err;

		sig_ptr2 = signature;
		if ((sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2)) <= 0)
			goto err;
		if (ECDSA_verify(0, digest, 20, signature, sig_len,
		    eckey) != 1)

			goto err;

		printf(".");
		fflush(stdout);

		printf(" ok\n");


		ERR_clear_error();
		free(signature);
		signature = NULL;
		EC_KEY_free(eckey);
		eckey = NULL;
		EC_KEY_free(wrong_eckey);
		wrong_eckey = NULL;
		ECDSA_SIG_free(ecdsa_sig);
		ecdsa_sig = NULL;
		free(raw_buf);
		raw_buf = NULL;
	}

	failed = 0;

 err:
	if (failed)
		printf(" failed\n");

	BN_free(r);
	BN_free(s);
	EC_KEY_free(eckey);
	EC_KEY_free(wrong_eckey);
	ECDSA_SIG_free(ecdsa_sig);
	free(signature);
	free(raw_buf);
	free(curves);

	return failed;
}

int
main(void)
{


	int failed = 1;




	/* the tests */
	if (test_builtin())
		goto err;

	printf("\nECDSA test passed\n");
	failed = 0;

 err:
	if (failed) {
		printf("\nECDSA test failed\n");



		ERR_print_errors_fp(stdout);
	}

	CRYPTO_cleanup_all_ex_data();
	ERR_remove_thread_state(NULL);
	ERR_free_strings();



	return failed;
}
Changes to jni/libressl/tests/enginetest.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: enginetest.c,v 1.8 2018/07/17 17:06:49 tb Exp $	*/
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 1999-2001 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: enginetest.c,v 1.9 2022/09/05 21:06:31 tb Exp $	*/
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
 * project 2000.
 */
/* ====================================================================
 * Copyright (c) 1999-2001 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	ENGINE *h;
	int loop;

	h = ENGINE_get_first();
	loop = 0;
	printf("listing available engine types\n");
	while (h) {
		printf("engine %i, id = \"%s\", name = \"%s\"\n",
		    loop++, ENGINE_get_id(h), ENGINE_get_name(h));
		h = ENGINE_get_next(h);
	}

	printf("end of list\n");
	/*
	 * ENGINE_get_first() increases the struct_ref counter, so we must call







|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	ENGINE *h;
	int loop;

	h = ENGINE_get_first();
	loop = 0;
	printf("listing available engine types\n");
	while (h) {
		printf("engine %d, id = \"%s\", name = \"%s\"\n",
		    loop++, ENGINE_get_id(h), ENGINE_get_name(h));
		h = ENGINE_get_next(h);
	}

	printf("end of list\n");
	/*
	 * ENGINE_get_first() increases the struct_ref counter, so we must call
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		printf("Couldn't add and remove to an empty list!\n");
		goto end;
	} else
		printf("Successfully added and removed to an empty list!\n");

	printf("About to beef up the engine-type list\n");
	for (loop = 0; loop < 512; loop++) {
		if (asprintf(&id, "id%i", loop) == -1)
			goto end;
		if (asprintf(&name, "Fake engine type %i", loop) == -1)
			goto end;

		if (((block[loop] = ENGINE_new()) == NULL) ||
		    !id || !ENGINE_set_id(block[loop], id) ||
		    !name || !ENGINE_set_name(block[loop], name)) {
			printf("Couldn't create block of ENGINE structures.\n");
			goto end;
		}
	}

	for (loop = 0; loop < 512; loop++) {
		if (!ENGINE_add(block[loop])) {
			printf("\nAdding stopped at %i, (%s,%s)\n",
				loop, ENGINE_get_id(block[loop]),
				ENGINE_get_name(block[loop]));
			break;
		}
		printf(".");
		fflush(stdout);
	}







|

|












|







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		printf("Couldn't add and remove to an empty list!\n");
		goto end;
	} else
		printf("Successfully added and removed to an empty list!\n");

	printf("About to beef up the engine-type list\n");
	for (loop = 0; loop < 512; loop++) {
		if (asprintf(&id, "id%d", loop) == -1)
			goto end;
		if (asprintf(&name, "Fake engine type %d", loop) == -1)
			goto end;

		if (((block[loop] = ENGINE_new()) == NULL) ||
		    !id || !ENGINE_set_id(block[loop], id) ||
		    !name || !ENGINE_set_name(block[loop], name)) {
			printf("Couldn't create block of ENGINE structures.\n");
			goto end;
		}
	}

	for (loop = 0; loop < 512; loop++) {
		if (!ENGINE_add(block[loop])) {
			printf("\nAdding stopped at %d, (%s,%s)\n",
				loop, ENGINE_get_id(block[loop]),
				ENGINE_get_name(block[loop]));
			break;
		}
		printf(".");
		fflush(stdout);
	}
Changes to jni/libressl/tests/gcm128test.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: gcm128test.c,v 1.6 2018/07/17 17:06:49 tb Exp $	*/
/* ====================================================================
 * Copyright (c) 2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: gcm128test.c,v 1.7 2022/09/05 21:06:31 tb Exp $	*/
/* ====================================================================
 * Copyright (c) 2010 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
	CRYPTO_gcm128_init(&ctx, &key, (block128_f)AES_encrypt);
	CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len);
	if (tv->A_len > 0)
		CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len);
	if (tv->P_len > 0)
		CRYPTO_gcm128_encrypt(&ctx, tv->P, out, out_len);
	if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) {
		fprintf(stderr, "TEST %i: CRYPTO_gcm128_finish failed\n",
		    test_no);
		goto fail;
	}
	if (tv->C_len > 0 && memcmp(out, tv->C, out_len)) {
		fprintf(stderr, "TEST %i: encrypt failed\n", test_no);
		goto fail;
	}

	if (out_len != 0)
		memset(out, 0, out_len);
	CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len);
	if (tv->A_len > 0)
		CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len);
	if (tv->C_len > 0)
		CRYPTO_gcm128_decrypt(&ctx, tv->C, out, out_len);
	if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) {
		fprintf(stderr, "TEST %i: CRYPTO_gcm128_finish failed\n",
		    test_no);
		goto fail;
	}
	if (tv->P_len > 0 && memcmp(out, tv->P, out_len)) {
		fprintf(stderr, "TEST %i: decrypt failed\n", test_no);
		goto fail;
	}

	ret = 0;

fail:
	free(out);







|




|











|




|







876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
	CRYPTO_gcm128_init(&ctx, &key, (block128_f)AES_encrypt);
	CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len);
	if (tv->A_len > 0)
		CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len);
	if (tv->P_len > 0)
		CRYPTO_gcm128_encrypt(&ctx, tv->P, out, out_len);
	if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) {
		fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n",
		    test_no);
		goto fail;
	}
	if (tv->C_len > 0 && memcmp(out, tv->C, out_len)) {
		fprintf(stderr, "TEST %d: encrypt failed\n", test_no);
		goto fail;
	}

	if (out_len != 0)
		memset(out, 0, out_len);
	CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len);
	if (tv->A_len > 0)
		CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len);
	if (tv->C_len > 0)
		CRYPTO_gcm128_decrypt(&ctx, tv->C, out, out_len);
	if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) {
		fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n",
		    test_no);
		goto fail;
	}
	if (tv->P_len > 0 && memcmp(out, tv->P, out_len)) {
		fprintf(stderr, "TEST %d: decrypt failed\n", test_no);
		goto fail;
	}

	ret = 0;

fail:
	free(out);
Changes to jni/libressl/tests/gost2814789t.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: gost2814789t.c,v 1.7 2022/02/08 17:59:39 tb Exp $	*/
/* vim: set fileencoding=ascii : Charset: ASCII */
/* test/gostr2814789t.c */
/* ====================================================================
 * Copyright (c) 2012 Crypto-Pro, Ltd., Serguei E. Leontiev,
 *                    lse@cryptopro.ru
 *
 * This file is distributed under the same license as OpenSSL
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: gost2814789t.c,v 1.8 2022/09/12 04:20:59 tb Exp $	*/
/* vim: set fileencoding=ascii : Charset: ASCII */
/* test/gostr2814789t.c */
/* ====================================================================
 * Copyright (c) 2012 Crypto-Pro, Ltd., Serguei E. Leontiev,
 *                    lse@cryptopro.ru
 *
 * This file is distributed under the same license as OpenSSL
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346

1347
1348
1349
1350
1351
1352
1353
    }

	/* Test cases */
    for(t = 0; t < sizeof(tcs)/sizeof(tcs[0]); t++) {
	if(NULL != tcs[t].szDerive) {
	memset(bDerive, 0x3c, sizeof(bDerive));
	mdl = sizeof(bDerive);
	EVP_Digest(tcs[t].szDerive, strlen(tcs[t].szDerive),
			bDerive, &mdl,
			md_gost94, NULL);

	if(0 != memcmp(tcs[t].bRawKey, bDerive, mdl)) {
	    fflush(NULL);
	    fprintf(stderr, "Engine test t=%d "
			"derive key error.\n", t);
	    if(!ignore) {
		ret = 12;
		goto out;







|
<
|
>







1337
1338
1339
1340
1341
1342
1343
1344

1345
1346
1347
1348
1349
1350
1351
1352
1353
    }

	/* Test cases */
    for(t = 0; t < sizeof(tcs)/sizeof(tcs[0]); t++) {
	if(NULL != tcs[t].szDerive) {
	memset(bDerive, 0x3c, sizeof(bDerive));
	mdl = sizeof(bDerive);
	if (!EVP_Digest(tcs[t].szDerive, strlen(tcs[t].szDerive), bDerive,

	    &mdl, md_gost94, NULL))
		goto out;
	if(0 != memcmp(tcs[t].bRawKey, bDerive, mdl)) {
	    fflush(NULL);
	    fprintf(stderr, "Engine test t=%d "
			"derive key error.\n", t);
	    if(!ignore) {
		ret = 12;
		goto out;
1369
1370
1371
1372
1373
1374
1375
1376
1377

1378


1379
1380
1381
1382

1383
1384
1385
1386
1387
1388
1389
1390
1391
1392

1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406


1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420


1421
1422
1423

1424
1425
1426
1427
1428
1429
1430

1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
	    ctype = cp_g89cfb;
	    goto engine_cipher_check;
	case G89_CNT:
	    ctype = cp_g89cnt;
engine_cipher_check:
	    if ((ectx = EVP_CIPHER_CTX_new()) == NULL)
		    goto imit_fail;
	    EVP_EncryptInit_ex(ectx, ctype, NULL,
				    tcs[t].bRawKey, tcs[t].bIV);

	    EVP_CIPHER_CTX_ctrl(ectx, EVP_CTRL_GOST_SET_SBOX, OBJ_txt2nid(tcs[t].szParamSet), 0);


	    if(G89_MAX_TC_LEN >= tcs[t].ullLen) {
		enlu = sizeof(bTest);
		EVP_EncryptUpdate(ectx, bTest, &enlu,
				    tcs[t].bIn, (int)tcs[t].ullLen);

		l = (size_t)tcs[t].ullLen;
	    } else {
		for(ullLeft = tcs[t].ullLen;
			    ullLeft >= sizeof(bZB);
				    ullLeft -= sizeof(bZB)) {
		    printf("B");
		    fflush(NULL);
		    enlu = sizeof(bTS);
		    EVP_EncryptUpdate(ectx, bTS, &enlu,
					    bZB, sizeof(bZB));

		}
		printf("b%" PRIu64 "/%" PRIu64, ullLeft, tcs[t].ullLen);
		fflush(NULL);
		EVP_EncryptUpdate(ectx, bTS, &enlu,
					bZB, (int)ullLeft);
		memcpy(bTest, &bTS[enlu-16], 16);
		enlu = (int)tcs[t].ullLen;
		l = 16;
	    }
	    enlf = sizeof(bTest1);
	    if (tcs[t].gMode == G89_ECB)
		enlf = 0;
	    else
		EVP_EncryptFinal_ex(ectx, bTest1, &enlf);


	    EVP_CIPHER_CTX_free(ectx);
	    ectx = NULL;
	    break;
	case G89_IMIT:
	    if ((mctx = EVP_MD_CTX_new()) == NULL)
		    goto imit_fail;
	    mac_key = EVP_PKEY_new_mac_key(
				NID_id_Gost28147_89_MAC, NULL,
				bDerive, mdl);
	    if (!mac_key)
		goto imit_fail;
            EVP_DigestSignInit(mctx, NULL,
				    md_g89imit, NULL, mac_key);
	    EVP_MD_CTX_ctrl(mctx, EVP_MD_CTRL_GOST_SET_SBOX, OBJ_txt2nid(tcs[t].szParamSet), 0);


	    if(G89_MAX_TC_LEN >= tcs[t].ullLen) {
		EVP_DigestSignUpdate(mctx, tcs[t].bIn,
				    (unsigned int)tcs[t].ullLen);

	    } else {
		for(ullLeft = tcs[t].ullLen;
			    ullLeft >= sizeof(bZB);
				    ullLeft -= sizeof(bZB)) {
		    printf("B");
		    fflush(NULL);
		    EVP_DigestSignUpdate(mctx, bZB, sizeof(bZB));

		}
		printf("b%" PRIu64 "/%" PRIu64, ullLeft, tcs[t].ullLen);
		fflush(NULL);
		EVP_DigestSignUpdate(mctx, bZB,
					(unsigned int)ullLeft);
	    }
	    siglen = 4;
	    OPENSSL_assert(EVP_DigestSignFinal(mctx, bTest, &siglen));
	    EVP_MD_CTX_free(mctx);
	    mctx = NULL;
	    EVP_PKEY_free(mac_key);
	    enlu = (int)tcs[t].ullLen;







|
|
>
|
>
>


|
|
>








|
|
>



|
|







|
|
>
>









|
|
|
|
|
>
>

|
|
>






|
>



|
|







1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
	    ctype = cp_g89cfb;
	    goto engine_cipher_check;
	case G89_CNT:
	    ctype = cp_g89cnt;
engine_cipher_check:
	    if ((ectx = EVP_CIPHER_CTX_new()) == NULL)
		    goto imit_fail;
	    if (!EVP_EncryptInit_ex(ectx, ctype, NULL, tcs[t].bRawKey,
		tcs[t].bIV))
		    goto imit_fail;
	    if (!EVP_CIPHER_CTX_ctrl(ectx, EVP_CTRL_GOST_SET_SBOX,
		OBJ_txt2nid(tcs[t].szParamSet), 0))
		    goto imit_fail;
	    if(G89_MAX_TC_LEN >= tcs[t].ullLen) {
		enlu = sizeof(bTest);
		if (!EVP_EncryptUpdate(ectx, bTest, &enlu, tcs[t].bIn,
		    (int)tcs[t].ullLen))
			goto imit_fail;
		l = (size_t)tcs[t].ullLen;
	    } else {
		for(ullLeft = tcs[t].ullLen;
			    ullLeft >= sizeof(bZB);
				    ullLeft -= sizeof(bZB)) {
		    printf("B");
		    fflush(NULL);
		    enlu = sizeof(bTS);
		    if (!EVP_EncryptUpdate(ectx, bTS, &enlu, bZB,
			sizeof(bZB)))
			    goto imit_fail;
		}
		printf("b%" PRIu64 "/%" PRIu64, ullLeft, tcs[t].ullLen);
		fflush(NULL);
		if (!EVP_EncryptUpdate(ectx, bTS, &enlu, bZB, (int)ullLeft))
			goto imit_fail;
		memcpy(bTest, &bTS[enlu-16], 16);
		enlu = (int)tcs[t].ullLen;
		l = 16;
	    }
	    enlf = sizeof(bTest1);
	    if (tcs[t].gMode == G89_ECB)
		enlf = 0;
	    else {
		if (!EVP_EncryptFinal_ex(ectx, bTest1, &enlf))
			goto imit_fail;
	    }
	    EVP_CIPHER_CTX_free(ectx);
	    ectx = NULL;
	    break;
	case G89_IMIT:
	    if ((mctx = EVP_MD_CTX_new()) == NULL)
		    goto imit_fail;
	    mac_key = EVP_PKEY_new_mac_key(
				NID_id_Gost28147_89_MAC, NULL,
				bDerive, mdl);
	    if (mac_key == NULL)
		    goto imit_fail;
            if (!EVP_DigestSignInit(mctx, NULL, md_g89imit, NULL, mac_key))
		    goto imit_fail;
	    if (!EVP_MD_CTX_ctrl(mctx, EVP_MD_CTRL_GOST_SET_SBOX,
		OBJ_txt2nid(tcs[t].szParamSet), 0))
		    goto imit_fail;
	    if(G89_MAX_TC_LEN >= tcs[t].ullLen) {
		if (!EVP_DigestSignUpdate(mctx, tcs[t].bIn,
		    (unsigned int)tcs[t].ullLen))
			goto imit_fail;
	    } else {
		for(ullLeft = tcs[t].ullLen;
			    ullLeft >= sizeof(bZB);
				    ullLeft -= sizeof(bZB)) {
		    printf("B");
		    fflush(NULL);
		    if (!EVP_DigestSignUpdate(mctx, bZB, sizeof(bZB)))
			    goto imit_fail;
		}
		printf("b%" PRIu64 "/%" PRIu64, ullLeft, tcs[t].ullLen);
		fflush(NULL);
		if (!EVP_DigestSignUpdate(mctx, bZB, (unsigned int)ullLeft))
			goto imit_fail;
	    }
	    siglen = 4;
	    OPENSSL_assert(EVP_DigestSignFinal(mctx, bTest, &siglen));
	    EVP_MD_CTX_free(mctx);
	    mctx = NULL;
	    EVP_PKEY_free(mac_key);
	    enlu = (int)tcs[t].ullLen;
Deleted jni/libressl/tests/md4test.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*	$OpenBSD: md4test.c,v 1.4 2018/07/17 17:06:49 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 * 
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from 
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 * 
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <openssl/evp.h>
#include <openssl/md4.h>

static char *test[]={
	"",
	"a",
	"abc",
	"message digest",
	"abcdefghijklmnopqrstuvwxyz",
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
	"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
	NULL,
	};

static char *ret[]={
"31d6cfe0d16ae931b73c59d7e0c089c0",
"bde52cb31de33e46245e05fbdbd6fb24",
"a448017aaf21d8525fc10ae87aa6729d",
"d9130a8164549fe818874806e1c7014b",
"d79e1c308aa5bbcdeea8ed63df412da9",
"043f8582f241db351ce627e153e7f0e4",
"e33b4ddc9c38f2199c3e7b164fcc0536",
};

static char *pt(unsigned char *md);
int main(int argc, char *argv[])
	{
	int i,err=0;
	char **P,**R;
	char *p;
	unsigned char md[MD4_DIGEST_LENGTH];

	P=test;
	R=ret;
	i=1;
	while (*P != NULL)
		{
		EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md4(), NULL);
		p=pt(md);
		if (strcmp(p,(char *)*R) != 0)
			{
			printf("error calculating MD4 on '%s'\n",*P);
			printf("got %s instead of %s\n",p,*R);
			err++;
			}
		else
			printf("test %d ok\n",i);
		i++;
		R++;
		P++;
		}
	exit(err);
	}

static char *pt(unsigned char *md)
	{
	int i;
	static char buf[80];

	for (i=0; i<MD4_DIGEST_LENGTH; i++)
		snprintf(buf + i*2, sizeof(buf) - i*2, "%02x",md[i]);
	return(buf);
	}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































Deleted jni/libressl/tests/md5test.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*	$OpenBSD: md5test.c,v 1.2 2018/07/17 17:06:49 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 * 
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from 
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 * 
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <openssl/evp.h>
#include <openssl/md5.h>

static char *test[]={
	"",
	"a",
	"abc",
	"message digest",
	"abcdefghijklmnopqrstuvwxyz",
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
	"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
	NULL,
	};

static char *ret[]={
	"d41d8cd98f00b204e9800998ecf8427e",
	"0cc175b9c0f1b6a831c399e269772661",
	"900150983cd24fb0d6963f7d28e17f72",
	"f96b697d7cb7938d525a2f31aaf161d0",
	"c3fcd3d76192e4007dfb496cca67e13b",
	"d174ab98d277d9f5a5611c2c9f419d9f",
	"57edf4a22be3c955ac49da2e2107b67a",
	};

static char *pt(unsigned char *md);
int main(int argc, char *argv[])
	{
	int i,err=0;
	char **P,**R;
	char *p;
	unsigned char md[MD5_DIGEST_LENGTH];

	P=test;
	R=ret;
	i=1;
	while (*P != NULL)
		{
		EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md5(), NULL);
		p=pt(md);
		if (strcmp(p,(char *)*R) != 0)
			{
			printf("error calculating MD5 on '%s'\n",*P);
			printf("got %s instead of %s\n",p,*R);
			err++;
			}
		else
			printf("test %d ok\n",i);
		i++;
		R++;
		P++;
		}

	exit(err);
	}

static char *pt(unsigned char *md)
	{
	int i;
	static char buf[80];

	for (i=0; i<MD5_DIGEST_LENGTH; i++)
		snprintf(buf + i*2, sizeof(buf) - i*2, "%02x",md[i]);
	return(buf);
	}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































Added jni/libressl/tests/md_test.c.


























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
/*	$OpenBSD: md_test.c,v 1.1.1.1 2022/09/02 13:34:48 tb Exp $ */
/*
 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/evp.h>
#include <openssl/md4.h>
#include <openssl/md5.h>

#include <stdint.h>
#include <string.h>

struct md_test {
	const int algorithm;
	const uint8_t in[128];
	const size_t in_len;
	const uint8_t out[EVP_MAX_MD_SIZE];
};

static const struct md_test md_tests[] = {
	/* MD4 (RFC 1320 test vectors)  */
	{
		.algorithm = NID_md4,
		.in = "",
		.in_len = 0,
		.out = {
			0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31,
			0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0,
		}
	},
	{
		.algorithm = NID_md4,
		.in = "a",
		.in_len = 1,
		.out = {
			0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46,
			0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24,
		}
	},
	{
		.algorithm = NID_md4,
		.in = "abc",
		.in_len = 3,
		.out = {
			0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52,
			0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d,
		}
	},
	{
		.algorithm = NID_md4,
		.in = "message digest",
		.in_len = 14,
		.out = {
			0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8,
			0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b,
		}
	},
	{
		.algorithm = NID_md4,
		.in = "abcdefghijklmnopqrstuvwxyz",
		.in_len = 26,
		.out = {
			0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd,
			0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9,
		}
	},
	{
		.algorithm = NID_md4,
		.in =
		    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv"
		    "wxyz0123456789",
		.in_len = 62,
		.out = {
			0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35,
			0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4,
		}
	},
	{
		.algorithm = NID_md4,
		.in =
		    "123456789012345678901234567890123456789012345678"
		    "90123456789012345678901234567890",
		.in_len = 80,
		.out = {
			0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19,
			0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36,
		}
	},

	/* MD5 (RFC 1321 test vectors)  */
	{
		.algorithm = NID_md5,
		.in = "",
		.in_len = 0,
		.out = {
			0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
			0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e,
		}
	},
	{
		.algorithm = NID_md5,
		.in = "a",
		.in_len = 1,
		.out = {
			0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
			0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61,
		}
	},
	{
		.algorithm = NID_md5,
		.in = "abc",
		.in_len = 3,
		.out = {
			0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
			0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72,
		}
	},
	{
		.algorithm = NID_md5,
		.in = "message digest",
		.in_len = 14,
		.out = {
			0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
			0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0,
		}
	},
	{
		.algorithm = NID_md5,
		.in = "abcdefghijklmnopqrstuvwxyz",
		.in_len = 26,
		.out = {
			0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
			0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b,
		}
	},
	{
		.algorithm = NID_md5,
		.in =
		    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv"
		    "wxyz0123456789",
		.in_len = 62,
		.out = {
			0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
			0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f,
		}
	},
	{
		.algorithm = NID_md5,
		.in =
		    "123456789012345678901234567890123456789012345678"
		    "90123456789012345678901234567890",
		.in_len = 80,
		.out = {
			0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55,
			0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a,
		}
	},
};

#define N_MD_TESTS (sizeof(md_tests) / sizeof(md_tests[0]))

typedef unsigned char *(*md_hash_func)(const unsigned char *, size_t,
    unsigned char *);

static int
md_hash_from_algorithm(int algorithm, const char **out_label,
    md_hash_func *out_func, const EVP_MD **out_md, size_t *out_len)
{
	switch (algorithm) {
	case NID_md4:
		*out_label = SN_md4;
		*out_func = MD4;
		*out_md = EVP_md4();
		*out_len = MD4_DIGEST_LENGTH;
		break;
	case NID_md5:
		*out_label = SN_md5;
		*out_func = MD5;
		*out_md = EVP_md5();
		*out_len = MD5_DIGEST_LENGTH;
		break;
	default:
		fprintf(stderr, "FAIL: unknown algorithm (%d)\n",
			algorithm);
		return 0;
	}

	return 1;
}

static int
md_test(void)
{
	unsigned char *(*md_func)(const unsigned char *, size_t, unsigned char *);
	const struct md_test *st;
	EVP_MD_CTX *hash = NULL;
	const EVP_MD *md;
	uint8_t out[EVP_MAX_MD_SIZE];
	size_t in_len, out_len;
	size_t i;
	const char *label;
	int failed = 1;

	if ((hash = EVP_MD_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n");
		goto failed;
	}

	for (i = 0; i < N_MD_TESTS; i++) {
		st = &md_tests[i];
		if (!md_hash_from_algorithm(st->algorithm, &label, &md_func,
		    &md, &out_len))
			goto failed;

		/* Digest */
		memset(out, 0, sizeof(out));
		md_func(st->in, st->in_len, out);
		if (memcmp(st->out, out, out_len) != 0) {
			fprintf(stderr, "FAIL (%s): mismatch\n", label);
			goto failed;
		}

		/* EVP single-shot digest */
		memset(out, 0, sizeof(out));
		if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) {
			fprintf(stderr, "FAIL (%s): EVP_Digest failed\n",
			    label);
			goto failed;
		}

		if (memcmp(st->out, out, out_len) != 0) {
			fprintf(stderr, "FAIL (%s): EVP single-shot mismatch\n",
			    label);
			goto failed;
		}

		/* EVP digest */
		memset(out, 0, sizeof(out));
		if (!EVP_DigestInit_ex(hash, md, NULL)) {
			fprintf(stderr, "FAIL (%s): EVP_DigestInit_ex failed\n",
			    label);
			goto failed;
		}

		in_len = st->in_len / 2;
		if (!EVP_DigestUpdate(hash, st->in, in_len)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestUpdate first half failed\n",
			    label);
			goto failed;
		}

		if (!EVP_DigestUpdate(hash, st->in + in_len,
			st->in_len - in_len)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestUpdate second half failed\n",
			    label);
			goto failed;
		}

		if (!EVP_DigestFinal_ex(hash, out, NULL)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestFinal_ex failed\n",
			    label);
			goto failed;
		}

		if (memcmp(st->out, out, out_len) != 0) {
			fprintf(stderr, "FAIL (%s): EVP mismatch\n", label);
			goto failed;
		}
	}

	failed = 0;

 failed:
	EVP_MD_CTX_free(hash);
	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= md_test();

	return failed;
}
Changes to jni/libressl/tests/objectstest.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: objectstest.c,v 1.5 2022/02/20 13:47:53 jsing Exp $ */
/*
 * Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: objectstest.c,v 1.6 2022/09/05 21:06:31 tb Exp $ */
/*
 * Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

static int
obj_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%i != %i)\n", label, len1, len2);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

static int
obj_compare_bytes(const char *label, const unsigned char *d1, int len1,
    const unsigned char *d2, int len2)
{
	if (len1 != len2) {
		fprintf(stderr, "FAIL: %s - byte lengths differ "
		    "(%d != %d)\n", label, len1, len2);
		fprintf(stderr, "Got:\n");
		hexdump(d1, len1);
		fprintf(stderr, "Want:\n");
		hexdump(d2, len2);
		return 0;
	}
	if (memcmp(d1, d2, len1) != 0) {
Added jni/libressl/tests/quictest.bat.




























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@echo off
setlocal enabledelayedexpansion
REM	quictest.bat

set quictest_bin=%1
set quictest_bin=%quictest_bin:/=\%
if not exist %quictest_bin% exit /b 1

%quictest_bin% %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem
if !errorlevel! neq 0 (
	exit /b 1
)

endlocal
Added jni/libressl/tests/quictest.c.






































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
/* $OpenBSD: quictest.c,v 1.1 2022/08/27 09:16:29 jsing Exp $ */
/*
 * Copyright (c) 2020, 2021, 2022 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <err.h>

#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/ssl.h>

const char *server_ca_file;
const char *server_cert_file;
const char *server_key_file;

int debug = 0;

static void
hexdump(const unsigned char *buf, size_t len)
{
	size_t i;

	for (i = 1; i <= len; i++)
		fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n");

	if (len % 8)
		fprintf(stderr, "\n");
}

struct quic_data {
	enum ssl_encryption_level_t rlevel;
	enum ssl_encryption_level_t wlevel;
	BIO *rbio;
	BIO *wbio;
};

static int
quic_set_read_secret(SSL *ssl, enum ssl_encryption_level_t level,
    const SSL_CIPHER *cipher, const uint8_t *secret, size_t secret_len)
{
	struct quic_data *qd = SSL_get_app_data(ssl);

	qd->rlevel = level;

	return 1;
}

static int
quic_set_write_secret(SSL *ssl, enum ssl_encryption_level_t level,
    const SSL_CIPHER *cipher, const uint8_t *secret, size_t secret_len)
{
	struct quic_data *qd = SSL_get_app_data(ssl);

	qd->wlevel = level;

	return 1;
}

static int
quic_read_handshake_data(SSL *ssl)
{
	struct quic_data *qd = SSL_get_app_data(ssl);
	uint8_t buf[2048];
	int ret;

	if ((ret = BIO_read(qd->rbio, buf, sizeof(buf))) > 0) {
		if (debug > 1) {
			fprintf(stderr, "== quic_read_handshake_data ==\n");
			hexdump(buf, ret);
		}
		if (!SSL_provide_quic_data(ssl, qd->rlevel, buf, ret))
			return -1;
	}

	return 1;
}

static int
quic_add_handshake_data(SSL *ssl, enum ssl_encryption_level_t level,
    const uint8_t *data, size_t len)
{
	struct quic_data *qd = SSL_get_app_data(ssl);
	int ret;

	if (debug > 1) {
		fprintf(stderr, "== quic_add_handshake_data\n");
		hexdump(data, len);
	}

	if ((ret = BIO_write(qd->wbio, data, len)) <= 0)
		return 0;

	return (size_t)ret == len;
}

static int
quic_flush_flight(SSL *ssl)
{
	return 1;
}

static int
quic_send_alert(SSL *ssl, enum ssl_encryption_level_t level, uint8_t alert)
{
	return 1;
}

const SSL_QUIC_METHOD quic_method = {
	.set_read_secret = quic_set_read_secret,
	.set_write_secret = quic_set_write_secret,
	.add_handshake_data = quic_add_handshake_data,
	.flush_flight = quic_flush_flight,
	.send_alert = quic_send_alert,
};

static SSL *
quic_client(struct quic_data *data)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;

	if ((ssl_ctx = SSL_CTX_new(TLS_method())) == NULL)
		errx(1, "client context");

	if (!SSL_CTX_set_quic_method(ssl_ctx, &quic_method)) {
		fprintf(stderr, "FAIL: Failed to set QUIC method\n");
		goto failure;
	}

	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "client ssl");

	SSL_set_connect_state(ssl);
	SSL_set_app_data(ssl, data);

 failure:
	SSL_CTX_free(ssl_ctx);

	return ssl;
}

static SSL *
quic_server(struct quic_data *data)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;

	if ((ssl_ctx = SSL_CTX_new(TLS_method())) == NULL)
		errx(1, "server context");

	SSL_CTX_set_dh_auto(ssl_ctx, 2);

	if (SSL_CTX_use_certificate_file(ssl_ctx, server_cert_file,
	    SSL_FILETYPE_PEM) != 1) {
		fprintf(stderr, "FAIL: Failed to load server certificate\n");
		goto failure;
	}
	if (SSL_CTX_use_PrivateKey_file(ssl_ctx, server_key_file,
	    SSL_FILETYPE_PEM) != 1) {
		fprintf(stderr, "FAIL: Failed to load server private key\n");
		goto failure;
	}

	if (!SSL_CTX_set_quic_method(ssl_ctx, &quic_method)) {
		fprintf(stderr, "FAIL: Failed to set QUIC method\n");
		goto failure;
	}

	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "server ssl");

	SSL_set_accept_state(ssl);
	SSL_set_app_data(ssl, data);

 failure:
	SSL_CTX_free(ssl_ctx);

	return ssl;
}

static int
ssl_error(SSL *ssl, const char *name, const char *desc, int ssl_ret)
{
	int ssl_err;

	ssl_err = SSL_get_error(ssl, ssl_ret);

	if (ssl_err == SSL_ERROR_WANT_READ) {
		if (quic_read_handshake_data(ssl) < 0)
			return 0;
		return 1;
	} else if (ssl_err == SSL_ERROR_WANT_WRITE) {
		return 1;
	} else if (ssl_err == SSL_ERROR_SYSCALL && errno == 0) {
		/* Yup, this is apparently a thing... */
	} else {
		fprintf(stderr, "FAIL: %s %s failed - ssl err = %d, errno = %d\n",
		    name, desc, ssl_err, errno);
		ERR_print_errors_fp(stderr);
		return 0;
	}

	return 1;
}

static int
do_handshake(SSL *ssl, const char *name, int *done)
{
	int ssl_ret;

	if ((ssl_ret = SSL_do_handshake(ssl)) == 1) {
		fprintf(stderr, "INFO: %s handshake done\n", name);
		*done = 1;
		return 1;
	}

	return ssl_error(ssl, name, "handshake", ssl_ret);
}

typedef int (*ssl_func)(SSL *ssl, const char *name, int *done);

static int
do_client_server_loop(SSL *client, ssl_func client_func, SSL *server,
    ssl_func server_func)
{
	int client_done = 0, server_done = 0;
	int i = 0;

	do {
		if (!client_done) {
			if (debug)
				fprintf(stderr, "DEBUG: client loop\n");
			if (!client_func(client, "client", &client_done))
				return 0;
		}
		if (!server_done) {
			if (debug)
				fprintf(stderr, "DEBUG: server loop\n");
			if (!server_func(server, "server", &server_done))
				return 0;
		}
	} while (i++ < 100 && (!client_done || !server_done));

	if (!client_done || !server_done)
		fprintf(stderr, "FAIL: gave up\n");

	return client_done && server_done;
}

static int
quictest(void)
{
	struct quic_data *client_data = NULL, *server_data = NULL;
	BIO *client_wbio = NULL, *server_wbio = NULL;
	SSL *client = NULL, *server = NULL;
	int failed = 1;

	if ((client_wbio = BIO_new(BIO_s_mem())) == NULL)
		goto failure;
	if (BIO_set_mem_eof_return(client_wbio, -1) <= 0)
		goto failure;

	if ((server_wbio = BIO_new(BIO_s_mem())) == NULL)
		goto failure;
	if (BIO_set_mem_eof_return(server_wbio, -1) <= 0)
		goto failure;

	if ((client_data = calloc(1, sizeof(*client_data))) == NULL)
		goto failure;

	client_data->rbio = server_wbio;
	client_data->wbio = client_wbio;

	if ((client = quic_client(client_data)) == NULL)
		goto failure;

	if ((server_data = calloc(1, sizeof(*server_data))) == NULL)
		goto failure;

	server_data->rbio = client_wbio;
	server_data->wbio = server_wbio;

	if ((server = quic_server(server_data)) == NULL)
		goto failure;

	if (!do_client_server_loop(client, do_handshake, server, do_handshake)) {
		fprintf(stderr, "FAIL: client and server handshake failed\n");
		ERR_print_errors_fp(stderr);
		goto failure;
	}

	fprintf(stderr, "INFO: Done!\n");

	failed = 0;

 failure:
	BIO_free(client_wbio);
	BIO_free(server_wbio);

	free(client_data);
	free(server_data);

	SSL_free(client);
	SSL_free(server);

	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	if (argc != 4) {
		fprintf(stderr, "usage: %s keyfile certfile cafile\n",
		    argv[0]);
		exit(1);
	}

	server_key_file = argv[1];
	server_cert_file = argv[2];
	server_ca_file = argv[3];

	failed |= quictest();

	return failed;
}
Added jni/libressl/tests/quictest.sh.


























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
set -e

quictest_bin=./quictest
if [ -e ./quictest.exe ]; then
	quictest_bin=./quictest.exe
fi

if [ -z $srcdir ]; then
	srcdir=.
fi

$quictest_bin $srcdir/server.pem $srcdir/server.pem $srcdir/ca.pem
Added jni/libressl/tests/rc2_test.c.










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
/*	$OpenBSD: rc2_test.c,v 1.5 2022/09/12 13:11:36 tb Exp $ */
/*
 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/evp.h>
#include <openssl/rc2.h>

#include <stdint.h>
#include <string.h>

struct rc2_test {
	const int mode;
	const uint8_t key[64];
	const int key_len;
	const int key_bits;
	const uint8_t iv[64];
	const int iv_len;
	const uint8_t in[64];
	const int in_len;
	const uint8_t out[64];
	const int out_len;
	const int padding;
};

static const struct rc2_test rc2_tests[] = {
	/* ECB (Test vectors from RFC 2268) */
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 8,
		.key_bits = 63,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0xeb, 0xb7, 0x73, 0xf9, 0x93, 0x27, 0x8e, 0xff,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		},
		.key_len = 8,
		.key_bits = 64,
		.in = {
			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		},
		.in_len = 8,
		.out = {
			0x27, 0x8b, 0x27, 0xe4, 0x2e, 0x2f, 0x0d, 0x49,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 8,
		.key_bits = 64,
		.in = {
			0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
		},
		.in_len = 8,
		.out = {
			0x30, 0x64, 0x9e, 0xdf, 0x9b, 0xe7, 0xd2, 0xc2,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x88,
		},
		.key_len = 1,
		.key_bits = 64,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x61, 0xa8, 0xa2, 0x44, 0xad, 0xac, 0xcc, 0xf0,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a,
		},
		.key_len = 7,
		.key_bits = 64,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x6c, 0xcf, 0x43, 0x08, 0x97, 0x4c, 0x26, 0x7f,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
			0x0f, 0x79, 0xc3, 0x84, 0x62, 0x7b, 0xaf, 0xb2,
		},
		.key_len = 16,
		.key_bits = 64,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x1a, 0x80, 0x7d, 0x27, 0x2b, 0xbe, 0x5d, 0xb1,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
			0x0f, 0x79, 0xc3, 0x84, 0x62, 0x7b, 0xaf, 0xb2,
		},
		.key_len = 16,
		.key_bits = 128,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x22, 0x69, 0x55, 0x2a, 0xb0, 0xf8, 0x5c, 0xa6,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
			0x0f, 0x79, 0xc3, 0x84, 0x62, 0x7b, 0xaf, 0xb2,
			0x16, 0xf8, 0x0a, 0x6f, 0x85, 0x92, 0x05, 0x84,
			0xc4, 0x2f, 0xce, 0xb0, 0xbe, 0x25, 0x5d, 0xaf,
			0x1e,
		},
		.key_len = 33,
		.key_bits = 129,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x5b, 0x78, 0xd3, 0xa4, 0x3d, 0xff, 0xf1, 0xf1,
		},
		.out_len = 8,
	},

	/* ECB (Test vectors from http://websites.umich.edu/~x509/ssleay/rrc2.html) */
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 16,
		.key_bits = 1024,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x1c, 0x19, 0x8a, 0x83, 0x8d, 0xf0, 0x28, 0xb7,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
		},
		.key_len = 16,
		.key_bits = 1024,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x21, 0x82, 0x9C, 0x78, 0xA9, 0xF9, 0xC0, 0x74,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 16,
		.key_bits = 1024,
		.in = {
			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		},
		.in_len = 8,
		.out = {
			0x13, 0xdb, 0x35, 0x17, 0xd3, 0x21, 0x86, 0x9e,
		},
		.out_len = 8,
	},
	{
		.mode = NID_rc2_ecb,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 1024,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 8,
		.out = {
			0x50, 0xdc, 0x01, 0x62, 0xbd, 0x75, 0x7f, 0x31,
		},
		.out_len = 8,
	},

	/* CBC (generated using https://github.com/joshuasing/libressl-test-gen) */
	{
		.mode = NID_rc2_cbc,
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 8,
		.key_bits = 64,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 16,
		.out = {
			0xeb, 0xb7, 0x73, 0xf9, 0x93, 0x27, 0x8e, 0xff,
			0xf0, 0x51, 0x77, 0x8b, 0x65, 0xdb, 0x13, 0x57,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_cbc,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 16,
		.out = {
			0x9c, 0x4b, 0xfe, 0x6d, 0xfe, 0x73, 0x9c, 0x2b,
			0x52, 0x8f, 0xc8, 0x47, 0x2b, 0x66, 0xf9, 0x70,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_cbc,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.in_len = 16,
		.out = {
			0x8b, 0x11, 0x08, 0x1c, 0xf0, 0xa0, 0x86, 0xe9,
			0x60, 0x57, 0x69, 0x5d, 0xdd, 0x42, 0x38, 0xe3,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_cbc,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
			0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
			0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
		},
		.in_len = 32,
		.out = {
			0x9c, 0x4b, 0xfe, 0x6d, 0xfe, 0x73, 0x9c, 0x2b,
			0x29, 0xf1, 0x7a, 0xd2, 0x16, 0xa0, 0xb2, 0xc6,
			0xd1, 0xa2, 0x31, 0xbe, 0xa3, 0x94, 0xc6, 0xb0,
			0x81, 0x22, 0x27, 0x17, 0x5b, 0xd4, 0x6d, 0x29,
		},
		.out_len = 32,
	},

	/* CFB64 (generated using https://github.com/joshuasing/libressl-test-gen) */
	{
		.mode = NID_rc2_cfb64,
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 8,
		.key_bits = 64,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 16,
		.out = {
			0xeb, 0xb7, 0x73, 0xf9, 0x93, 0x27, 0x8e, 0xff,
			0xf0, 0x51, 0x77, 0x8b, 0x65, 0xdb, 0x13, 0x57,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_cfb64,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 16,
		.out = {
			0x9c, 0x4b, 0xfe, 0x6d, 0xfe, 0x73, 0x9c, 0x2b,
			0x52, 0x8f, 0xc8, 0x47, 0x2b, 0x66, 0xf9, 0x70,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_cfb64,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.in_len = 16,
		.out = {
			0x9c, 0x4a, 0xfc, 0x6e, 0xfa, 0x76, 0x9a, 0x2c,
			0xeb, 0xdf, 0x25, 0xb0, 0x15, 0x8b, 0x6a, 0x2a,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_cfb64,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
			0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
			0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
		},
		.in_len = 32,
		.out = {
			0x8b, 0x10, 0x0a, 0x1f, 0xf4, 0xa5, 0x80, 0xee,
			0x94, 0x4d, 0xc3, 0xcd, 0x26, 0x79, 0x81, 0xc0,
			0xe9, 0x3e, 0x20, 0x85, 0x11, 0x71, 0x61, 0x2a,
			0x1d, 0x4c, 0x8a, 0xe2, 0xb7, 0x0a, 0xa8, 0xcf,
		},
		.out_len = 32,
	},

	/* OFB64 (generated using https://github.com/joshuasing/libressl-test-gen) */
	{
		.mode = NID_rc2_ofb64,
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 8,
		.key_bits = 64,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 16,
		.out = {
			0xeb, 0xb7, 0x73, 0xf9, 0x93, 0x27, 0x8e, 0xff,
			0xf0, 0x51, 0x77, 0x8b, 0x65, 0xdb, 0x13, 0x57,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_ofb64,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.in_len = 16,
		.out = {
			0x9c, 0x4b, 0xfe, 0x6d, 0xfe, 0x73, 0x9c, 0x2b,
			0x52, 0x8f, 0xc8, 0x47, 0x2b, 0x66, 0xf9, 0x70,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_ofb64,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.in_len = 16,
		.out = {
			0x9c, 0x4a, 0xfc, 0x6e, 0xfa, 0x76, 0x9a, 0x2c,
			0x5a, 0x86, 0xc2, 0x4c, 0x27, 0x6b, 0xf7, 0x7f,
		},
		.out_len = 16,
	},
	{
		.mode = NID_rc2_ofb64,
		.key = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		},
		.key_len = 16,
		.key_bits = 128,
		.iv = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
		},
		.iv_len = 8,
		.in = {
			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
			0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
			0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
			0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
		},
		.in_len = 32,
		.out = {
			0x8b, 0x10, 0x0a, 0x1f, 0xf4, 0xa5, 0x80, 0xee,
			0xfa, 0x1d, 0x1a, 0x7c, 0xb2, 0x93, 0x00, 0x9d,
			0x36, 0xa1, 0xff, 0x3a, 0x77, 0x1d, 0x00, 0x9b,
			0x20, 0xde, 0x5f, 0x93, 0xcc, 0x3e, 0x51, 0xaa,
		},
		.out_len = 32,
	},
};

#define N_RC2_TESTS (sizeof(rc2_tests) / sizeof(rc2_tests[0]))

static int
rc2_ecb_test(size_t test_number, const struct rc2_test *rt)
{
	RC2_KEY key;
	uint8_t out[8];

	/* Encryption */
	memset(out, 0, sizeof(out));
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_ecb_encrypt(rt->in, out, &key, 1);

	if (memcmp(rt->out, out, rt->out_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n",
		    SN_rc2_ecb, test_number);
		return 0;
	}

	/* Decryption */
	memset(out, 0, sizeof(out));
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_ecb_encrypt(rt->out, out, &key, 0);

	if (memcmp(rt->in, out, rt->in_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n",
		    SN_rc2_ecb, test_number);
		return 0;
	}

	return 1;
}

static int
rc2_cbc_test(size_t test_number, const struct rc2_test *rt)
{
	RC2_KEY key;
	uint8_t out[512];
	uint8_t iv[64];

	/* Encryption */
	memset(out, 0, sizeof(out));
	memcpy(iv, rt->iv, rt->iv_len);
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_cbc_encrypt(rt->in, out, rt->in_len, &key, iv, 1);

	if (memcmp(rt->out, out, rt->out_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n",
		    SN_rc2_cbc, test_number);
		return 0;
	}

	/* Decryption */
	memset(out, 0, sizeof(out));
	memcpy(iv, rt->iv, rt->iv_len);
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_cbc_encrypt(rt->out, out, rt->out_len, &key, iv, 0);

	if (memcmp(rt->in, out, rt->in_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n",
		    SN_rc2_cbc, test_number);
		return 0;
	}

	return 1;
}

static int
rc2_cfb64_test(size_t test_number, const struct rc2_test *rt)
{
	RC2_KEY key;
	uint8_t out[512];
	uint8_t iv[64];
	int remainder = 0;

	/* Encryption */
	memset(out, 0, sizeof(out));
	memcpy(iv, rt->iv, rt->iv_len);
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_cfb64_encrypt(rt->in, out, rt->in_len * 8, &key, iv, &remainder, 1);

	if (memcmp(rt->out, out, rt->out_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n",
		    SN_rc2_cbc, test_number);
		return 0;
	}

	/* Decryption */
	memset(out, 0, sizeof(out));
	memcpy(iv, rt->iv, rt->iv_len);
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_cfb64_encrypt(rt->out, out, rt->out_len, &key, iv, &remainder, 0);

	if (memcmp(rt->in, out, rt->in_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n",
		    SN_rc2_cbc, test_number);
		return 0;
	}

	return 1;
}

static int
rc2_ofb64_test(size_t test_number, const struct rc2_test *rt)
{
	RC2_KEY key;
	uint8_t out[512];
	uint8_t iv[64];
	int remainder = 0;

	/* Encryption */
	memset(out, 0, sizeof(out));
	memcpy(iv, rt->iv, rt->iv_len);
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_ofb64_encrypt(rt->in, out, rt->in_len, &key, iv, &remainder);

	if (memcmp(rt->out, out, rt->out_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n",
		    SN_rc2_cbc, test_number);
		return 0;
	}

	/* Decryption */
	memset(out, 0, sizeof(out));
	memcpy(iv, rt->iv, rt->iv_len);
	RC2_set_key(&key, rt->key_len, rt->key, rt->key_bits);
	RC2_ofb64_encrypt(rt->out, out, rt->out_len, &key, iv, &remainder);

	if (memcmp(rt->in, out, rt->in_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n",
		    SN_rc2_cbc, test_number);
		return 0;
	}

	return 1;
}

static int
rc2_evp_test(size_t test_number, const struct rc2_test *rt, const char *label,
    const EVP_CIPHER *cipher)
{
	EVP_CIPHER_CTX *ctx;
	uint8_t out[512];
	int in_len, out_len, total_len;
	int i;
	int success = 0;

	if ((ctx = EVP_CIPHER_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_CIPHER_CTX_new failed\n",
		    label, test_number);
		goto failed;
	}

	/* EVP encryption */
	total_len = 0;
	memset(out, 0, sizeof(out));
	if (!EVP_EncryptInit(ctx, cipher, NULL, NULL)) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_EncryptInit failed\n",
		    label, test_number);
		goto failed;
	}

	if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS,
	    rt->key_bits, NULL) <= 0) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_CIPHER_CTX_ctrl failed\n",
		    label, test_number);
		goto failed;
	}

	if (!EVP_CIPHER_CTX_set_key_length(ctx, rt->key_len)) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP_CIPHER_CTX_set_key_length failed\n",
		    label, test_number);
		goto failed;
	}

	if (!EVP_CIPHER_CTX_set_padding(ctx, rt->padding)) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP_CIPHER_CTX_set_padding failed\n",
		    label, test_number);
		goto failed;
	}

	if (!EVP_EncryptInit(ctx, NULL, rt->key, rt->iv)) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_EncryptInit failed\n",
		    label, test_number);
		goto failed;
	}

	for (i = 0; i < rt->in_len;) {
		in_len = arc4random_uniform(sizeof(rt->in_len) / 2);
		if (in_len > rt->in_len - i)
			in_len = rt->in_len - i;

		if (!EVP_EncryptUpdate(ctx, out + total_len, &out_len,
		    rt->in + i, in_len)) {
			fprintf(stderr,
			    "FAIL (%s:%zu): EVP_EncryptUpdate failed\n",
			    label, test_number);
			goto failed;
		}

		i += in_len;
		total_len += out_len;
	}

	if (!EVP_EncryptFinal_ex(ctx, out + out_len, &out_len)) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_EncryptFinal_ex failed\n",
		    label, test_number);
		goto failed;
	}
	total_len += out_len;

	if (!EVP_CIPHER_CTX_reset(ctx)) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP_CIPHER_CTX_reset failed\n",
		    label, test_number);
		goto failed;
	}

	if (total_len != rt->out_len) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP encryption length mismatch\n",
		    label, test_number);
		goto failed;
	}

	if (memcmp(rt->out, out, rt->out_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): EVP encryption mismatch\n",
		    label, test_number);
		goto failed;
	}

	/* EVP decryption */
	total_len = 0;
	memset(out, 0, sizeof(out));
	if (!EVP_DecryptInit(ctx, cipher, NULL, NULL)) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_DecryptInit failed\n",
		    label, test_number);
		goto failed;
	}

	if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS,
	    rt->key_bits, NULL) <= 0) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_CIPHER_CTX_ctrl failed\n",
		    label, test_number);
		goto failed;
	}

	if (!EVP_CIPHER_CTX_set_key_length(ctx, rt->key_len)) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP_CIPHER_CTX_set_key_length failed\n",
		    label, test_number);
		goto failed;
	}

	if (!EVP_CIPHER_CTX_set_padding(ctx, rt->padding)) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP_CIPHER_CTX_set_padding failed\n",
		    label, test_number);
		goto failed;
	}

	if (!EVP_DecryptInit(ctx, NULL, rt->key, rt->iv)) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_DecryptInit failed\n",
		    label, test_number);
		goto failed;
	}

	for (i = 0; i < rt->out_len;) {
		in_len = arc4random_uniform(sizeof(rt->out_len) / 2);
		if (in_len > rt->out_len - i)
			in_len = rt->out_len - i;

		if (!EVP_DecryptUpdate(ctx, out + total_len, &out_len,
		    rt->out + i, in_len)) {
			fprintf(stderr,
			    "FAIL (%s:%zu): EVP_DecryptUpdate failed\n",
			    label, test_number);
			goto failed;
		}

		i += in_len;
		total_len += out_len;
	}

	if (!EVP_DecryptFinal_ex(ctx, out + total_len, &out_len)) {
		fprintf(stderr, "FAIL (%s:%zu): EVP_DecryptFinal_ex failed\n",
		    label, test_number);
		goto failed;
	}
	total_len += out_len;

	if (!EVP_CIPHER_CTX_reset(ctx)) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP_CIPHER_CTX_reset failed\n",
		    label, test_number);
		goto failed;
	}

	if (total_len != rt->in_len) {
		fprintf(stderr,
		    "FAIL (%s:%zu): EVP decryption length mismatch\n",
		    label, test_number);
		goto failed;
	}

	if (memcmp(rt->in, out, rt->in_len) != 0) {
		fprintf(stderr, "FAIL (%s:%zu): EVP decryption mismatch\n",
		    label, test_number);
		goto failed;
	}

	success = 1;

 failed:
	EVP_CIPHER_CTX_free(ctx);
	return success;
}

static int
rc2_test(void)
{
	const struct rc2_test *rt;
	const char *label;
	const EVP_CIPHER *cipher;
	size_t i;
	int failed = 1;

	for (i = 0; i < N_RC2_TESTS; i++) {
		rt = &rc2_tests[i];
		switch (rt->mode) {
		case NID_rc2_ecb:
			label = SN_rc2_ecb;
			cipher = EVP_rc2_ecb();
			if (!rc2_ecb_test(i, rt))
				goto failed;
			break;
		case NID_rc2_cbc:
			label = SN_rc2_cbc;
			cipher = EVP_rc2_cbc();
			if (!rc2_cbc_test(i, rt))
				goto failed;
			break;
		case NID_rc2_cfb64:
			label = SN_rc2_cfb64;
			cipher = EVP_rc2_cfb64();
			if (!rc2_cfb64_test(i, rt))
				goto failed;
			break;
		case NID_rc2_ofb64:
			label = SN_rc2_ofb64;
			cipher = EVP_rc2_ofb();
			if (!rc2_ofb64_test(i, rt))
				goto failed;
			break;
		default:
			fprintf(stderr, "FAIL: unknown mode (%d)\n",
			    rt->mode);
			goto failed;
		}

		if (!rc2_evp_test(i, rt, label, cipher))
			goto failed;
	}

	failed = 0;

 failed:
	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= rc2_test();

	return failed;
}
Deleted jni/libressl/tests/rc2test.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*	$OpenBSD: rc2test.c,v 1.2 2018/07/17 17:06:49 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 * 
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from 
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 * 
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

/* This has been a quickly hacked 'ideatest.c'.  When I add tests for other
 * RC2 modes, more of the code will be uncommented. */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <openssl/rc2.h>

static unsigned char RC2key[4][16]={
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
	{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
	 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F},
	};

static unsigned char RC2plain[4][8]={
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
	{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
	};

static unsigned char RC2cipher[4][8]={
	{0x1C,0x19,0x8A,0x83,0x8D,0xF0,0x28,0xB7},
	{0x21,0x82,0x9C,0x78,0xA9,0xF9,0xC0,0x74},
	{0x13,0xDB,0x35,0x17,0xD3,0x21,0x86,0x9E},
	{0x50,0xDC,0x01,0x62,0xBD,0x75,0x7F,0x31},
	};
/************/

int main(int argc, char *argv[])
	{
	int i,n,err=0;
	RC2_KEY key; 
	unsigned char buf[8],buf2[8];

	for (n=0; n<4; n++)
		{
		RC2_set_key(&key,16,&(RC2key[n][0]),0 /* or 1024 */);

		RC2_ecb_encrypt(&(RC2plain[n][0]),buf,&key,RC2_ENCRYPT);
		if (memcmp(&(RC2cipher[n][0]),buf,8) != 0)
			{
			printf("ecb rc2 error encrypting\n");
			printf("got     :");
			for (i=0; i<8; i++)
				printf("%02X ",buf[i]);
			printf("\n");
			printf("expected:");
			for (i=0; i<8; i++)
				printf("%02X ",RC2cipher[n][i]);
			err=20;
			printf("\n");
			}

		RC2_ecb_encrypt(buf,buf2,&key,RC2_DECRYPT);
		if (memcmp(&(RC2plain[n][0]),buf2,8) != 0)
			{
			printf("ecb RC2 error decrypting\n");
			printf("got     :");
			for (i=0; i<8; i++)
				printf("%02X ",buf[i]);
			printf("\n");
			printf("expected:");
			for (i=0; i<8; i++)
				printf("%02X ",RC2plain[n][i]);
			printf("\n");
			err=3;
			}
		}

	if (err == 0) printf("ecb RC2 ok\n");

	exit(err);
	}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































Added jni/libressl/tests/rc4_test.c.






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
/*	$OpenBSD: rc4_test.c,v 1.5 2022/09/12 04:26:38 tb Exp $ */
/*
 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/evp.h>
#include <openssl/rc4.h>

#include <stdint.h>
#include <string.h>

struct rc4_test {
	const uint8_t key[32];
	const int key_len;
	const int len;
	const uint8_t in[512];
	const uint8_t out[512];
};

static const struct rc4_test rc4_tests[] = {
	/*
	 * Test vectors from RFC 6229, with 40 and 128-bit keys.
	 * Note that this only uses the first 32 bytes of each test vector due
	 * to stream offsets.
	 */
	{
		.key = {
			0x01, 0x02, 0x03, 0x04, 0x05,
		},
		.key_len = 5,
		.len = 32,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.out = {
			0xb2, 0x39, 0x63, 0x05, 0xf0, 0x3d, 0xc0, 0x27,
			0xcc, 0xc3, 0x52, 0x4a, 0x0a, 0x11, 0x18, 0xa8,
			0x69, 0x82, 0x94, 0x4f, 0x18, 0xfc, 0x82, 0xd5,
			0x89, 0xc4, 0x03, 0xa4, 0x7a, 0x0d, 0x09, 0x19,
		},
	},
	{
		.key = {
			0x83, 0x32, 0x22, 0x77, 0x2a,
		},
		.key_len = 5,
		.len = 32,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.out = {
			0x80, 0xad, 0x97, 0xbd, 0xc9, 0x73, 0xdf, 0x8a,
			0x2e, 0x87, 0x9e, 0x92, 0xa4, 0x97, 0xef, 0xda,
			0x20, 0xf0, 0x60, 0xc2, 0xf2, 0xe5, 0x12, 0x65,
			0x01, 0xd3, 0xd4, 0xfe, 0xa1, 0x0d, 0x5f, 0xc0,
		},
	},
	{
		.key = {
			0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
			0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
		},
		.key_len = 16,
		.len = 32,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.out = {
			0x9a, 0xc7, 0xcc, 0x9a, 0x60, 0x9d, 0x1e, 0xf7,
			0xb2, 0x93, 0x28, 0x99, 0xcd, 0xe4, 0x1b, 0x97,
			0x52, 0x48, 0xc4, 0x95, 0x90, 0x14, 0x12, 0x6a,
			0x6e, 0x8a, 0x84, 0xf1, 0x1d, 0x1a, 0x9e, 0x1c,
		},
	},
	{
		.key = {
			0xeb, 0xb4, 0x62, 0x27, 0xc6, 0xcc, 0x8b, 0x37,
			0x64, 0x19, 0x10, 0x83, 0x32, 0x22, 0x77, 0x2a,
		},
		.key_len = 16,
		.len = 32,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.out = {
			0x72, 0x0c, 0x94, 0xb6, 0x3e, 0xdf, 0x44, 0xe1,
			0x31, 0xd9, 0x50, 0xca, 0x21, 0x1a, 0x5a, 0x30,
			0xc3, 0x66, 0xfd, 0xea, 0xcf, 0x9c, 0xa8, 0x04,
			0x36, 0xbe, 0x7c, 0x35, 0x84, 0x24, 0xd2, 0x0b,
		},
	},

	/*
	 * Test vectors from the original cypherpunk posting of ARC4:
	 * https://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0?pli=1
	 */
	{
		.key = {
			0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
		},
		.key_len = 8,
		.len = 8,
		.in = {
			0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
		},
		.out = {
			0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96,
		},
	},
	{
		.key = {
			0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
		},
		.key_len = 8,
		.len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.out = {
			0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79,
		},
	},
	{
		.key = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.key_len = 8,
		.len = 8,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.out = {
			0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a,
		},
	},
	{
		.key = {
			0xef, 0x01, 0x23, 0x45,
		},
		.key_len = 4,
		.len = 10,
		.in = {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00,
		},
		.out = {
			0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
			0xbd, 0x61,
		},
	},
	{
		.key = {
			0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
		},
		.key_len = 8,
		.len = 512,
		.in = {
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
		},
		.out = {
			0x75, 0x95, 0xc3, 0xe6, 0x11, 0x4a, 0x09, 0x78,
			0x0c, 0x4a, 0xd4, 0x52, 0x33, 0x8e, 0x1f, 0xfd,
			0x9a, 0x1b, 0xe9, 0x49, 0x8f, 0x81, 0x3d, 0x76,
			0x53, 0x34, 0x49, 0xb6, 0x77, 0x8d, 0xca, 0xd8,
			0xc7, 0x8a, 0x8d, 0x2b, 0xa9, 0xac, 0x66, 0x08,
			0x5d, 0x0e, 0x53, 0xd5, 0x9c, 0x26, 0xc2, 0xd1,
			0xc4, 0x90, 0xc1, 0xeb, 0xbe, 0x0c, 0xe6, 0x6d,
			0x1b, 0x6b, 0x1b, 0x13, 0xb6, 0xb9, 0x19, 0xb8,
			0x47, 0xc2, 0x5a, 0x91, 0x44, 0x7a, 0x95, 0xe7,
			0x5e, 0x4e, 0xf1, 0x67, 0x79, 0xcd, 0xe8, 0xbf,
			0x0a, 0x95, 0x85, 0x0e, 0x32, 0xaf, 0x96, 0x89,
			0x44, 0x4f, 0xd3, 0x77, 0x10, 0x8f, 0x98, 0xfd,
			0xcb, 0xd4, 0xe7, 0x26, 0x56, 0x75, 0x00, 0x99,
			0x0b, 0xcc, 0x7e, 0x0c, 0xa3, 0xc4, 0xaa, 0xa3,
			0x04, 0xa3, 0x87, 0xd2, 0x0f, 0x3b, 0x8f, 0xbb,
			0xcd, 0x42, 0xa1, 0xbd, 0x31, 0x1d, 0x7a, 0x43,
			0x03, 0xdd, 0xa5, 0xab, 0x07, 0x88, 0x96, 0xae,
			0x80, 0xc1, 0x8b, 0x0a, 0xf6, 0x6d, 0xff, 0x31,
			0x96, 0x16, 0xeb, 0x78, 0x4e, 0x49, 0x5a, 0xd2,
			0xce, 0x90, 0xd7, 0xf7, 0x72, 0xa8, 0x17, 0x47,
			0xb6, 0x5f, 0x62, 0x09, 0x3b, 0x1e, 0x0d, 0xb9,
			0xe5, 0xba, 0x53, 0x2f, 0xaf, 0xec, 0x47, 0x50,
			0x83, 0x23, 0xe6, 0x71, 0x32, 0x7d, 0xf9, 0x44,
			0x44, 0x32, 0xcb, 0x73, 0x67, 0xce, 0xc8, 0x2f,
			0x5d, 0x44, 0xc0, 0xd0, 0x0b, 0x67, 0xd6, 0x50,
			0xa0, 0x75, 0xcd, 0x4b, 0x70, 0xde, 0xdd, 0x77,
			0xeb, 0x9b, 0x10, 0x23, 0x1b, 0x6b, 0x5b, 0x74,
			0x13, 0x47, 0x39, 0x6d, 0x62, 0x89, 0x74, 0x21,
			0xd4, 0x3d, 0xf9, 0xb4, 0x2e, 0x44, 0x6e, 0x35,
			0x8e, 0x9c, 0x11, 0xa9, 0xb2, 0x18, 0x4e, 0xcb,
			0xef, 0x0c, 0xd8, 0xe7, 0xa8, 0x77, 0xef, 0x96,
			0x8f, 0x13, 0x90, 0xec, 0x9b, 0x3d, 0x35, 0xa5,
			0x58, 0x5c, 0xb0, 0x09, 0x29, 0x0e, 0x2f, 0xcd,
			0xe7, 0xb5, 0xec, 0x66, 0xd9, 0x08, 0x4b, 0xe4,
			0x40, 0x55, 0xa6, 0x19, 0xd9, 0xdd, 0x7f, 0xc3,
			0x16, 0x6f, 0x94, 0x87, 0xf7, 0xcb, 0x27, 0x29,
			0x12, 0x42, 0x64, 0x45, 0x99, 0x85, 0x14, 0xc1,
			0x5d, 0x53, 0xa1, 0x8c, 0x86, 0x4c, 0xe3, 0xa2,
			0xb7, 0x55, 0x57, 0x93, 0x98, 0x81, 0x26, 0x52,
			0x0e, 0xac, 0xf2, 0xe3, 0x06, 0x6e, 0x23, 0x0c,
			0x91, 0xbe, 0xe4, 0xdd, 0x53, 0x04, 0xf5, 0xfd,
			0x04, 0x05, 0xb3, 0x5b, 0xd9, 0x9c, 0x73, 0x13,
			0x5d, 0x3d, 0x9b, 0xc3, 0x35, 0xee, 0x04, 0x9e,
			0xf6, 0x9b, 0x38, 0x67, 0xbf, 0x2d, 0x7b, 0xd1,
			0xea, 0xa5, 0x95, 0xd8, 0xbf, 0xc0, 0x06, 0x6f,
			0xf8, 0xd3, 0x15, 0x09, 0xeb, 0x0c, 0x6c, 0xaa,
			0x00, 0x6c, 0x80, 0x7a, 0x62, 0x3e, 0xf8, 0x4c,
			0x3d, 0x33, 0xc1, 0x95, 0xd2, 0x3e, 0xe3, 0x20,
			0xc4, 0x0d, 0xe0, 0x55, 0x81, 0x57, 0xc8, 0x22,
			0xd4, 0xb8, 0xc5, 0x69, 0xd8, 0x49, 0xae, 0xd5,
			0x9d, 0x4e, 0x0f, 0xd7, 0xf3, 0x79, 0x58, 0x6b,
			0x4b, 0x7f, 0xf6, 0x84, 0xed, 0x6a, 0x18, 0x9f,
			0x74, 0x86, 0xd4, 0x9b, 0x9c, 0x4b, 0xad, 0x9b,
			0xa2, 0x4b, 0x96, 0xab, 0xf9, 0x24, 0x37, 0x2c,
			0x8a, 0x8f, 0xff, 0xb1, 0x0d, 0x55, 0x35, 0x49,
			0x00, 0xa7, 0x7a, 0x3d, 0xb5, 0xf2, 0x05, 0xe1,
			0xb9, 0x9f, 0xcd, 0x86, 0x60, 0x86, 0x3a, 0x15,
			0x9a, 0xd4, 0xab, 0xe4, 0x0f, 0xa4, 0x89, 0x34,
			0x16, 0x3d, 0xdd, 0xe5, 0x42, 0xa6, 0x58, 0x55,
			0x40, 0xfd, 0x68, 0x3c, 0xbf, 0xd8, 0xc0, 0x0f,
			0x12, 0x12, 0x9a, 0x28, 0x4d, 0xea, 0xcc, 0x4c,
			0xde, 0xfe, 0x58, 0xbe, 0x71, 0x37, 0x54, 0x1c,
			0x04, 0x71, 0x26, 0xc8, 0xd4, 0x9e, 0x27, 0x55,
			0xab, 0x18, 0x1a, 0xb7, 0xe9, 0x40, 0xb0, 0xc0,
		},
	},
};

#define N_RC4_TESTS (sizeof(rc4_tests) / sizeof(rc4_tests[0]))

static int
rc4_test(void)
{
	const struct rc4_test *rt;
	RC4_KEY key;
	EVP_CIPHER_CTX *ctx = NULL;
	const EVP_CIPHER *cipher;
	uint8_t out[512];
	int in_len, out_len, total_len;
	size_t i;
	int j;
	int failed = 1;

	if ((ctx = EVP_CIPHER_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL: EVP_CIPHER_CTX_new() failed\n");
		goto failed;
	}

	for (i = 0; i < N_RC4_TESTS; i++) {
		rt = &rc4_tests[i];

		/* Encryption */
		memset(out, 0, sizeof(out));
		RC4_set_key(&key, rt->key_len, rt->key);
		RC4(&key, rt->len, rt->in, out);

		if (memcmp(rt->out, out, rt->len) != 0) {
			fprintf(stderr, "FAIL: encryption mismatch\n");
			goto failed;
		}

		/* Decryption */
		memset(out, 0, sizeof(out));
		RC4_set_key(&key, rt->key_len, rt->key);
		RC4(&key, rt->len, rt->out, out);

		if (memcmp(rt->in, out, rt->len) != 0) {
			fprintf(stderr, "FAIL: decryption mismatch\n");
			goto failed;
		}

		/*
		 * EVP tests
		 */
		if (rt->key_len == 5) {
			cipher = EVP_rc4_40();
		} else if (rt->key_len == 16) {
			cipher = EVP_rc4();
		} else {
			/* EVP does not support this key length */
			continue;
		}

		/* EVP encryption */
		total_len = 0;
		memset(out, 0, sizeof(out));
		if (!EVP_EncryptInit(ctx, cipher, rt->key, NULL)) {
			fprintf(stderr, "FAIL: EVP_EncryptInit failed\n");
			goto failed;
		}

		for (j = 0; j < rt->len;) {
			in_len = arc4random_uniform(sizeof(rt->len) / 2);
			if (in_len > rt->len - j)
				in_len = rt->len - j;

			if (!EVP_EncryptUpdate(ctx, out + total_len, &out_len,
			    rt->in + j, in_len)) {
				fprintf(stderr,
				    "FAIL: EVP_EncryptUpdate failed\n");
				goto failed;
			}

			j += in_len;
			total_len += out_len;
		}

		if (!EVP_EncryptFinal_ex(ctx, out + total_len, &out_len)) {
			fprintf(stderr, "FAIL: EVP_EncryptFinal_ex failed\n");
			goto failed;
		}
		total_len += out_len;

		if (!EVP_CIPHER_CTX_reset(ctx)) {
			fprintf(stderr, "FAIL: EVP_CIPHER_CTX_reset failed\n");
			goto failed;
		}

		if (total_len != rt->len) {
			fprintf(stderr,
			    "FAIL: EVP encryption length mismatch\n");
			goto failed;
		}

		if (memcmp(rt->out, out, rt->len) != 0) {
			fprintf(stderr, "FAIL: EVP encryption mismatch\n");
			goto failed;
		}

		/* EVP decryption */
		total_len = 0;
		memset(out, 0, sizeof(out));
		if (!EVP_DecryptInit(ctx, cipher, rt->key, NULL)) {
			fprintf(stderr, "FAIL: EVP_DecryptInit failed\n");
			goto failed;
		}

		for (j = 0; j < rt->len;) {
			in_len = arc4random_uniform(sizeof(rt->len) / 2);
			if (in_len > rt->len - j)
				in_len = rt->len - j;

			if (!EVP_DecryptUpdate(ctx, out + total_len, &out_len,
			    rt->in + j, in_len)) {
				fprintf(stderr,
				    "FAIL: EVP_DecryptUpdate failed\n");
				goto failed;
			}

			j += in_len;
			total_len += out_len;
		}

		if (!EVP_DecryptFinal_ex(ctx, out + total_len, &out_len)) {
			fprintf(stderr, "FAIL: EVP_DecryptFinal_ex failed\n");
			goto failed;
		}
		total_len += out_len;

		if (!EVP_CIPHER_CTX_reset(ctx)) {
			fprintf(stderr, "FAIL: EVP_CIPHER_CTX_reset failed\n");
			goto failed;
		}

		if (total_len != rt->len) {
			fprintf(stderr,
			    "FAIL: EVP decryption length mismatch\n");
			goto failed;
		}

		if (memcmp(rt->out, out, rt->len) != 0) {
			fprintf(stderr, "FAIL: EVP decryption mismatch\n");
			goto failed;
		}
	}

	failed = 0;

 failed:
	EVP_CIPHER_CTX_free(ctx);
	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= rc4_test();

	return failed;
}
Deleted jni/libressl/tests/rc4test.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*	$OpenBSD: rc4test.c,v 1.4 2018/07/17 17:06:49 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 * 
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from 
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 * 
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <openssl/evp.h>
#include <openssl/rc4.h>
#include <openssl/sha.h>

static unsigned char keys[7][30]={
	{8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
	{8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
	{8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
	{4,0xef,0x01,0x23,0x45},
	{8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
	{4,0xef,0x01,0x23,0x45},
	};

static unsigned char data_len[7]={8,8,8,20,28,10};
static unsigned char data[7][30]={
	{0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xff},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	   0x00,0x00,0x00,0x00,0xff},
	{0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
	   0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
	   0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
	   0x12,0x34,0x56,0x78,0xff},
	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
	{0},
	};

static unsigned char output[7][30]={
	{0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96,0x00},
	{0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79,0x00},
	{0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a,0x00},
	{0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,
	 0xbd,0x61,0x5a,0x11,0x62,0xe1,0xc7,0xba,
	 0x36,0xb6,0x78,0x58,0x00},
	{0x66,0xa0,0x94,0x9f,0x8a,0xf7,0xd6,0x89,
	 0x1f,0x7f,0x83,0x2b,0xa8,0x33,0xc0,0x0c,
	 0x89,0x2e,0xbe,0x30,0x14,0x3c,0xe2,0x87,
	 0x40,0x01,0x1e,0xcf,0x00},
	{0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61,0x00},
	{0},
	};

int main(int argc, char *argv[])
	{
	int i,err=0;
	int j;
	unsigned char *p;
	RC4_KEY key;
	unsigned char obuf[512];

	OPENSSL_add_all_algorithms_noconf();

	for (i=0; i<6; i++)
		{
		RC4_set_key(&key,keys[i][0],&(keys[i][1]));
		memset(obuf,0x00,sizeof(obuf));
		RC4(&key,data_len[i],&(data[i][0]),obuf);
		if (memcmp(obuf,output[i],data_len[i]+1) != 0)
			{
			printf("error calculating RC4\n");
			printf("output:");
			for (j=0; j<data_len[i]+1; j++)
				printf(" %02x",obuf[j]);
			printf("\n");
			printf("expect:");
			p= &(output[i][0]);
			for (j=0; j<data_len[i]+1; j++)
				printf(" %02x",*(p++));
			printf("\n");
			err++;
			}
		else
			printf("test %d ok\n",i);
		}
	printf("test end processing ");
	for (i=0; i<data_len[3]; i++)
		{
		RC4_set_key(&key,keys[3][0],&(keys[3][1]));
		memset(obuf,0x00,sizeof(obuf));
		RC4(&key,i,&(data[3][0]),obuf);
		if ((memcmp(obuf,output[3],i) != 0) || (obuf[i] != 0))
			{
			printf("error in RC4 length processing\n");
			printf("output:");
			for (j=0; j<i+1; j++)
				printf(" %02x",obuf[j]);
			printf("\n");
			printf("expect:");
			p= &(output[3][0]);
			for (j=0; j<i; j++)
				printf(" %02x",*(p++));
			printf(" 00\n");
			err++;
			}
		else
			{
			printf(".");
			fflush(stdout);
			}
		}
	printf("done\n");
	printf("test multi-call ");
	for (i=0; i<data_len[3]; i++)
		{
		RC4_set_key(&key,keys[3][0],&(keys[3][1]));
		memset(obuf,0x00,sizeof(obuf));
		RC4(&key,i,&(data[3][0]),obuf);
		RC4(&key,data_len[3]-i,&(data[3][i]),&(obuf[i]));
		if (memcmp(obuf,output[3],data_len[3]+1) != 0)
			{
			printf("error in RC4 multi-call processing\n");
			printf("output:");
			for (j=0; j<data_len[3]+1; j++)
				printf(" %02x",obuf[j]);
			printf("\n");
			printf("expect:");
			p= &(output[3][0]);
			for (j=0; j<data_len[3]+1; j++)
				printf(" %02x",*(p++));
			err++;
			}
		else
			{
			printf(".");
			fflush(stdout);
			}
		}
	printf("done\n");
	printf("bulk test ");
	{   unsigned char buf[513];
	    SHA_CTX c;
	    unsigned char md[SHA_DIGEST_LENGTH];
	    static unsigned char expected[]={
		0xa4,0x7b,0xcc,0x00,0x3d,0xd0,0xbd,0xe1,0xac,0x5f,
		0x12,0x1e,0x45,0xbc,0xfb,0x1a,0xa1,0xf2,0x7f,0xc5 };

		RC4_set_key(&key,keys[0][0],&(keys[3][1]));
		memset(buf,'\0',sizeof(buf));
		SHA1_Init(&c);
		for (i=0;i<2571;i++) {
			RC4(&key,sizeof(buf),buf,buf);
			SHA1_Update(&c,buf,sizeof(buf));
		}
		SHA1_Final(md,&c);

		if (memcmp(md,expected,sizeof(md))) {
			printf("error in RC4 bulk test\n");
			printf("output:");
			for (j=0; j<(int)sizeof(md); j++)
				printf(" %02x",md[j]);
			printf("\n");
			printf("expect:");
			for (j=0; j<(int)sizeof(md); j++)
				printf(" %02x",expected[j]);
			printf("\n");
			err++;
		}
		else	printf("ok\n");
	}
	exit(err);
	}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































Changes to jni/libressl/tests/record_layer_test.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: record_layer_test.c,v 1.4 2021/03/29 16:22:02 jsing Exp $ */
/*
 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: record_layer_test.c,v 1.5 2022/06/10 22:00:15 tb Exp $ */
/*
 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

	if (dtls)
		tls12_record_layer_set_version(rl, DTLS1_2_VERSION);

	memcpy(seq_num, snt->seq_num, sizeof(seq_num));

	if ((ret = tls12_record_layer_inc_seq_num(rl, seq_num)) != snt->want) {
		fprintf(stderr, "FAIL: Test %zu - got return %i, want %i\n",
		    test_no, ret, snt->want);
		goto failure;
	}

	if (memcmp(seq_num, snt->want_num, sizeof(seq_num)) != 0) {
		fprintf(stderr, "FAIL: Test %zu - got sequence number:\n",
		    test_no);







|







207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

	if (dtls)
		tls12_record_layer_set_version(rl, DTLS1_2_VERSION);

	memcpy(seq_num, snt->seq_num, sizeof(seq_num));

	if ((ret = tls12_record_layer_inc_seq_num(rl, seq_num)) != snt->want) {
		fprintf(stderr, "FAIL: Test %zu - got return %d, want %d\n",
		    test_no, ret, snt->want);
		goto failure;
	}

	if (memcmp(seq_num, snt->want_num, sizeof(seq_num)) != 0) {
		fprintf(stderr, "FAIL: Test %zu - got sequence number:\n",
		    test_no);
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
	uint8_t seq_num[TLS13_RECORD_SEQ_NUM_LEN];
	int failed = 1;
	int ret;

	memcpy(seq_num, snt->seq_num, sizeof(seq_num));

	if ((ret = tls13_record_layer_inc_seq_num(seq_num)) != snt->want) {
		fprintf(stderr, "FAIL: Test %zu - got return %i, want %i\n",
		    test_no, ret, snt->want);
		goto failure;
	}

	if (memcmp(seq_num, snt->want_num, sizeof(seq_num)) != 0) {
		fprintf(stderr, "FAIL: Test %zu - got sequence number:\n",
		    test_no);







|







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
	uint8_t seq_num[TLS13_RECORD_SEQ_NUM_LEN];
	int failed = 1;
	int ret;

	memcpy(seq_num, snt->seq_num, sizeof(seq_num));

	if ((ret = tls13_record_layer_inc_seq_num(seq_num)) != snt->want) {
		fprintf(stderr, "FAIL: Test %zu - got return %d, want %d\n",
		    test_no, ret, snt->want);
		goto failure;
	}

	if (memcmp(seq_num, snt->want_num, sizeof(seq_num)) != 0) {
		fprintf(stderr, "FAIL: Test %zu - got sequence number:\n",
		    test_no);
Changes to jni/libressl/tests/recordtest.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: recordtest.c,v 1.4 2020/05/11 18:08:37 jsing Exp $ */
/*
 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: recordtest.c,v 1.5 2022/06/10 22:00:15 tb Exp $ */
/*
 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
	for (i = 0; rrt->rt[i].rw_len != 0 || rrt->rt[i].want_ret != 0; i++) {
		rs.eof = rrt->rt[i].eof;
		rs.len = rrt->rt[i].rw_len;

		ret = tls13_record_recv(rec, read_cb, &rs);
		if (ret != rrt->rt[i].want_ret) {
			fprintf(stderr, "FAIL: Test %zu/%zu - tls_record_recv "
			    "returned %zi, want %zi\n", test_no, i, ret,
			    rrt->rt[i].want_ret);
			goto failure;
		}
	}

	if (tls13_record_content_type(rec) != rrt->want_content_type) {
		fprintf(stderr, "FAIL: Test %zu - got content type %u, "







|







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
	for (i = 0; rrt->rt[i].rw_len != 0 || rrt->rt[i].want_ret != 0; i++) {
		rs.eof = rrt->rt[i].eof;
		rs.len = rrt->rt[i].rw_len;

		ret = tls13_record_recv(rec, read_cb, &rs);
		if (ret != rrt->rt[i].want_ret) {
			fprintf(stderr, "FAIL: Test %zu/%zu - tls_record_recv "
			    "returned %zd, want %zd\n", test_no, i, ret,
			    rrt->rt[i].want_ret);
			goto failure;
		}
	}

	if (tls13_record_content_type(rec) != rrt->want_content_type) {
		fprintf(stderr, "FAIL: Test %zu - got content type %u, "
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
	for (i = 0; rst->rt[i].rw_len != 0 || rst->rt[i].want_ret != 0; i++) {
		ws.eof = rst->rt[i].eof;
		ws.len = rst->rt[i].rw_len;

		ret = tls13_record_send(rec, write_cb, &ws);
		if (ret != rst->rt[i].want_ret) {
			fprintf(stderr, "FAIL: Test %zu/%zu - tls_record_send "
			    "returned %zi, want %zi\n", test_no, i, ret,
			    rst->rt[i].want_ret);
			goto failure;
		}
	}

	if (rst->want_data != NULL &&
	    memcmp(ws.buf, rst->want_data, rst->want_len) != 0) {







|







490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
	for (i = 0; rst->rt[i].rw_len != 0 || rst->rt[i].want_ret != 0; i++) {
		ws.eof = rst->rt[i].eof;
		ws.len = rst->rt[i].rw_len;

		ret = tls13_record_send(rec, write_cb, &ws);
		if (ret != rst->rt[i].want_ret) {
			fprintf(stderr, "FAIL: Test %zu/%zu - tls_record_send "
			    "returned %zd, want %zd\n", test_no, i, ret,
			    rst->rt[i].want_ret);
			goto failure;
		}
	}

	if (rst->want_data != NULL &&
	    memcmp(ws.buf, rst->want_data, rst->want_len) != 0) {
Added jni/libressl/tests/rfc3779.c.








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
/*	$OpenBSD: rfc3779.c,v 1.8 2022/05/12 19:58:45 tb Exp $ */
/*
 * Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <stdio.h>
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/x509v3.h>

#define RAW_ADDRESS_SIZE	16

static void
hexdump(const unsigned char *buf, size_t len)
{
	size_t i;

	for (i = 1; i <= len; i++)
		fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n");

	if (len % 8)
		fprintf(stderr, "\n");
}

static void
report_hexdump(const char *func, const char *description, const char *msg,
    const unsigned char *want, size_t want_len,
    const unsigned char *got, size_t got_len)
{
	fprintf(stderr, "%s: \"%s\" %s\nwant:\n", func, description, msg);
	hexdump(want, want_len);
	fprintf(stderr, "got:\n");
	hexdump(got, got_len);
}

static int
afi_size(int afi)
{
	switch (afi) {
	case IANA_AFI_IPV4:
		return 4;
	case IANA_AFI_IPV6:
		return 16;
	}
	return 0;
}

struct IPAddressOrRange_test {
	const char	*description;
	const uint8_t	 der[32];
	size_t		 der_len;
	unsigned	 afi;
	const uint8_t	 min[RAW_ADDRESS_SIZE];
	const uint8_t	 max[RAW_ADDRESS_SIZE];
};

const struct IPAddressOrRange_test IPAddressOrRange_test_data[] = {
	/* Examples from RFC 3779, section 2.1.1 */
	{
		.description = "address 10.5.0.4",
		.der = {
			0x03, 0x05, 0x00, 0x0a, 0x05, 0x00, 0x04,
		},
		.der_len = 7,
		.afi = IANA_AFI_IPV4,
		.min = {
			0x0a, 0x05, 0x00, 0x04,
		},
		.max = {
			0x0a, 0x05, 0x00, 0x04,
		}
	},
	{
		.description = "prefix 10.5.0/23",
		.der = {
			0x03, 0x04, 0x01, 0x0a, 0x05, 0x00,
		},
		.der_len = 6,
		.afi = IANA_AFI_IPV4,
		.min = {
			0x0a, 0x05, 0x00, 0x00,
		},
		.max = {
			0x0a, 0x05, 0x01, 0xff,
		}
	},
	{
		.description = "address 2001:0:200:3::1",
		.der = {
			0x03, 0x11, 0x00, 0x20, 0x01, 0x00, 0x00, 0x02,
			0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x01,
		},
		.der_len = 19,
		.afi = IANA_AFI_IPV6,
		.min = {
			0x20, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
		},
		.max = {
			0x20, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
		},
	},
	{
		.description = "prefix 2001:0:200/39",
		.der = {
			0x03, 0x06, 0x01, 0x20, 0x01, 0x00, 0x00, 0x02,
		},
		.der_len = 8,
		.afi = IANA_AFI_IPV6,
		.min = {
			0x20, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.max = {
			0x20, 0x01, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff,
			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		},
	},

	/* Examples from RFC 3779, Section 2.1.2 */
	{
		.description = "prefix 10.5.0/23 as a range",
		.der = {
			/* Sequence */
			0x30, 0x0b,
			/* 10.5.0.0 */
			0x03, 0x03, 0x00, 0x0a, 0x05,
			/* 10.5.1.255 */
			0x03, 0x04, 0x01, 0x0a, 0x05, 0x00,
		},
		.der_len = 13,
		.afi = IANA_AFI_IPV4,
		.min = {
			0x0a, 0x05, 0x00, 0x00,
		},
		.max = {
			0x0a, 0x05, 0x01, 0xff,
		}
	},
	{
		.description = "prefix 2001:0:200/39 as a range",
		.der = {
			/* Sequence */
			0x30, 0x10,
			/* 2001:0:200:: */
			0x03, 0x06, 0x01, 0x20, 0x01, 0x00, 0x00, 0x02,
			/* 2001:0:3ff:ffff:ffff:ffff:ffff:ffff */
			0x03, 0x06, 0x02, 0x20, 0x01, 0x00, 0x00, 0x00,
		},
		.der_len = 18,
		.afi = IANA_AFI_IPV6,
		.min = {
			0x20, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		},
		.max = {
			0x20, 0x01, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff,
			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		}
	},
	{
		.description = "prefix 0/0",
		.der = {
			0x03, 0x01, 0x00,
		},
		.der_len = 3,
		.afi = IANA_AFI_IPV4,
		.min = {
			0x00, 0x00, 0x00, 0x00,
		},
		.max = {
			0xff, 0xff, 0xff, 0xff,
		}
	},
	{
		.description = "prefix 10.64/12",
		.der = {
			0x03, 0x03, 0x04, 0x0a, 0x40,
		},
		.der_len = 5,
		.afi = IANA_AFI_IPV4,
		.min = {
			0x0a, 0x40, 0x00, 0x00,
		},
		.max = {
			0x0a, 0x4f, 0xff, 0xff,
		},
	},
	{
		.description = "prefix 10.64/20",
		.der = {
			0x03, 0x04, 0x04, 0x0a, 0x40, 0x00,
		},
		.der_len = 6,
		.afi = IANA_AFI_IPV4,
		.min = {
			0x0a, 0x40, 0x00, 0x00,
		},
		.max = {
			0x0a, 0x40, 0x0f, 0xff,
		},
	},
};

const size_t N_IPADDRESSORRANGE_TESTS =
    sizeof(IPAddressOrRange_test_data) / sizeof(IPAddressOrRange_test_data[0]);

static int
test_IPAddressOrRange(const struct IPAddressOrRange_test *test)
{
	IPAddressOrRange *aor;
	const unsigned char *p;
	unsigned char min[RAW_ADDRESS_SIZE] = {0}, max[RAW_ADDRESS_SIZE] = {0};
	unsigned char *out = NULL;
	int out_len;
	int afi_len;
	int memcmp_failed = 0;
	int failed = 1;

	/*
	 * First, decode DER from the test case.
	 */

	p = &test->der[0];
	if ((aor = d2i_IPAddressOrRange(NULL, &p, test->der_len)) == NULL) {
		fprintf(stderr, "%s: \"%s\" d2i_IPAddressOrRange failed\n",
		    __func__, test->description);
		goto err;
	}

	/*
	 * Now extract minimum and maximum from the parsed range.
	 */

	afi_len = afi_size(test->afi);

	if (X509v3_addr_get_range(aor, test->afi, min, max, sizeof min) !=
	    afi_len) {
		fprintf(stderr, "%s: \"%s\" X509v3_addr_get_range failed\n",
		    __func__, test->description);
		goto err;
	}

	/*
	 * Check that min and max match expectations.
	 */

	if (memcmp(min, test->min, afi_len) != 0) {
		memcmp_failed |= 1;
		report_hexdump(__func__, test->description, "memcmp min failed",
		    test->min, afi_len, min, afi_len);
	}
	if (memcmp(max, test->max, afi_len) != 0) {
		memcmp_failed |= 1;
		report_hexdump(__func__, test->description, "memcmp max failed",
		    test->max, afi_len, max, afi_len);
	}
	if (memcmp_failed)
		goto err;

	/*
	 * Now turn the parsed IPAddressOrRange back into DER and check that
	 * it matches the DER in the test case.
	 */

	out = NULL;
	if ((out_len = i2d_IPAddressOrRange(aor, &out)) <= 0) {
		fprintf(stderr, "%s: \"%s\" i2d_IPAddressOrRange failed\n",
		    __func__, test->description);
		goto err;
	}

	memcmp_failed = (size_t)out_len != test->der_len;
	if (!memcmp_failed)
		memcmp_failed = memcmp(test->der, out, out_len);

	if (memcmp_failed) {
		report_hexdump(__func__, test->description, "memcmp DER failed",
		    test->der, test->der_len, out, out_len);
		goto err;
	}

	failed = 0;
 err:
	IPAddressOrRange_free(aor);
	free(out);

	return failed;
}

static int
run_IPAddressOrRange_tests(void)
{
	size_t i;
	int failed = 0;

	for (i = 0; i < N_IPADDRESSORRANGE_TESTS; i++)
		failed |=
		    test_IPAddressOrRange(&IPAddressOrRange_test_data[i]);

	return failed;
}

/*
 * XXX: These should really be part of the public API...
 */
static IPAddrBlocks *IPAddrBlocks_new(void);
static void IPAddrBlocks_free(IPAddrBlocks *addr);
static __unused IPAddrBlocks *d2i_IPAddrBlocks(IPAddrBlocks **addrs,
    const unsigned char **in, long len);
static int i2d_IPAddrBlocks(IPAddrBlocks *addrs, unsigned char **out);

static IPAddrBlocks *
IPAddrBlocks_new(void)
{
	IPAddrBlocks *addrs;

	/*
	 * XXX The comparison function IPAddressFamily_cmp() isn't public.
	 * Start with the default and exploit a side effect of the lovely API
	 * which helpfully sets the correct function in a few places. Let's
	 * use the cheapest and easiest to reach one.
	 */
	if ((addrs = sk_IPAddressFamily_new_null()) == NULL)
		return NULL;
	if (!X509v3_addr_canonize(addrs)) {
		IPAddrBlocks_free(addrs);
		return NULL;
	}

	return addrs;
}

static void
IPAddrBlocks_free(IPAddrBlocks *addr)
{
	sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free);
}

/*
 * We want {d2i,i2d}_IPAddrBlocks() to play with the DER of the extension.
 * These don't exist, so we have to implement them ourselves.  IPAddrBlocks_it
 * isn't public, so we need to fetch it from the library.  We cache it in a
 * static variable to avoid the cost of a binary search through all supported
 * extensions on each call.
 */

static const ASN1_ITEM_EXP *
get_IPAddrBlocks_it(void)
{
	static const ASN1_ITEM_EXP *my_IPAddrBlocks_it;
	const X509V3_EXT_METHOD *v3_addr;

	if (my_IPAddrBlocks_it != NULL)
		return my_IPAddrBlocks_it;

	if ((v3_addr = X509V3_EXT_get_nid(NID_sbgp_ipAddrBlock)) == NULL) {
		fprintf(stderr, "could not get v3_addr\n");
		return NULL;
	}

	my_IPAddrBlocks_it = v3_addr->it;

	return my_IPAddrBlocks_it;
}

static __unused IPAddrBlocks *
d2i_IPAddrBlocks(IPAddrBlocks **addrs, const unsigned char **in, long len)
{
	const ASN1_ITEM_EXP *my_IPAddrBlocks_it;

	if ((my_IPAddrBlocks_it = get_IPAddrBlocks_it()) == NULL)
		return NULL;

	return (IPAddrBlocks *)ASN1_item_d2i((ASN1_VALUE **)addrs, in, len,
	    my_IPAddrBlocks_it);
}

static int
i2d_IPAddrBlocks(IPAddrBlocks *addrs, unsigned char **out)
{
	const ASN1_ITEM_EXP *my_IPAddrBlocks_it;

	if ((my_IPAddrBlocks_it = get_IPAddrBlocks_it()) == NULL)
		return -1;

	return ASN1_item_i2d((ASN1_VALUE *)addrs, out, my_IPAddrBlocks_it);
}

struct ipv4_prefix {
	unsigned char			addr[4];
	size_t				addr_len;
	size_t				prefix_len;
};

struct ipv4_range {
	unsigned char			min[4];
	unsigned char			max[4];
};

union ipv4_choice {
	struct ipv4_prefix	prefix;
	struct ipv4_range	range;
};

struct ipv6_prefix {
	unsigned char		addr[16];
	size_t			addr_len;
	size_t			prefix_len;
};

struct ipv6_range {
	unsigned char		min[16];
	unsigned char		max[16];
};

union ipv6_choice {
	struct ipv6_prefix	prefix;
	struct ipv6_range	range;
};

enum choice_type {
	choice_prefix,
	choice_range,
	choice_inherit,
	choice_last,
};

union ip {
	union ipv4_choice	ipv4;
	union ipv6_choice	ipv6;
};

enum safi {
	safi_none,
	safi_unicast,
	safi_multicast,
};

struct ip_addr_block {
	unsigned int		afi;
	enum safi		safi;
	enum choice_type	type;
	union ip		addr;
};

struct build_addr_block_test_data {
	char			*description;
	struct ip_addr_block	 addrs[16];
	char			 der[128];
	size_t			 der_len;
	int			 is_canonical;
	int			 inherits;
	unsigned int		 afis[4];
	int			 afi_len;
};

const struct build_addr_block_test_data build_addr_block_tests[] = {
	{
		.description = "RFC 3779, Appendix B, example 1",
		.addrs = {
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 0, 32,
					},
					.addr_len = 3,
					.prefix_len = 20,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 0, 64,
					},
					.addr_len = 3,
					.prefix_len = 24,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 1,
					},
					.addr_len = 2,
					.prefix_len = 16,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 2, 48,
					},
					.addr_len = 3,
					.prefix_len = 20,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 2, 64,
					},
					.addr_len = 3,
					.prefix_len = 24,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 3,
					},
					.addr_len = 2,
					.prefix_len = 16,
				},
			},
			{
				.afi = IANA_AFI_IPV6,
				.safi = safi_none,
				.type = choice_inherit,
			},
			{
				.type = choice_last,
			},
		},
		.der = {
			0x30, 0x35, 0x30, 0x2b, 0x04, 0x03, 0x00, 0x01,
			0x01, 0x30, 0x24, 0x03, 0x04, 0x04, 0x0a, 0x00,
			0x20, 0x03, 0x04, 0x00, 0x0a, 0x00, 0x40, 0x03,
			0x03, 0x00, 0x0a, 0x01, 0x30, 0x0c, 0x03, 0x04,
			0x04, 0x0a, 0x02, 0x30, 0x03, 0x04, 0x00, 0x0a,
			0x02, 0x40, 0x03, 0x03, 0x00, 0x0a, 0x03, 0x30,
			0x06, 0x04, 0x02, 0x00, 0x02, 0x05, 0x00,
		},
		.der_len = 55,
		.is_canonical = 0,
		.inherits = 1,
		.afis = {
			IANA_AFI_IPV4, IANA_AFI_IPV6,
		},
		.afi_len = 2,
	},
	{
		.description = "RFC 3779, Appendix B, example 1 canonical",
		.addrs = {
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 0, 32,
					},
					.addr_len = 3,
					.prefix_len = 20,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 0, 64,
					},
					.addr_len = 3,
					.prefix_len = 24,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 1,
					},
					.addr_len = 2,
					.prefix_len = 16,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_range,
				.addr.ipv4.range = {
					.min = {
						10, 2, 48, 00,
					},
					.max = {
						10, 2, 64, 255,
					},
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10, 3,
					},
					.addr_len = 2,
					.prefix_len = 16,
				},
			},
			{
				.afi = IANA_AFI_IPV6,
				.safi = safi_none,
				.type = choice_inherit,
			},
			{
				.type = choice_last,
			},
		},
		.der = {
			0x30, 0x35, 0x30, 0x2b, 0x04, 0x03, 0x00, 0x01,
			0x01, 0x30, 0x24, 0x03, 0x04, 0x04, 0x0a, 0x00,
			0x20, 0x03, 0x04, 0x00, 0x0a, 0x00, 0x40, 0x03,
			0x03, 0x00, 0x0a, 0x01, 0x30, 0x0c, 0x03, 0x04,
			0x04, 0x0a, 0x02, 0x30, 0x03, 0x04, 0x00, 0x0a,
			0x02, 0x40, 0x03, 0x03, 0x00, 0x0a, 0x03, 0x30,
			0x06, 0x04, 0x02, 0x00, 0x02, 0x05, 0x00,
		},
		.der_len = 55,
		.is_canonical = 1,
		.inherits = 1,
		.afis = {
			IANA_AFI_IPV4, IANA_AFI_IPV6,
		},
		.afi_len = 2,
	},
	{
		.description = "RFC 3779, Appendix B, example 2",
		.addrs = {
			{
				.afi = IANA_AFI_IPV6,
				.safi = safi_none,
				.type = choice_prefix,
				.addr.ipv6.prefix = {
					.addr = {
						0x20, 0x01, 0x00, 0x00,
						0x00, 0x02,
					},
					.addr_len = 6,
					.prefix_len = 48,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						10,
					},
					.addr_len = 1,
					.prefix_len = 8,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_unicast,
				.type = choice_prefix,
				.addr.ipv4.prefix = {
					.addr = {
						172, 16,
					},
					.addr_len = 2,
					.prefix_len = 12,
				},
			},
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_multicast,
				.type = choice_inherit,
			},
			{
				.type = choice_last,
			},
		},
		.der = {
			0x30, 0x2c, 0x30, 0x10, 0x04, 0x03, 0x00, 0x01,
			0x01, 0x30, 0x09, 0x03, 0x02, 0x00, 0x0a, 0x03,
			0x03, 0x04, 0xac, 0x10, 0x30, 0x07, 0x04, 0x03,
			0x00, 0x01, 0x02, 0x05, 0x00, 0x30, 0x0f, 0x04,
			0x02, 0x00, 0x02, 0x30, 0x09, 0x03, 0x07, 0x00,
			0x20, 0x01, 0x00, 0x00, 0x00, 0x02,
		},
		.der_len = 46,
		.is_canonical = 0,
		.inherits = 1,
		.afis = {
			IANA_AFI_IPV4, IANA_AFI_IPV4,
		},
		.afi_len = 2,
	},
	{
		.description = "Range should be prefix 127/8",
		.addrs = {
			{
				.afi = IANA_AFI_IPV4,
				.safi = safi_none,
				.type = choice_range,
				.addr.ipv4.range = {
					.min = {
						127, 0, 0, 0,
					},
					.max = {
						127, 255, 255, 255,
					},
				},
			},
			{
				.type = choice_last,
			},
		},
		.der = {
			0x30, 0x0c, 0x30, 0x0a, 0x04, 0x02, 0x00, 0x01,
			0x30, 0x04, 0x03, 0x02, 0x00, 0x7f,
		},
		.der_len = 14,
		.is_canonical = 1,
		.inherits = 0,
		.afis = {
			IANA_AFI_IPV4,
		},
		.afi_len = 1,
	},
};

const size_t N_BUILD_ADDR_BLOCK_TESTS =
    sizeof(build_addr_block_tests) / sizeof(build_addr_block_tests[0]);

static unsigned int *
addr_block_get_safi(const struct ip_addr_block *addr)
{
	static unsigned int safi;

	switch (addr->safi) {
	case safi_none:
		return NULL;
	case safi_unicast:
		safi = 1;
		break;
	case safi_multicast:
		safi = 2;
		break;
	}

	return &safi;
}

static int
addr_block_add_ipv4_addr(IPAddrBlocks *block, enum choice_type type,
    const union ipv4_choice *ipv4, unsigned int *safi)
{
	unsigned char addr[RAW_ADDRESS_SIZE] = {0};
	unsigned char min[RAW_ADDRESS_SIZE];
	unsigned char max[RAW_ADDRESS_SIZE];

	switch (type) {
	case choice_prefix:
		memcpy(addr, ipv4->prefix.addr, ipv4->prefix.addr_len);
		return X509v3_addr_add_prefix(block, IANA_AFI_IPV4, safi,
		    addr, ipv4->prefix.prefix_len);
	case choice_range:
		memcpy(min, ipv4->range.min, sizeof(ipv4->range.min));
		memcpy(max, ipv4->range.max, sizeof(ipv4->range.max));
		return X509v3_addr_add_range(block, IANA_AFI_IPV4, safi,
		    min, max);
	case choice_inherit:
		return X509v3_addr_add_inherit(block, IANA_AFI_IPV4, safi);
	case choice_last:
	default:
		return 0;
	}
}

static int
addr_block_add_ipv6_addr(IPAddrBlocks *block, enum choice_type type,
    const union ipv6_choice *ipv6, unsigned int *safi)
{
	unsigned char addr[RAW_ADDRESS_SIZE] = {0};
	unsigned char min[RAW_ADDRESS_SIZE];
	unsigned char max[RAW_ADDRESS_SIZE];

	switch (type) {
	case choice_prefix:
		memcpy(addr, ipv6->prefix.addr, ipv6->prefix.addr_len);
		return X509v3_addr_add_prefix(block, IANA_AFI_IPV6, safi,
		    addr, ipv6->prefix.prefix_len);
	case choice_range:
		memcpy(min, ipv6->range.min, sizeof(ipv6->range.min));
		memcpy(max, ipv6->range.max, sizeof(ipv6->range.max));
		return X509v3_addr_add_range(block, IANA_AFI_IPV6, safi,
		    min, max);
	case choice_inherit:
		return X509v3_addr_add_inherit(block, IANA_AFI_IPV6, safi);
	case choice_last:
	default:
		return 0;
	}
}

static int
addr_block_add_addrs(IPAddrBlocks *block, const struct ip_addr_block addrs[])
{
	const struct ip_addr_block	*addr;
	unsigned int			*safi;

	for (addr = &addrs[0]; addr->type != choice_last; addr++) {
		safi = addr_block_get_safi(addr);
		switch (addr->afi) {
		case IANA_AFI_IPV4:
			if (!addr_block_add_ipv4_addr(block, addr->type,
			    &addr->addr.ipv4, safi))
				return 0;
			break;
		case IANA_AFI_IPV6:
			if (!addr_block_add_ipv6_addr(block, addr->type,
			    &addr->addr.ipv6, safi))
				return 0;
			break;
		default:
			fprintf(stderr, "%s: corrupt test data", __func__);
			exit(1);
		}
	}

	return 1;
}

static int
build_addr_block_test(const struct build_addr_block_test_data *test)
{
	IPAddrBlocks	*addrs = NULL;
	unsigned char	*out = NULL;
	int		 out_len;
	int		 i;
	int		 memcmp_failed = 1;
	int		 failed = 1;

	if ((addrs = IPAddrBlocks_new()) == NULL)
		goto err;

	if (!addr_block_add_addrs(addrs, test->addrs))
		goto err;

	if (X509v3_addr_is_canonical(addrs) != test->is_canonical) {
		fprintf(stderr, "%s: \"%s\" X509v3_addr_is_canonical not %d\n",
		    __func__, test->description, test->is_canonical);
		goto err;
	}

	if (!X509v3_addr_canonize(addrs)) {
		fprintf(stderr, "%s: \"%s\" failed to canonize\n",
		    __func__, test->description);
		goto err;
	}

	if (!X509v3_addr_is_canonical(addrs)) {
		fprintf(stderr, "%s: \"%s\" canonization wasn't canonical\n",
		    __func__, test->description);
		goto err;
	}

	if ((out_len = i2d_IPAddrBlocks(addrs, &out)) <= 0) {
		fprintf(stderr, "%s: \"%s\" i2d_IPAddrBlocks failed\n",
		    __func__, test->description);
		goto err;
	}

	memcmp_failed = (size_t)out_len != test->der_len;
	if (!memcmp_failed)
		memcmp_failed = memcmp(out, test->der, test->der_len);
	if (memcmp_failed) {
		report_hexdump(__func__, test->description, "memcmp DER failed",
		    test->der, test->der_len, out, out_len);
		goto err;
	}

	if (X509v3_addr_inherits(addrs) != test->inherits) {
		fprintf(stderr, "%s: \"%s\" X509v3_addr_inherits not %d\n",
		    __func__, test->description, test->inherits);
		goto err;
	}

	for (i = 0; i < sk_IPAddressFamily_num(addrs) && i < test->afi_len; i++) {
		IPAddressFamily *family;
		unsigned int afi;

		family = sk_IPAddressFamily_value(addrs, i);

		if ((afi = X509v3_addr_get_afi(family)) == 0) {
			fprintf(stderr, "%s: \"%s\" X509v3_addr_get_afi"
			    " failed\n", __func__, test->description);
			goto err;
		}
		if (test->afis[i] != afi){
			fprintf(stderr, "%s: \"%s\" afi[%d] mismatch. "
			    "want: %u, got: %u\n", __func__,
			    test->description, i, test->afis[i], afi);
			goto err;
		}
	}
	if (i != test->afi_len) {
		fprintf(stderr, "%s: \"%s\" checked %d afis, expected %d\n",
		    __func__, test->description, i, test->afi_len);
		goto err;
	}

	failed = 0;

 err:
	IPAddrBlocks_free(addrs);
	free(out);

	return failed;
}

static int
run_IPAddrBlock_tests(void)
{
	size_t i;
	int failed = 0;

	for (i = 0; i < N_BUILD_ADDR_BLOCK_TESTS; i++)
		failed |= build_addr_block_test(&build_addr_block_tests[i]);

	return failed;
}

struct asid_or_range {
	int			 type;
	int			 inherit;
	const unsigned char	*min;
	const unsigned char	*max;
};

struct ASIdentifiers_build_test {
	const char		*description;
	int			 should_build;
	int			 inherits;
	int			 canonical;
	int			 should_canonize;
	struct asid_or_range	 delegations[8];
	const unsigned char	 der[128];
	size_t			 der_len;
};

/* Sentinel value used for marking the end of the delegations table. */
#define V3_ASID_END -1

const struct ASIdentifiers_build_test ASIdentifiers_build_data[] = {
	{
		.description = "RFC 3779, Appendix C",
		.should_build = 1,
		.inherits = 1,
		.canonical = 1,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "135",
				.max = NULL,
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "3000",
				.max = "3999",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "5001",
				.max = NULL,
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 1,
				.min = NULL,
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.der = {
			0x30, 0x1a, 0xa0, 0x14, 0x30, 0x12, 0x02, 0x02,
			0x00, 0x87, 0x30, 0x08, 0x02, 0x02, 0x0b, 0xb8,
			0x02, 0x02, 0x0f, 0x9f, 0x02, 0x02, 0x13, 0x89,
			0xa1, 0x02, 0x05, 0x00,
		},
		.der_len = 28,
	},
	{
		.description = "RFC 3779, Appendix C without rdi",
		.should_build = 1,
		.inherits = 0,
		.canonical = 1,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "135",
				.max = NULL,
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "3000",
				.max = "3999",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "5001",
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.der = {
			0x30, 0x16, 0xa0, 0x14, 0x30, 0x12, 0x02, 0x02,
			0x00, 0x87, 0x30, 0x08, 0x02, 0x02, 0x0b, 0xb8,
			0x02, 0x02, 0x0f, 0x9f, 0x02, 0x02, 0x13, 0x89,
		},
		.der_len = 24,
	},
	{
		.description = "RFC 3779, Appendix C variant",
		.should_build = 1,
		.inherits = 0,
		.canonical = 1,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "135",
				.max = NULL,
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "3000",
				.max = "3999",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "5001",
				.max = NULL,
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "135",
				.max = NULL,
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "3000",
				.max = "3999",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "5001",
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.der = {
			0x30, 0x2c, 0xa0, 0x14, 0x30, 0x12, 0x02, 0x02,
			0x00, 0x87, 0x30, 0x08, 0x02, 0x02, 0x0b, 0xb8,
			0x02, 0x02, 0x0f, 0x9f, 0x02, 0x02, 0x13, 0x89,
			0xa1, 0x14, 0x30, 0x12, 0x02, 0x02, 0x00, 0x87,
			0x30, 0x08, 0x02, 0x02, 0x0b, 0xb8, 0x02, 0x02,
			0x0f, 0x9f, 0x02, 0x02, 0x13, 0x89,
		},
		.der_len = 46,
	},
	{
		.description = "inherit only",
		.should_build = 1,
		.inherits = 1,
		.canonical = 1,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 1,
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.der = {
			0x30, 0x08, 0xa0, 0x02, 0x05, 0x00, 0xa1, 0x02,
			0x05, 0x00,
		},
		.der_len = 10,
	},
	{
		.description = "adjacent unsorted ranges are merged",
		.should_build = 1,
		.inherits = 0,
		.canonical = 0,
		.should_canonize = 1,
		.delegations = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "27",
				.max = NULL,
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "28",
				.max = "57",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "66",
				.max = "68",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "58",
				.max = "63",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "64",
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.der = {
			0x30, 0x14, 0xa1, 0x12, 0x30, 0x10, 0x30, 0x06,
			0x02, 0x01, 0x1b, 0x02, 0x01, 0x40, 0x30, 0x06,
			0x02, 0x01, 0x42, 0x02, 0x01, 0x44,
		},
		.der_len = 22,
	},
	{
		.description = "range of length 0",
		.should_build = 1,
		.inherits = 1,
		.canonical = 1,
		.should_canonize = 1,
		.delegations = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "27",
				.max = "27",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.der = {
			0x30, 0x10, 0xa0, 0x02, 0x05, 0x00, 0xa1, 0x0a,
			0x30, 0x08, 0x30, 0x06, 0x02, 0x01, 0x1b, 0x02,
			0x01, 0x1b,
		},
		.der_len = 18,
	},
	{
		.description = "reversed range doesn't canonize",
		.should_build = 1,
		.inherits = 0,
		.canonical = 0,
		.should_canonize = 0,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "57",
				.max = "42",
			},
			{
				.type = V3_ASID_END,
			},
		},
	},
	{
		.description = "overlapping ranges don't canonize",
		.should_build = 1,
		.inherits = 0,
		.canonical = 0,
		.should_canonize = 0,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "42",
				.max = "57",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "57",
				.max = "60",
			},
			{
				.type = V3_ASID_END,
			},
		},
	},
	{
		.description = "reversed interior range doesn't canonize",
		.should_build = 1,
		.inherits = 0,
		.canonical = 0,
		.should_canonize = 0,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "2",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "57",
				.max = "42",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "65523",
				.max = "65535",
			},
			{
				.type = V3_ASID_END,
			},
		},
	},
	{
		.description = "can't inherit and add AS ids",
		.should_build = 0,
		.inherits = 0,
		.canonical = 0,
		.should_canonize = 0,
		.delegations = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "2",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
	},
	{
		.description = "can't inherit and add rdis",
		.should_build = 0,
		.inherits = 0,
		.canonical = 0,
		.should_canonize = 0,
		.delegations = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "1",
				.max = "2",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
	},
};

const size_t N_ASIDENTIFIERS_BUILD_TESTS =
    sizeof(ASIdentifiers_build_data) / sizeof(ASIdentifiers_build_data[0]);

static int
add_as_delegation(ASIdentifiers *asid, const struct asid_or_range *delegation)
{
	ASN1_INTEGER	*min = NULL, *max = NULL;
	int		 ret = 0;

	if (delegation->inherit)
		return X509v3_asid_add_inherit(asid, delegation->type);

	if ((min = s2i_ASN1_INTEGER(NULL, delegation->min)) == NULL)
		goto err;

	if (delegation->max != NULL) {
		if ((max = s2i_ASN1_INTEGER(NULL, delegation->max)) == NULL)
			goto err;
	}

	if (!X509v3_asid_add_id_or_range(asid, delegation->type, min, max))
		goto err;
	min = NULL;
	max = NULL;

	ret = 1;

 err:
	ASN1_INTEGER_free(min);
	ASN1_INTEGER_free(max);

	return ret;
}

static ASIdentifiers *
build_asid(const struct asid_or_range delegations[])
{
	ASIdentifiers			*asid = NULL;
	const struct asid_or_range	*delegation;

	if ((asid = ASIdentifiers_new()) == NULL)
		goto err;

	for (delegation = &delegations[0]; delegation->type != V3_ASID_END;
	    delegation++) {
		if (!add_as_delegation(asid, delegation))
			goto err;
	}

	return asid;

 err:
	ASIdentifiers_free(asid);
	return NULL;
}

static int
build_asid_test(const struct ASIdentifiers_build_test *test)
{
	ASIdentifiers	*asid = NULL;
	unsigned char	*out = NULL;
	int		 out_len;
	int		 memcmp_failed = 1;
	int		 failed = 1;

	if ((asid = build_asid(test->delegations)) == NULL) {
		if (!test->should_build) {
			failed = 0;
			return failed;
		}
		fprintf(stderr, "%s: \"%s\" failed to build\n", __func__,
		    test->description);
		return failed;
	}

	if (!test->canonical) {
		if (X509v3_asid_is_canonical(asid)) {
			fprintf(stderr, "%s: \"%s\" shouldn't be canonical\n",
			    __func__, test->description);
			goto err;
		}
		if (X509v3_asid_canonize(asid) != test->should_canonize) {
			fprintf(stderr, "%s: \"%s\" failed to canonize\n",
			    __func__, test->description);
			goto err;
		}
		if (!test->should_canonize) {
			failed = 0;
			goto err;
		}
	}

	/*
	 * Verify that asid is in canonical form before converting it to DER.
	 */
	if (!X509v3_asid_is_canonical(asid)) {
		fprintf(stderr, "%s: asid is not canonical\n", __func__);
		goto err;
	}

	/*
	 * Convert asid to DER and check that it matches expectations
	 */
	out = NULL;
	if ((out_len = i2d_ASIdentifiers(asid, &out)) <= 0) {
		fprintf(stderr, "%s: \"%s\" i2d_ASIdentifiers failed\n",
		    __func__, test->description);
		goto err;
	}


	memcmp_failed = (size_t)out_len != test->der_len;
	if (!memcmp_failed)
		memcmp_failed = memcmp(out, test->der, test->der_len);
	if (memcmp_failed) {
		report_hexdump(__func__, test->description, "memcmp DER failed",
		    test->der, test->der_len, out, out_len);
		goto err;
	}

	/*
	 * Verify that asid inherits as expected
	 */
	if (X509v3_asid_inherits(asid) != test->inherits) {
		fprintf(stderr, "%s: \"%s\" unexpected asid inherit %d\n",
		    __func__, test->description, test->inherits);
		goto err;
	}

	failed = 0;

 err:
	free(out);
	ASIdentifiers_free(asid);

	return failed;
}

static int
run_ASIdentifiers_build_test(void)
{
	size_t i;
	int failed = 0;

	for (i = 0; i < N_ASIDENTIFIERS_BUILD_TESTS; i++)
		failed |= build_asid_test(&ASIdentifiers_build_data[i]);

	return failed;
}

struct ASIdentifiers_subset_test {
	const char		*description;
	struct asid_or_range	 delegationsA[8];
	struct asid_or_range	 delegationsB[8];
	int			 is_subset;
	int			 is_subset_if_canonized;
};

const struct ASIdentifiers_subset_test ASIdentifiers_subset_data[] = {
	{
		.description = "simple subset relation",
		.delegationsA = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "2",
				.max = "4",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "2",
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 1,
		.is_subset_if_canonized = 1,
	},
	{
		.description = "only asnums",
		.delegationsA = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "2",
				.max = "4",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 1,
		.is_subset_if_canonized = 1,
	},
	{
		.description = "only rdis",
		.delegationsA = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "2",
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 1,
		.is_subset_if_canonized = 1,
	},
	{
		.description = "child only has asnums, parent only has rdis",
		.delegationsA = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "2",
				.max = "4",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 0,
		.is_subset_if_canonized = 0,
	},
	{
		.description = "child only has rdis, parent only has asnums",
		.delegationsA = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "2",
				.max = "4",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 0,
		.is_subset_if_canonized = 0,
	},
	{
		.description = "child only has rdis, parent has both",
		.delegationsA = {
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "2",
				.max = "4",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 1,
		.is_subset_if_canonized = 1,
	},
	{
		.description = "subset relation only after canonization",
		.delegationsA = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "2",
				.max = NULL,
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "3",
				.max = "4",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "2",
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "3",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "4",
				.max = "5",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 0,
		.is_subset_if_canonized = 1,
	},
	{
		.description = "no subset if A inherits",
		.delegationsA = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "2",
				.max = NULL,
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "3",
				.max = "4",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "3",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "4",
				.max = "5",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "1",
				.max = "5",
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 0,
		.is_subset_if_canonized = 0,
	},
	{
		.description = "no subset if B inherits",
		.delegationsA = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "2",
				.max = NULL,
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "3",
				.max = "4",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 0,
				.min = "5",
				.max = NULL,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "3",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "4",
				.max = "5",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 0,
		.is_subset_if_canonized = 0,
	},
	{
		.description = "no subset if both inherit",
		.delegationsA = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "2",
				.max = NULL,
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "3",
				.max = "4",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.delegationsB = {
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "1",
				.max = "3",
			},
			{
				.type = V3_ASID_ASNUM,
				.inherit = 0,
				.min = "4",
				.max = "5",
			},
			{
				.type = V3_ASID_RDI,
				.inherit = 1,
			},
			{
				.type = V3_ASID_END,
			},
		},
		.is_subset = 0,
		.is_subset_if_canonized = 0,
	},
};

const size_t N_ASIDENTIFIERS_SUBSET_TESTS =
    sizeof(ASIdentifiers_subset_data) / sizeof(ASIdentifiers_subset_data[0]);

static int
asid_subset_test(const struct ASIdentifiers_subset_test *test)
{
	ASIdentifiers	*asidA = NULL, *asidB = NULL;
	int		 failed = 0;

	if ((asidA = build_asid(test->delegationsA)) == NULL)
		goto err;
	if ((asidB = build_asid(test->delegationsB)) == NULL)
		goto err;

	if (X509v3_asid_subset(asidA, asidB) != test->is_subset) {
		fprintf(stderr, "%s: \"%s\" X509v3_asid_subset failed\n",
		    __func__, test->description);
		failed = 1;
	}

	if (!test->is_subset) {
		if (!X509v3_asid_canonize(asidA))
			goto err;
		if (!X509v3_asid_canonize(asidB))
			goto err;
		if (X509v3_asid_subset(asidA, asidB) !=
		    test->is_subset_if_canonized) {
			fprintf(stderr, "%s: \"%s\" canonized subset failed\n",
			    __func__, test->description);
			failed = 1;
		}
	}

 err:
	ASIdentifiers_free(asidA);
	ASIdentifiers_free(asidB);

	return failed;
}

static int
run_ASIdentifiers_subset_test(void)
{
	size_t i;
	int failed = 0;

	for (i = 0; i < N_ASIDENTIFIERS_SUBSET_TESTS; i++)
		failed |= asid_subset_test(&ASIdentifiers_subset_data[i]);

	return failed;
}

int
main(void)
{
	int failed = 0;

	failed |= run_IPAddressOrRange_tests();
	failed |= run_IPAddrBlock_tests();
	failed |= run_ASIdentifiers_build_test();
	failed |= run_ASIdentifiers_subset_test();

	return failed;
}
Changes to jni/libressl/tests/rfc5280time.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: rfc5280time.c,v 1.4 2015/10/30 15:52:55 miod Exp $ */
/*
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2015 Bob Beck <beck@opebsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
|







1
2
3
4
5
6
7
8
/* $OpenBSD: rfc5280time.c,v 1.7 2022/09/05 21:12:08 tb Exp $ */
/*
 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2015 Bob Beck <beck@opebsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

static int
asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str)
{
	int length = strlen(str);

	if (asn1str->length != length) {
		fprintf(stderr, "FAIL: test %i - string lengths differ "
		    "(%i != %i)\n", test_no, asn1str->length, length);
		return (1);
	}
	if (strncmp(asn1str->data, str, length) != 0) {
		fprintf(stderr, "FAIL: test %i - strings differ "
		    "('%s' != '%s')\n", test_no, asn1str->data, str);
		return (1);
	}

	return (0);
}








|
|



|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

static int
asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str)
{
	int length = strlen(str);

	if (asn1str->length != length) {
		fprintf(stderr, "FAIL: test %d - string lengths differ "
		    "(%d != %d)\n", test_no, asn1str->length, length);
		return (1);
	}
	if (strncmp(asn1str->data, str, length) != 0) {
		fprintf(stderr, "FAIL: test %d - strings differ "
		    "('%s' != '%s')\n", test_no, asn1str->data, str);
		return (1);
	}

	return (0);
}

224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;
	if ((t = ASN1_TIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) {
		if (X509_cmp_time(gt, &now) != 0) {
			fprintf(stderr, "FAIL: test %i - successfully parsed as GENTIME "
			    "string '%s'\n", test_no, att->str);
			goto done;
		}
	}
	if (ASN1_UTCTIME_set_string(ut, att->str) != 0) {
		if (X509_cmp_time(ut, &now) != 0) {
			fprintf(stderr, "FAIL: test %i - successfully parsed as UTCTIME "
			    "string '%s'\n", test_no, att->str);
			goto done;
		}
	}
	if (ASN1_TIME_set_string(t, att->str) != 0) {
		if (X509_cmp_time(t, &now) != 0) {
			fprintf(stderr, "FAIL: test %i - successfully parsed as UTCTIME "
			    "string '%s'\n", test_no, att->str);
			goto done;
		}
	}

	failure = 0;








|






|






|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;
	if ((t = ASN1_TIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) {
		if (X509_cmp_time(gt, &now) != 0) {
			fprintf(stderr, "FAIL: test %d - successfully parsed as GENTIME "
			    "string '%s'\n", test_no, att->str);
			goto done;
		}
	}
	if (ASN1_UTCTIME_set_string(ut, att->str) != 0) {
		if (X509_cmp_time(ut, &now) != 0) {
			fprintf(stderr, "FAIL: test %d - successfully parsed as UTCTIME "
			    "string '%s'\n", test_no, att->str);
			goto done;
		}
	}
	if (ASN1_TIME_set_string(t, att->str) != 0) {
		if (X509_cmp_time(t, &now) != 0) {
			fprintf(stderr, "FAIL: test %d - successfully parsed as UTCTIME "
			    "string '%s'\n", test_no, att->str);
			goto done;
		}
	}

	failure = 0;

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
	int failure = 1;
	int i;

	if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->str) != 0)
		goto done;

	if ((i = X509_cmp_time(gt, &att->time)) != -1) {
		fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}

	att->time--;
	if ((i = X509_cmp_time(gt, &att->time)) != 1) {
		fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}
	att->time++;

	ASN1_GENERALIZEDTIME_free(gt);

	if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %i - failed to set time %lli\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->data) != 0)
		goto done;

	failure = 0;







|







|






|








|







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
	int failure = 1;
	int i;

	if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
		goto done;

	if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->str) != 0)
		goto done;

	if ((i = X509_cmp_time(gt, &att->time)) != -1) {
		fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}

	att->time--;
	if ((i = X509_cmp_time(gt, &att->time)) != 1) {
		fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}
	att->time++;

	ASN1_GENERALIZEDTIME_free(gt);

	if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %d - failed to set time %lld\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, gt, att->data) != 0)
		goto done;

	failure = 0;
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
	int failure = 1;
	int i;

	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;

	if (ASN1_UTCTIME_set_string(ut, att->str) != 1) {
		fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->str) != 0)
		goto done;

	if ((i = X509_cmp_time(ut, &att->time)) != -1) {
		fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}

	att->time--;
	if ((i = X509_cmp_time(ut, &att->time)) != 1) {
		fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}
	att->time++;

	ASN1_UTCTIME_free(ut);

	if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %i - failed to set time %lli\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->data) != 0)
		goto done;

	failure = 0;







|







|






|








|







318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
	int failure = 1;
	int i;

	if ((ut = ASN1_UTCTIME_new()) == NULL)
		goto done;

	if (ASN1_UTCTIME_set_string(ut, att->str) != 1) {
		fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
		    test_no, att->str);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->str) != 0)
		goto done;

	if ((i = X509_cmp_time(ut, &att->time)) != -1) {
		fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}

	att->time--;
	if ((i = X509_cmp_time(ut, &att->time)) != 1) {
		fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
		    test_no, i, (long long)att->time);
		goto done;
	}
	att->time++;

	ASN1_UTCTIME_free(ut);

	if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) {
		fprintf(stderr, "FAIL: test %d - failed to set time %lld\n",
		    test_no, (long long)att->time);
		goto done;
	}
	if (asn1_compare_str(test_no, ut, att->data) != 0)
		goto done;

	failure = 0;
Added jni/libressl/tests/rmd_test.c.


















































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*	$OpenBSD: rmd_test.c,v 1.1 2022/09/02 15:45:52 tb Exp $ */
/*
 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/evp.h>
#include <openssl/ripemd.h>

#include <stdint.h>
#include <string.h>

struct rmd_test {
	const uint8_t in[128];
	const size_t in_len;
	const uint8_t out[EVP_MAX_MD_SIZE];
};

static const struct rmd_test rmd_tests[] = {
	/*
	 * RIPEMD-160 - Test vectors from
	 * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
	 */
	{
		.in = "",
		.in_len = 0,
		.out = {
			0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54,
			0x61, 0x28, 0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48,
			0xb2, 0x25, 0x8d, 0x31,
		},
	},
	{
		.in = "a",
		.in_len = 1,
		.out = {
			0x0b, 0xdc, 0x9d, 0x2d, 0x25, 0x6b, 0x3e, 0xe9,
			0xda, 0xae, 0x34, 0x7b, 0xe6, 0xf4, 0xdc, 0x83,
			0x5a, 0x46, 0x7f, 0xfe,
		},
	},
	{
		.in = "abc",
		.in_len = 3,
		.out = {
			0x8e, 0xb2, 0x08, 0xf7, 0xe0, 0x5d, 0x98, 0x7a,
			0x9b, 0x04, 0x4a, 0x8e, 0x98, 0xc6, 0xb0, 0x87,
			0xf1, 0x5a, 0x0b, 0xfc,
		},
	},
	{
		.in = "message digest",
		.in_len = 14,
		.out = {
			0x5d, 0x06, 0x89, 0xef, 0x49, 0xd2, 0xfa, 0xe5,
			0x72, 0xb8, 0x81, 0xb1, 0x23, 0xa8, 0x5f, 0xfa,
			0x21, 0x59, 0x5f, 0x36,
		},
	},
	{
		.in = "abcdefghijklmnopqrstuvwxyz",
		.in_len = 26,
		.out = {
			0xf7, 0x1c, 0x27, 0x10, 0x9c, 0x69, 0x2c, 0x1b,
			0x56, 0xbb, 0xdc, 0xeb, 0x5b, 0x9d, 0x28, 0x65,
			0xb3, 0x70, 0x8d, 0xbc,
		},
	},
	{
		.in =
		    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
		.in_len = 56,
		.out = {
			0x12, 0xa0, 0x53, 0x38, 0x4a, 0x9c, 0x0c, 0x88,
			0xe4, 0x05, 0xa0, 0x6c, 0x27, 0xdc, 0xf4, 0x9a,
			0xda, 0x62, 0xeb, 0x2b,
		},
	},
	{
		.in =
		    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv"
		    "wxyz0123456789",
		.in_len = 62,
		.out = {
			0xb0, 0xe2, 0x0b, 0x6e, 0x31, 0x16, 0x64, 0x02,
			0x86, 0xed, 0x3a, 0x87, 0xa5, 0x71, 0x30, 0x79,
			0xb2, 0x1f, 0x51, 0x89,
		},
	},
	{
		.in =
		    "123456789012345678901234567890123456789012345678"
		    "90123456789012345678901234567890",
		.in_len = 80,
		.out = {
			0x9b, 0x75, 0x2e, 0x45, 0x57, 0x3d, 0x4b, 0x39,
			0xf4, 0xdb, 0xd3, 0x32, 0x3c, 0xab, 0x82, 0xbf,
			0x63, 0x32, 0x6b, 0xfb,
		},
	},
};

#define N_RMD_TESTS (sizeof(rmd_tests) / sizeof(rmd_tests[0]))

static int
rmd_test(void)
{
	const struct rmd_test *rt;
	EVP_MD_CTX *hash = NULL;
	uint8_t out[EVP_MAX_MD_SIZE];
	size_t in_len;
	size_t i;
	int failed = 1;

	if ((hash = EVP_MD_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n");
		goto failed;
	}

	for (i = 0; i < N_RMD_TESTS; i++) {
		rt = &rmd_tests[i];

		/* Digest */
		memset(out, 0, sizeof(out));
		RIPEMD160(rt->in, rt->in_len, out);
		if (memcmp(rt->out, out, RIPEMD160_DIGEST_LENGTH) != 0) {
			fprintf(stderr, "FAIL: mismatch\n");
			goto failed;
		}

		/* EVP single-shot digest */
		memset(out, 0, sizeof(out));
		if (!EVP_Digest(rt->in, rt->in_len, out, NULL, EVP_ripemd160(), NULL)) {
			fprintf(stderr, "FAIL: EVP_Digest failed\n");
			goto failed;
		}

		if (memcmp(rt->out, out, RIPEMD160_DIGEST_LENGTH) != 0) {
			fprintf(stderr, "FAIL: EVP single-shot mismatch\n");
			goto failed;
		}

		/* EVP digest */
		memset(out, 0, sizeof(out));
		if (!EVP_DigestInit_ex(hash, EVP_ripemd160(), NULL)) {
			fprintf(stderr, "FAIL: EVP_DigestInit_ex failed\n");
			goto failed;
		}

		in_len = rt->in_len / 2;
		if (!EVP_DigestUpdate(hash, rt->in, in_len)) {
			fprintf(stderr,
			    "FAIL: EVP_DigestUpdate first half failed\n");
			goto failed;
		}

		if (!EVP_DigestUpdate(hash, rt->in + in_len,
		    rt->in_len - in_len)) {
			fprintf(stderr,
			    "FAIL: EVP_DigestUpdate second half failed\n");
			goto failed;
		}

		if (!EVP_DigestFinal_ex(hash, out, NULL)) {
			fprintf(stderr, "FAIL: EVP_DigestFinal_ex failed\n");
			goto failed;
		}

		if (memcmp(rt->out, out, RIPEMD160_DIGEST_LENGTH) != 0) {
			fprintf(stderr, "FAIL: EVP mismatch\n");
			goto failed;
		}
	}

	failed = 0;

 failed:
	EVP_MD_CTX_free(hash);
	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= rmd_test();

	return failed;
}
Deleted jni/libressl/tests/rmdtest.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*	$OpenBSD: rmdtest.c,v 1.2 2018/07/17 17:06:49 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 * 
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 * 
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from 
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 * 
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <openssl/ripemd.h>
#include <openssl/evp.h>

static char *test[]={
	"",
	"a",
	"abc",
	"message digest",
	"abcdefghijklmnopqrstuvwxyz",
	"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
	"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
	NULL,
	};

static char *ret[]={
	"9c1185a5c5e9fc54612808977ee8f548b2258d31",
	"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe",
	"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc",
	"5d0689ef49d2fae572b881b123a85ffa21595f36",
	"f71c27109c692c1b56bbdceb5b9d2865b3708dbc",
	"12a053384a9c0c88e405a06c27dcf49ada62eb2b",
	"b0e20b6e3116640286ed3a87a5713079b21f5189",
	"9b752e45573d4b39f4dbd3323cab82bf63326bfb",
	};

static char *pt(unsigned char *md);
int main(int argc, char *argv[])
	{
	int i,err=0;
	char **P,**R;
	char *p;
	unsigned char md[RIPEMD160_DIGEST_LENGTH];

	P=test;
	R=ret;
	i=1;
	while (*P != NULL)
		{
		EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL);
		p=pt(md);
		if (strcmp(p,(char *)*R) != 0)
			{
			printf("error calculating RIPEMD160 on '%s'\n",*P);
			printf("got %s instead of %s\n",p,*R);
			err++;
			}
		else
			printf("test %d ok\n",i);
		i++;
		R++;
		P++;
		}
	exit(err);
	return(0);
	}

static char *pt(unsigned char *md)
	{
	int i;
	static char buf[80];

	for (i=0; i<RIPEMD160_DIGEST_LENGTH; i++)
		snprintf(buf + i*2, sizeof(buf) - i*2, "%02x",md[i]);
	return(buf);
	}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































Added jni/libressl/tests/server1-ecdsa-chain.pem.




















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
subject= CN = LibreSSL Test Server 1 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBqzCCAVKgAwIBAgIJAOVssaaTYoH4MAoGCCqGSM49BAMCMC4xLDAqBgNVBAMM
I0xpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTIxMTIyNzE0
NDA0MFoXDTMxMTIyNTE0NDA0MFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBT
ZXJ2ZXIgMSBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLCfzrwjvJ6V
m2Jog48gtuDNYupHd8TKOCVb6J7f1/U3Owwy2//ZVTvM+9uoIC8xxUJAmN0PC+9a
+5TkRWiD1KWjYDBeMB0GA1UdDgQWBBTo776/p89eGJwMmJRNk4k+xGVRPTAfBgNV
HSMEGDAWgBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1Ud
DwEB/wQEAwIHgDAKBggqhkjOPQQDAgNHADBEAiAhHPaADQMcGea7iBRbKZWSHUAf
fZSNIWF/nYASNBvKLgIgQXLiuWxt6/a7vxaZwgYXkhP1YfDSC5Kpktxr/3jHcAU=
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrDCCAVOgAwIBAgIJAOVssaaTYoH3MAkGByqGSM49BAEwJjEkMCIGA1UEAwwb
TGlicmVTU0wgVGVzdCBSb290IENBIEVDRFNBMB4XDTIxMTIyNzE0NDA0MFoXDTMx
MTIyNTE0NDA0MFowLjEsMCoGA1UEAwwjTGlicmVTU0wgVGVzdCBJbnRlcm1lZGlh
dGUgQ0EgRUNEU0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATWRQbJh4aHPzHq
LOAmosW/o83bTpm3Sj1VxM44StmG7c1nnFM/+gS8rp2bVSgjWZQzRtZqGVGJgzbk
7/M1m3x3o2MwYTAdBgNVHQ4EFgQUF1Y9b/xKVxI5QsoCcoGrUA3kwggwHwYDVR0j
BBgwFoAUtvkat4UdcUEipt6L/PBgEFYH6AwwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwCQYHKoZIzj0EAQNIADBFAiBE4NiOdv/XRN3WWMnkE5QccvC6
VThoIQRyBf4I97cRPQIhAK18dvwrLuOOfbhWMdkpNCddMkWZHxS7traw/8+s7OUU
-----END CERTIFICATE-----
Added jni/libressl/tests/server1-ecdsa.pem.




































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
subject= CN = LibreSSL Test Server 1 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBqzCCAVKgAwIBAgIJAOVssaaTYoH4MAoGCCqGSM49BAMCMC4xLDAqBgNVBAMM
I0xpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTIxMTIyNzE0
NDA0MFoXDTMxMTIyNTE0NDA0MFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBT
ZXJ2ZXIgMSBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLCfzrwjvJ6V
m2Jog48gtuDNYupHd8TKOCVb6J7f1/U3Owwy2//ZVTvM+9uoIC8xxUJAmN0PC+9a
+5TkRWiD1KWjYDBeMB0GA1UdDgQWBBTo776/p89eGJwMmJRNk4k+xGVRPTAfBgNV
HSMEGDAWgBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1Ud
DwEB/wQEAwIHgDAKBggqhkjOPQQDAgNHADBEAiAhHPaADQMcGea7iBRbKZWSHUAf
fZSNIWF/nYASNBvKLgIgQXLiuWxt6/a7vxaZwgYXkhP1YfDSC5Kpktxr/3jHcAU=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgvh2q0Zzqn18tPux2
csqpbWDtHGialpwtx/r/0ENHeKOhRANCAASwn868I7yelZtiaIOPILbgzWLqR3fE
yjglW+ie39f1NzsMMtv/2VU7zPvbqCAvMcVCQJjdDwvvWvuU5EVog9Sl
-----END PRIVATE KEY-----
Added jni/libressl/tests/server1-rsa-chain.pem.
























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
subject= CN = LibreSSL Test Server 1 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoHzMA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzdaFw0zMTEyMjUxNDQwMzdaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
U2VydmVyIDEgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnvyt
i0uA2qaFltVb8+PElYk84AnjY0WZDcGtKSMCAYTD857fO2V4S/wpJ9ZMt8kBKQ29
D2Glkkhc/HPpb7wJcAUT++aZ/PbOtuzOHzdxheOolfZ6aw+qCSiVlcflKfMp7VPL
swimqKpm6atl2aSqldKfmGzjhAAPiTXbzUjh9pbTfO8ykdn/6AqP7ju3+4sseMPL
seNq1wstWRdiHm0P/BoJn4lwDe7QTSp1AxMqDTz5BiO+UjCW2oTsOFfo/hhslQf5
qv7uPLrz/VWiEojQP5RzfcnVwplUgTvtaOkXxZeOH7VkKS1v8W506/h3RIKj0X8Y
JDLuIPqSAPNLWGyH4wIDAQABo2AwXjAdBgNVHQ4EFgQUFJPGTfe+ULC/anJ4fCVz
DXA0JI4wHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAGP5hYyAYzlj
YCV24ApNPb+mNEMHu1SL1MgDXJOTWZMFOvuYcibtmcVIfwpM4+UpC7cRqPRjBEqm
NdLbJi4jGzQDNOcI7OZCCx6oKvAhjMofpb42Iq4bDuBqlhHRXvYnO30y0yRbSGXt
GvKvkNKOSXUnY1UtcBAN5szcyFk30xQK+f/2VqJguvjsTquFV+piqFyq91ICyIeQ
1gjTn1N2/SkmYpwZdyf0HqSjyqJ0FG4xiW6T0HmX1QI651Kux49vLel7ySxzGY+6
axnPilTYx/7pkciGk5ckLdujpXsDPhC+E2hdoee494c5NvX/uibYhigLU/gHK/ZP
YisY8ihnPl8=
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIJAOVssaaTYoHyMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0IEludGVybWVk
aWF0ZSBDQSBSU0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD151AI
I+W9MrEP3dO0PEjg6L9E1R6+CG6u0LT3Jobc/rG2RXqKLasEaXoBWYiJoTImVxFT
wtrY+IDDTaEV4/4RGII1fY8Js7v5NpwoEh15jCoJ6/qDjKd4y1s1M48PlWYNNRmv
OBKRIu3Fz7scUa1RSBCp1bZeHbq/V5SzG419nDq2xpyuUrwmfBhDZTH+kUwBNGn8
XVRFCRJQVP3qEAH02Zai2emSVj13KrhEWMtNyA8fa34GIuV23Q40RKW3jUgGBF+D
5jPNN8EZCj34nvvbjCCBs7cxZvD4F/MzGbatKpNmNOKXKibeg/xCq8B/F1uzHcl3
IzJuViNtQ3RjQ/1pAgMBAAGjYzBhMB0GA1UdDgQWBBQ2oaFa//6a3ZNBNV0NlN3n
A9jiZjAfBgNVHSMEGDAWgBQ+S/x79Kw0KqURKAHyiOhdj/8V0TAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAcok2oSct
BOkm75qA8+4eUilGxTaqFPCqY8fk8MKNRKNNzaqirPaLJW62mZaxRHOn1Bw9uzL3
jgz2PaTwA7n5GpKs3r5JLk8BdtRyeqMLmqJVJKKuu4GtJLCA8jhQm+XNA1Z324hg
kVeBHLPpLKvQxb+0lmbRBORq/OtMirq2yK8OlF2USrfQx0jmhSvvLpWyA0hhAXRS
gg1ds9aL57dELvk6gR7Unob+J0O2Xq3FRwz2O1k9fF86a0qrWUkxcnAjobC2BczC
7Fe5B194LgrX2U4IIrzwgJ19kmtrb1Qol2okECxomTYsbQY36sBs+LOKxSuiagu6
ZgJtfcNeVMglYQ==
-----END CERTIFICATE-----
Added jni/libressl/tests/server1-rsa.pem.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
subject= CN = LibreSSL Test Server 1 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoHzMA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzdaFw0zMTEyMjUxNDQwMzdaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
U2VydmVyIDEgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnvyt
i0uA2qaFltVb8+PElYk84AnjY0WZDcGtKSMCAYTD857fO2V4S/wpJ9ZMt8kBKQ29
D2Glkkhc/HPpb7wJcAUT++aZ/PbOtuzOHzdxheOolfZ6aw+qCSiVlcflKfMp7VPL
swimqKpm6atl2aSqldKfmGzjhAAPiTXbzUjh9pbTfO8ykdn/6AqP7ju3+4sseMPL
seNq1wstWRdiHm0P/BoJn4lwDe7QTSp1AxMqDTz5BiO+UjCW2oTsOFfo/hhslQf5
qv7uPLrz/VWiEojQP5RzfcnVwplUgTvtaOkXxZeOH7VkKS1v8W506/h3RIKj0X8Y
JDLuIPqSAPNLWGyH4wIDAQABo2AwXjAdBgNVHQ4EFgQUFJPGTfe+ULC/anJ4fCVz
DXA0JI4wHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAGP5hYyAYzlj
YCV24ApNPb+mNEMHu1SL1MgDXJOTWZMFOvuYcibtmcVIfwpM4+UpC7cRqPRjBEqm
NdLbJi4jGzQDNOcI7OZCCx6oKvAhjMofpb42Iq4bDuBqlhHRXvYnO30y0yRbSGXt
GvKvkNKOSXUnY1UtcBAN5szcyFk30xQK+f/2VqJguvjsTquFV+piqFyq91ICyIeQ
1gjTn1N2/SkmYpwZdyf0HqSjyqJ0FG4xiW6T0HmX1QI651Kux49vLel7ySxzGY+6
axnPilTYx/7pkciGk5ckLdujpXsDPhC+E2hdoee494c5NvX/uibYhigLU/gHK/ZP
YisY8ihnPl8=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCe/K2LS4DapoWW
1Vvz48SViTzgCeNjRZkNwa0pIwIBhMPznt87ZXhL/Ckn1ky3yQEpDb0PYaWSSFz8
c+lvvAlwBRP75pn89s627M4fN3GF46iV9nprD6oJKJWVx+Up8yntU8uzCKaoqmbp
q2XZpKqV0p+YbOOEAA+JNdvNSOH2ltN87zKR2f/oCo/uO7f7iyx4w8ux42rXCy1Z
F2IebQ/8GgmfiXAN7tBNKnUDEyoNPPkGI75SMJbahOw4V+j+GGyVB/mq/u48uvP9
VaISiNA/lHN9ydXCmVSBO+1o6RfFl44ftWQpLW/xbnTr+HdEgqPRfxgkMu4g+pIA
80tYbIfjAgMBAAECggEBAJDm9PkW6KrfyLPPZA5mUl6EBWKgQInS/gsmsT7j9EkU
C1A4RXcqJTkD6zKuw59h6NfU+LJTKgeoQm+o6WJ3/BYH2s3kwAZpn7/jFn4nFyWT
d6yuR6baUPwl7CfmV3wjbtwqWmajhNoG7OMd3yc9SGhi3iibXcWKFJ7W4q04NxJ5
txswRddLYMFUeJxPBdImlyibyUIWaYFid4O2kozTQWpyJld5SP4+YQObb6sBJuvN
wR53eaRGb0OaUGppglGlWTahIADBjbhf0zd9YiUjvums/cjx2goHzQqt4rIj1Pid
I3duu/kw7AsuRlvmhk02Cu4Ixr8hljbeo2L7UAP+4BkCgYEAzVq8Fqi/5IVdjl0H
FwvS9NX3HFFzdixtI2p/jCQ721Kxpf73zvRpMG/YZL3vBt4sXT7WpJZZsKrYogL7
8s/dG7p/GpzSnvJKQfT6Ko+jnv24MEIoqMx+Smd+nJJJ0KzZRvrqzcF+wsicmKnN
y/4t8T1DqSm4WxDyuy/uDozqCP0CgYEAxjJ9GJha40sHlY4sOTaJqapN6va/t70/
iRj+Mt9Bm1O41PBgu+SMADGukrjL5DYp53QRGhyqb2PWmZsGYvftPZNq5b3pzKPo
8jiP9AxYDt/GLO3x/GppiywOxHD8CV19BDVqWcBkV1ATu2kkmokDbq+g94xnMBzN
nURtfL5Hml8CgYAMeJIrnhvpOOAxoRypHaK2E7hqE9g7OP93wyPz0s9/xknbltxd
ySIKOwCdPZuigyOWlhZa8HaJ8BYv4JaEbHM1F+JYL2XrGTPBRatbolWBdk8VPy9Q
8PpKcnaR86Bf999KHDreO/4CvkQkUUuaM9l+aQYO4+W6QhE7pPGEGLKt0QKBgCL2
exzgm3/nF3JpfyGknkpA0bf2SUG3b8LWltkQizlEXqGpudbLbWsHWJ1nXghnCaNb
1Tx+/A3kVdIJB+pjhAVNwRjAFMNV0t0P300U9F/DV+lLHFoDx5SWdBBxQfTA+jHI
3nbwuoKwjJqN5LgiHWnkL4gby4QwQJFSpeHQiz8PAoGBAJaur4aFaSlgGAiKJX4/
Om4AedImBgFsVKf44xx5pDwEcqLeEwRBxa0r5Sftqsrz+Ck60hR/MWCwJEBll5PV
MJtOHBb2bINFhLOqV1WoSkSoKEhtMvFnLbWGBi5gYHC4+lYuyQqD/vu3sxe5IT9C
PKgUgKV32Z7KBpDuFGtGmiDb
-----END PRIVATE KEY-----
Added jni/libressl/tests/server2-ecdsa-chain.pem.




















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
subject= CN = LibreSSL Test Server 2 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBpjCCAUygAwIBAgIDEAABMAoGCCqGSM49BAMCMC4xLDAqBgNVBAMMI0xpYnJl
U1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTEwMDEwMTAwMDAwMFoX
DTIwMDEwMTAwMDAwMFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBTZXJ2ZXIg
MiBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJOTftmDhBMSS23a+sRO
3Zr43RUwtdJvNfKhpHKRbBLIttBkbI1wWCgufMLCJXhL6pSpCeT/C9ioFks2JMg7
CPCjYDBeMB0GA1UdDgQWBBSCtBk04EXYNjiFaaTcJumL0BFylTAfBgNVHSMEGDAW
gBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE
AwIHgDAKBggqhkjOPQQDAgNIADBFAiEAqnQ+TRgMZRys3z3olZysrnP0d6XIdfgv
XvlXRaM0s/QCIHdrTx/IPfJSvo0rDN08CJfbO0NBOc9PFsnDRUKsxJd4
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrDCCAVOgAwIBAgIJAOVssaaTYoH3MAkGByqGSM49BAEwJjEkMCIGA1UEAwwb
TGlicmVTU0wgVGVzdCBSb290IENBIEVDRFNBMB4XDTIxMTIyNzE0NDA0MFoXDTMx
MTIyNTE0NDA0MFowLjEsMCoGA1UEAwwjTGlicmVTU0wgVGVzdCBJbnRlcm1lZGlh
dGUgQ0EgRUNEU0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATWRQbJh4aHPzHq
LOAmosW/o83bTpm3Sj1VxM44StmG7c1nnFM/+gS8rp2bVSgjWZQzRtZqGVGJgzbk
7/M1m3x3o2MwYTAdBgNVHQ4EFgQUF1Y9b/xKVxI5QsoCcoGrUA3kwggwHwYDVR0j
BBgwFoAUtvkat4UdcUEipt6L/PBgEFYH6AwwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwCQYHKoZIzj0EAQNIADBFAiBE4NiOdv/XRN3WWMnkE5QccvC6
VThoIQRyBf4I97cRPQIhAK18dvwrLuOOfbhWMdkpNCddMkWZHxS7traw/8+s7OUU
-----END CERTIFICATE-----
Added jni/libressl/tests/server2-ecdsa.pem.




































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
subject= CN = LibreSSL Test Server 2 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBpjCCAUygAwIBAgIDEAABMAoGCCqGSM49BAMCMC4xLDAqBgNVBAMMI0xpYnJl
U1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIEVDRFNBMB4XDTEwMDEwMTAwMDAwMFoX
DTIwMDEwMTAwMDAwMFowJzElMCMGA1UEAwwcTGlicmVTU0wgVGVzdCBTZXJ2ZXIg
MiBFQ0RTQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJOTftmDhBMSS23a+sRO
3Zr43RUwtdJvNfKhpHKRbBLIttBkbI1wWCgufMLCJXhL6pSpCeT/C9ioFks2JMg7
CPCjYDBeMB0GA1UdDgQWBBSCtBk04EXYNjiFaaTcJumL0BFylTAfBgNVHSMEGDAW
gBQXVj1v/EpXEjlCygJygatQDeTCCDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE
AwIHgDAKBggqhkjOPQQDAgNIADBFAiEAqnQ+TRgMZRys3z3olZysrnP0d6XIdfgv
XvlXRaM0s/QCIHdrTx/IPfJSvo0rDN08CJfbO0NBOc9PFsnDRUKsxJd4
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgxkOt2jb6kQC1ZaUa
MLSz0lyS0YQtqChoyAvJ7yQf3FahRANCAASTk37Zg4QTEktt2vrETt2a+N0VMLXS
bzXyoaRykWwSyLbQZGyNcFgoLnzCwiV4S+qUqQnk/wvYqBZLNiTIOwjw
-----END PRIVATE KEY-----
Added jni/libressl/tests/server2-rsa-chain.pem.
























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
subject= CN = LibreSSL Test Server 2 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDLjCCAhagAwIBAgIDEAABMA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNVBAMMIUxp
YnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0xMDAxMDEwMDAwMDBa
Fw0yMDAxMDEwMDAwMDBaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3QgU2VydmVy
IDIgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu08owc3HqHu2
+92bKDs/VCVjkGMZSVOrdAXYEKf9WQ6cGxiowjJy391szSd5bW/Yf7hbNhctr29G
8oIj0wsMfz3lxuHDYISt8uAjbjqFiZTNfBeg7PVE9aDWXqaophcq4DT2ygv9O190
09RxTJD6PdclUtQNYZHr3c7kP2AdeBWWVPAmKISDSEkjXqc0x9LEtm7UA/0WAtKM
NUXUb/ZNBu90j7gRpjN6VyfaqJMdoDR31s7QXivL5hr4x0M0Y1ihN1/cHA5Qjb0s
6t8w6H2b0xtvJgO5N3ZUAVclAO3MsVRqr04aAyxcJ47qOkWPbh9OqaFyZFdl7L2r
UTLloQNkcwIDAQABo2AwXjAdBgNVHQ4EFgQUrDgWmmX6bVZt4Z7SvCSXEfJMoZQw
HwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/BAIwADAO
BgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBANbQG/fAGsV+J+cmEIlg
9i5c44hpr3BAXn5QYMbV9OQ8M9Rq8cZx/EkwNlCfPnQph2PqN2tZNstBnlL90rNq
pOj1Ee+ppemeJrHKFuEncytGHbgqjRLgi9n0vR5RF1I7dJvRlPugpf/FxeMC/7f2
qDDfdMsvmu/+qWBMb+U5yPLXlibGr7nf7B3t9ZBtku5flP3OOmipIjFpLOmvu06Z
9fac0JHDRvBQCemvIbSIa8Sz6UVJ1hKTjaN+lqc7e5tgbovNqjgFiLx0lQrfBmg9
tnNhoaEuwwyPNIVLUK3J1Q4lv/m9fX7BVmL5C56AexwtD/jupdXe2utjFx6YXrKG
nxU=
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIJAOVssaaTYoHyMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0IEludGVybWVk
aWF0ZSBDQSBSU0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD151AI
I+W9MrEP3dO0PEjg6L9E1R6+CG6u0LT3Jobc/rG2RXqKLasEaXoBWYiJoTImVxFT
wtrY+IDDTaEV4/4RGII1fY8Js7v5NpwoEh15jCoJ6/qDjKd4y1s1M48PlWYNNRmv
OBKRIu3Fz7scUa1RSBCp1bZeHbq/V5SzG419nDq2xpyuUrwmfBhDZTH+kUwBNGn8
XVRFCRJQVP3qEAH02Zai2emSVj13KrhEWMtNyA8fa34GIuV23Q40RKW3jUgGBF+D
5jPNN8EZCj34nvvbjCCBs7cxZvD4F/MzGbatKpNmNOKXKibeg/xCq8B/F1uzHcl3
IzJuViNtQ3RjQ/1pAgMBAAGjYzBhMB0GA1UdDgQWBBQ2oaFa//6a3ZNBNV0NlN3n
A9jiZjAfBgNVHSMEGDAWgBQ+S/x79Kw0KqURKAHyiOhdj/8V0TAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAcok2oSct
BOkm75qA8+4eUilGxTaqFPCqY8fk8MKNRKNNzaqirPaLJW62mZaxRHOn1Bw9uzL3
jgz2PaTwA7n5GpKs3r5JLk8BdtRyeqMLmqJVJKKuu4GtJLCA8jhQm+XNA1Z324hg
kVeBHLPpLKvQxb+0lmbRBORq/OtMirq2yK8OlF2USrfQx0jmhSvvLpWyA0hhAXRS
gg1ds9aL57dELvk6gR7Unob+J0O2Xq3FRwz2O1k9fF86a0qrWUkxcnAjobC2BczC
7Fe5B194LgrX2U4IIrzwgJ19kmtrb1Qol2okECxomTYsbQY36sBs+LOKxSuiagu6
ZgJtfcNeVMglYQ==
-----END CERTIFICATE-----
Added jni/libressl/tests/server2-rsa.pem.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
subject= CN = LibreSSL Test Server 2 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDLjCCAhagAwIBAgIDEAABMA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNVBAMMIUxp
YnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0xMDAxMDEwMDAwMDBa
Fw0yMDAxMDEwMDAwMDBaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3QgU2VydmVy
IDIgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu08owc3HqHu2
+92bKDs/VCVjkGMZSVOrdAXYEKf9WQ6cGxiowjJy391szSd5bW/Yf7hbNhctr29G
8oIj0wsMfz3lxuHDYISt8uAjbjqFiZTNfBeg7PVE9aDWXqaophcq4DT2ygv9O190
09RxTJD6PdclUtQNYZHr3c7kP2AdeBWWVPAmKISDSEkjXqc0x9LEtm7UA/0WAtKM
NUXUb/ZNBu90j7gRpjN6VyfaqJMdoDR31s7QXivL5hr4x0M0Y1ihN1/cHA5Qjb0s
6t8w6H2b0xtvJgO5N3ZUAVclAO3MsVRqr04aAyxcJ47qOkWPbh9OqaFyZFdl7L2r
UTLloQNkcwIDAQABo2AwXjAdBgNVHQ4EFgQUrDgWmmX6bVZt4Z7SvCSXEfJMoZQw
HwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/BAIwADAO
BgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBANbQG/fAGsV+J+cmEIlg
9i5c44hpr3BAXn5QYMbV9OQ8M9Rq8cZx/EkwNlCfPnQph2PqN2tZNstBnlL90rNq
pOj1Ee+ppemeJrHKFuEncytGHbgqjRLgi9n0vR5RF1I7dJvRlPugpf/FxeMC/7f2
qDDfdMsvmu/+qWBMb+U5yPLXlibGr7nf7B3t9ZBtku5flP3OOmipIjFpLOmvu06Z
9fac0JHDRvBQCemvIbSIa8Sz6UVJ1hKTjaN+lqc7e5tgbovNqjgFiLx0lQrfBmg9
tnNhoaEuwwyPNIVLUK3J1Q4lv/m9fX7BVmL5C56AexwtD/jupdXe2utjFx6YXrKG
nxU=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC7TyjBzceoe7b7
3ZsoOz9UJWOQYxlJU6t0BdgQp/1ZDpwbGKjCMnLf3WzNJ3ltb9h/uFs2Fy2vb0by
giPTCwx/PeXG4cNghK3y4CNuOoWJlM18F6Ds9UT1oNZepqimFyrgNPbKC/07X3TT
1HFMkPo91yVS1A1hkevdzuQ/YB14FZZU8CYohINISSNepzTH0sS2btQD/RYC0ow1
RdRv9k0G73SPuBGmM3pXJ9qokx2gNHfWztBeK8vmGvjHQzRjWKE3X9wcDlCNvSzq
3zDofZvTG28mA7k3dlQBVyUA7cyxVGqvThoDLFwnjuo6RY9uH06poXJkV2XsvatR
MuWhA2RzAgMBAAECggEAc5ApQzkkv+xkPwzAl5fGQLI4tXKOvVDj7VdVsSEUDAgZ
hBY4uGfLvBau8/wwzLY+yr4BeGPgieaLzT9BvwmIElEsHQJZOolhkQF8mpt8nB+0
j6U8YjYI78rlt8v3LVIJ3/6NbKbs+96vA6qEpIql+dVtb6bpApO3BEiLRhaU1+ra
pi5YbF56S3XlUFL6H46hpNTUxOqbb6toZ/2rr1nscu4jkQhL8u/KS5Uz1Y7RW3zd
A3U4rbxXnM8SVZrRuWsN1DRL5CpAOdGGiVhew46vAxZU8iX6rODrRaRCp+Gbnoll
x/ubMMrBrE4WpCY5orb41FPb4U6raY9ZZzTGPuC9YQKBgQDs0LrDy8kh3V7wsIwn
6vMT9MD2Olpl6zwSyQJ0C04u+hGNur3L6intg78TSRqZ7ZKK7CspPy9JCGTYztTG
vFbXy2vahCFlI2G3lfZj2nS2D+UNSmo2pdpBtuk/iKj67pFAlaa8C3OQ8MXjldQn
3QPANsCo276t0E9SmFcbJYJVCwKBgQDKe7sfdg0tQr9xsBeDuSxRJQOrtWeTmXm6
zcPKRX8avWr5Ag6w4/BX/RxGZkD4brV5LaK6Qsbwl8v8aNe8Hv4yBQFdW0IMP8mB
v4kVaNEGxoJE4fnKk1wS22TQvX5fxWPGZhOWQ1sgIqp3Dzvky0nalK7Ru0gRA4gS
Jl0a4Sp/OQKBgQCHwuW/B53n5yPdcij3XW87Go5g2nUmhqPq1QeuBSkuLzhO+yaB
t12QB35MDRXN9u+S6u+XdtyhzskZrgE3aZOTpM/Q9vy6IX2MpNEaz4snMJeMdgPM
DmrAT58KSEsviAMHdoOevCXlitK3tRZqP/89e2YZp9h5hrlizWjqbCd6nwKBgQCS
XFWqLB7iNHlFqE+W+2a5UNQSbhHscue2y71WnF1/6qNEUuRjoJ++OksR6B/Wc8/h
Q8d4c4RxrIfab75hUNXVOiD+ZlSbng/+JYDlZNqS1zKar+1rLJFFYCjDafXLLFcu
teI6n31jASvO28gjXX6I7ShgmctB4ReeZvSt1UxuoQKBgHQ/0fA3owx9kDRA41Hu
a+npibal0F2JOxn0xiwgW3JcH/EkcSIvUELm8Kjl3GBxf0y9Osu0uf3cSqW9K9+z
CRpwZmFq+q3HFN6FYHYI6oVvPKIljDhmkvw9HyexXFLRKNs1z2b7Noz2H7ysE0cb
1sAZitEjace2/eAx/wWr2dq0
-----END PRIVATE KEY-----
Added jni/libressl/tests/server3-ecdsa-chain.pem.




















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
subject= CN = LibreSSL Test Server 3 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBqjCCAVGgAwIBAgIJAOVssaaTYoH5MAkGByqGSM49BAEwLjEsMCoGA1UEAwwj
TGlicmVTU0wgVGVzdCBJbnRlcm1lZGlhdGUgQ0EgRUNEU0EwHhcNMjExMjI3MTQ0
MDQwWhcNMzExMjI1MTQ0MDQwWjAnMSUwIwYDVQQDDBxMaWJyZVNTTCBUZXN0IFNl
cnZlciAzIEVDRFNBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0pRqRW+PDenx
cp+5za1pFDdECxXPXZY7LUPoXxens1lPSM2diexVMdLw1kEbVkOZ50s1X32vQnTa
TVpovmwna6NgMF4wHQYDVR0OBBYEFCXbw+Fdv+OWDOU163ujSYbdJZx3MB8GA1Ud
IwQYMBaAFBdWPW/8SlcSOULKAnKBq1AN5MIIMAwGA1UdEwEB/wQCMAAwDgYDVR0P
AQH/BAQDAgeAMAkGByqGSM49BAEDSAAwRQIhAMt01G90LOiCVRIcodKP1nsOg3oY
kX8VHUPk9myD52KZAiBu32mh/fgaWsR/lbo2dyGJQHKkmHNt9Wy8hOQ9eGO91A==
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA ECDSA
issuer= CN = LibreSSL Test Root CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBrDCCAVOgAwIBAgIJAOVssaaTYoH3MAkGByqGSM49BAEwJjEkMCIGA1UEAwwb
TGlicmVTU0wgVGVzdCBSb290IENBIEVDRFNBMB4XDTIxMTIyNzE0NDA0MFoXDTMx
MTIyNTE0NDA0MFowLjEsMCoGA1UEAwwjTGlicmVTU0wgVGVzdCBJbnRlcm1lZGlh
dGUgQ0EgRUNEU0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATWRQbJh4aHPzHq
LOAmosW/o83bTpm3Sj1VxM44StmG7c1nnFM/+gS8rp2bVSgjWZQzRtZqGVGJgzbk
7/M1m3x3o2MwYTAdBgNVHQ4EFgQUF1Y9b/xKVxI5QsoCcoGrUA3kwggwHwYDVR0j
BBgwFoAUtvkat4UdcUEipt6L/PBgEFYH6AwwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwCQYHKoZIzj0EAQNIADBFAiBE4NiOdv/XRN3WWMnkE5QccvC6
VThoIQRyBf4I97cRPQIhAK18dvwrLuOOfbhWMdkpNCddMkWZHxS7traw/8+s7OUU
-----END CERTIFICATE-----
Added jni/libressl/tests/server3-ecdsa.pem.




































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
subject= CN = LibreSSL Test Server 3 ECDSA
issuer= CN = LibreSSL Test Intermediate CA ECDSA
-----BEGIN CERTIFICATE-----
MIIBqjCCAVGgAwIBAgIJAOVssaaTYoH5MAkGByqGSM49BAEwLjEsMCoGA1UEAwwj
TGlicmVTU0wgVGVzdCBJbnRlcm1lZGlhdGUgQ0EgRUNEU0EwHhcNMjExMjI3MTQ0
MDQwWhcNMzExMjI1MTQ0MDQwWjAnMSUwIwYDVQQDDBxMaWJyZVNTTCBUZXN0IFNl
cnZlciAzIEVDRFNBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0pRqRW+PDenx
cp+5za1pFDdECxXPXZY7LUPoXxens1lPSM2diexVMdLw1kEbVkOZ50s1X32vQnTa
TVpovmwna6NgMF4wHQYDVR0OBBYEFCXbw+Fdv+OWDOU163ujSYbdJZx3MB8GA1Ud
IwQYMBaAFBdWPW/8SlcSOULKAnKBq1AN5MIIMAwGA1UdEwEB/wQCMAAwDgYDVR0P
AQH/BAQDAgeAMAkGByqGSM49BAEDSAAwRQIhAMt01G90LOiCVRIcodKP1nsOg3oY
kX8VHUPk9myD52KZAiBu32mh/fgaWsR/lbo2dyGJQHKkmHNt9Wy8hOQ9eGO91A==
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgTWRMClyUOn11mX5s
hTTIQT+3BeauAjrTvKMy5RryWtyhRANCAATSlGpFb48N6fFyn7nNrWkUN0QLFc9d
ljstQ+hfF6ezWU9IzZ2J7FUx0vDWQRtWQ5nnSzVffa9CdNpNWmi+bCdr
-----END PRIVATE KEY-----
Added jni/libressl/tests/server3-rsa-chain.pem.
























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
subject= CN = LibreSSL Test Server 3 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoH0MA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzdaFw0zMTEyMjUxNDQwMzdaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
U2VydmVyIDMgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyqw4
GSS7/WAR0VYbqFTltj9Cv17m+RuztM1jiJq+MU0Gscbx59NFPt8UFevNsMzWNmAK
qkioEMVJxXzSUDBjXjLesDt/+VTjR46z16fje3MhGmWa8lDt7hpuHwDF80dg3rZa
kVEcgKvd6LODTucgE7l07DzMb8qAdRp1SDXIFECO0wLJewkf2CihmNukTxQhI0d+
XPZTYe3cyMelj8KpCXCXOVXKnXI+BWnYMHC1Op4S9z90xiVBNgQ+Vmg2K9NFifzT
ZyKIWsERq80rp1s+JmxmzA/vBRlsbj/Ec0h2kF4IavGtHwvAvdvIPV7AG/dIxwlT
VnHZkPDuLK0H396wmwIDAQABo2AwXjAdBgNVHQ4EFgQUSuP+QN+526Pxw/LGBTqP
WJpWGvwwHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAFBJ0mO7dpSN
euxoh2DJghVfqQB4ladEroDZJkJEDuDkY3SjC+WB/lJowBVPC2QkzjTZt/J4B0Om
6irtKUC8jQ7aqMBfESu/s//GEU4kwlvlJN/Z0nLOh1YEeCwbkavFDy/X62iZ9XvJ
gjLVVzaXKWGrgdJedHx9Di04rU9jME5qfpXZI50u8grZccpUuTTqpZBiGjFRda2j
nJhgPBrn9/ityYaOrif8taR+QM6AETvEpJWo+I/iQ7vATmxHuq6y+0Sza5j9wGH/
begJs9H890AiwO2bbUi1ehNj7NHZHySWNJlzBerwOQv7Zo8j+kHBop82ABsb/Xet
kgn7bdkfKoI=
-----END CERTIFICATE-----
subject= CN = LibreSSL Test Intermediate CA RSA
issuer= CN = LibreSSL Test Root CA RSA
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIJAOVssaaTYoHyMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGUxpYnJlU1NMIFRlc3QgUm9vdCBDQSBSU0EwHhcNMjExMjI3MTQ0MDM3WhcN
MzExMjI1MTQ0MDM3WjAsMSowKAYDVQQDDCFMaWJyZVNTTCBUZXN0IEludGVybWVk
aWF0ZSBDQSBSU0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD151AI
I+W9MrEP3dO0PEjg6L9E1R6+CG6u0LT3Jobc/rG2RXqKLasEaXoBWYiJoTImVxFT
wtrY+IDDTaEV4/4RGII1fY8Js7v5NpwoEh15jCoJ6/qDjKd4y1s1M48PlWYNNRmv
OBKRIu3Fz7scUa1RSBCp1bZeHbq/V5SzG419nDq2xpyuUrwmfBhDZTH+kUwBNGn8
XVRFCRJQVP3qEAH02Zai2emSVj13KrhEWMtNyA8fa34GIuV23Q40RKW3jUgGBF+D
5jPNN8EZCj34nvvbjCCBs7cxZvD4F/MzGbatKpNmNOKXKibeg/xCq8B/F1uzHcl3
IzJuViNtQ3RjQ/1pAgMBAAGjYzBhMB0GA1UdDgQWBBQ2oaFa//6a3ZNBNV0NlN3n
A9jiZjAfBgNVHSMEGDAWgBQ+S/x79Kw0KqURKAHyiOhdj/8V0TAPBgNVHRMBAf8E
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAcok2oSct
BOkm75qA8+4eUilGxTaqFPCqY8fk8MKNRKNNzaqirPaLJW62mZaxRHOn1Bw9uzL3
jgz2PaTwA7n5GpKs3r5JLk8BdtRyeqMLmqJVJKKuu4GtJLCA8jhQm+XNA1Z324hg
kVeBHLPpLKvQxb+0lmbRBORq/OtMirq2yK8OlF2USrfQx0jmhSvvLpWyA0hhAXRS
gg1ds9aL57dELvk6gR7Unob+J0O2Xq3FRwz2O1k9fF86a0qrWUkxcnAjobC2BczC
7Fe5B194LgrX2U4IIrzwgJ19kmtrb1Qol2okECxomTYsbQY36sBs+LOKxSuiagu6
ZgJtfcNeVMglYQ==
-----END CERTIFICATE-----
Added jni/libressl/tests/server3-rsa.pem.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
subject= CN = LibreSSL Test Server 3 RSA
issuer= CN = LibreSSL Test Intermediate CA RSA
-----BEGIN CERTIFICATE-----
MIIDNDCCAhygAwIBAgIJAOVssaaTYoH0MA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNV
BAMMIUxpYnJlU1NMIFRlc3QgSW50ZXJtZWRpYXRlIENBIFJTQTAeFw0yMTEyMjcx
NDQwMzdaFw0zMTEyMjUxNDQwMzdaMCUxIzAhBgNVBAMMGkxpYnJlU1NMIFRlc3Qg
U2VydmVyIDMgUlNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyqw4
GSS7/WAR0VYbqFTltj9Cv17m+RuztM1jiJq+MU0Gscbx59NFPt8UFevNsMzWNmAK
qkioEMVJxXzSUDBjXjLesDt/+VTjR46z16fje3MhGmWa8lDt7hpuHwDF80dg3rZa
kVEcgKvd6LODTucgE7l07DzMb8qAdRp1SDXIFECO0wLJewkf2CihmNukTxQhI0d+
XPZTYe3cyMelj8KpCXCXOVXKnXI+BWnYMHC1Op4S9z90xiVBNgQ+Vmg2K9NFifzT
ZyKIWsERq80rp1s+JmxmzA/vBRlsbj/Ec0h2kF4IavGtHwvAvdvIPV7AG/dIxwlT
VnHZkPDuLK0H396wmwIDAQABo2AwXjAdBgNVHQ4EFgQUSuP+QN+526Pxw/LGBTqP
WJpWGvwwHwYDVR0jBBgwFoAUNqGhWv/+mt2TQTVdDZTd5wPY4mYwDAYDVR0TAQH/
BAIwADAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAFBJ0mO7dpSN
euxoh2DJghVfqQB4ladEroDZJkJEDuDkY3SjC+WB/lJowBVPC2QkzjTZt/J4B0Om
6irtKUC8jQ7aqMBfESu/s//GEU4kwlvlJN/Z0nLOh1YEeCwbkavFDy/X62iZ9XvJ
gjLVVzaXKWGrgdJedHx9Di04rU9jME5qfpXZI50u8grZccpUuTTqpZBiGjFRda2j
nJhgPBrn9/ityYaOrif8taR+QM6AETvEpJWo+I/iQ7vATmxHuq6y+0Sza5j9wGH/
begJs9H890AiwO2bbUi1ehNj7NHZHySWNJlzBerwOQv7Zo8j+kHBop82ABsb/Xet
kgn7bdkfKoI=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDKrDgZJLv9YBHR
VhuoVOW2P0K/Xub5G7O0zWOImr4xTQaxxvHn00U+3xQV682wzNY2YAqqSKgQxUnF
fNJQMGNeMt6wO3/5VONHjrPXp+N7cyEaZZryUO3uGm4fAMXzR2DetlqRURyAq93o
s4NO5yATuXTsPMxvyoB1GnVINcgUQI7TAsl7CR/YKKGY26RPFCEjR35c9lNh7dzI
x6WPwqkJcJc5Vcqdcj4FadgwcLU6nhL3P3TGJUE2BD5WaDYr00WJ/NNnIohawRGr
zSunWz4mbGbMD+8FGWxuP8RzSHaQXghq8a0fC8C928g9XsAb90jHCVNWcdmQ8O4s
rQff3rCbAgMBAAECggEAAoOiaoVvI5SGhA9KZosvElS0kkUuHlb+oraNjotE4r2u
4JO0Ooj/aelAiYkUUyYnXiNQ3o3qL9MSuDV1MnN3OBrvckY6rzAjZabaiklV5Bko
hvhNtMXWPcbsKMxMqFjxVbHza6wS63G2XgWkEl2Bo10Am1Ghw51CfLFoVQ39vmqM
8xKqZBZRwRUNk/2ccNhG5crUOX9+wQJSVjZCTgevjCJVVsFX9NLsHsx7G1wtE580
AuFb9JEe66QNrtpTbKQP61W8YiRKQHT5uAAL0X9o88d2rpjGAcpJ8214aGH5P1HH
oUjL7mZceYuVeWvAMwLFFmPbPZuj3Ricgo1OIkKyyQKBgQDtNNXod5GzJyHOUrFR
rijyHhS81sOeDOhTbc1Cx8eFNH/svGATAU01HqgFRZpeJPHsAVYwVizfyqp/CESk
EFKTkMqRTat8Pkk+BtAGZD5fEBejl1fwRiBF9bTnk+u6q1WvBsQ0Bngf3v1CYGuq
rvb57AvhkCsEMjWs1YplBLwdVwKBgQDauvNslanbFstrWVBJqxV1iEaWmN1Lr//C
fwCFU8rH8VEvp+JJCICu7sE5Te+1TF/ASEs/bCrsW51YXjH30z3De1oFrjFVjwOU
XFMqcaTCX5Fjxv739LmgGuO2MCrItmveQHYkpTzCl6/p/pI4I1QJN0S5a/FaBNcW
x5tV2Ks4XQKBgHCCiBdsZ1pPbFR9moeAkQFOTU3InB5iRuwTf7F2Kue+oBK8wuEg
0+snMFDX08Flyq3DcIsaxMwdR8NbO5uJ9nDx03MaIQWcUYcvGgp+D6ttaZj5lwdr
a7FjOrxAyCXRUKHlFrkKfH25eey66TabKKAgWv5RMGYcHqNs4ejKVyOfAoGALqUf
tFBWYLqDtujdDljFwsLFCuieiL2HtVqQKd6sp+b2gUs0Ho8JokSYQDg2nlsjMEY6
hdPzc2Q2Mdoknc0WptFvaTa0nqJZCRKHSc3ibPEkeDq/tPEjhNk3JmsvNI5ygnsM
ttPmGTlv8l6vn/kouq5moYQ7fA78L4dxwOTr3qECgYBNuIf4vQq8WEkt0uSTJXom
UQVZglJu61NVGzR//lyukQB7/HrdEMB+JYJfev0o1GxLx1RV8rTVaeDJkUJjwn/h
qpqiLjJKF328oOuQdP3dH6AavH9r7gUOByOuxXgzZNbhtyNCrStAGOfX2xUxRZyZ
l0+QtrqbPtB4VSfZ0j+imw==
-----END PRIVATE KEY-----
Changes to jni/libressl/tests/servertest.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: servertest.c,v 1.6 2021/11/20 16:36:55 tb Exp $ */
/*
 * Copyright (c) 2015, 2016, 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: servertest.c,v 1.7 2022/06/10 22:00:15 tb Exp $ */
/*
 * Copyright (c) 2015, 2016, 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
server_hello_test(int testno, struct server_hello_test *sht)
{
	BIO *rbio = NULL, *wbio = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	int ret = 1;

	fprintf(stderr, "Test %i - %s\n", testno, sht->desc);

	if ((rbio = BIO_new_mem_buf(sht->client_hello,
	    sht->client_hello_len)) == NULL) {
		fprintf(stderr, "Failed to setup rbio\n");
		goto failure;
	}
	if ((wbio = BIO_new(BIO_s_mem())) == NULL) {







|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
server_hello_test(int testno, struct server_hello_test *sht)
{
	BIO *rbio = NULL, *wbio = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	int ret = 1;

	fprintf(stderr, "Test %d - %s\n", testno, sht->desc);

	if ((rbio = BIO_new_mem_buf(sht->client_hello,
	    sht->client_hello_len)) == NULL) {
		fprintf(stderr, "Failed to setup rbio\n");
		goto failure;
	}
	if ((wbio = BIO_new(BIO_s_mem())) == NULL) {
Deleted jni/libressl/tests/sha1test.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*	$OpenBSD: sha1test.c,v 1.6 2021/12/29 22:54:41 tb Exp $	*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 *
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 *
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <openssl/evp.h>
#include <openssl/sha.h>

static char *test[] = {
	"abc",
	"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
	NULL,
};

static char *ret[] = {
	"a9993e364706816aba3e25717850c26c9cd0d89d",
	"84983e441c3bd26ebaae4aa1f95129e5e54670f1",
};
static char *bigret =
    "34aa973cd4c4daa4f61eeb2bdbad27316534016f";

static char *pt(unsigned char *md);
int
main(int argc, char *argv[])
{
	int i, err = 0;
	char **P, **R;
	static unsigned char buf[1000];
	char *p, *r;
	EVP_MD_CTX *c;
	unsigned char md[SHA_DIGEST_LENGTH];

	if ((c = EVP_MD_CTX_new()) == NULL) {
		printf("EVP_MD_CTX_new() failed\n");
		return 1;
	}
	P = test;
	R = ret;
	i = 1;
	while (*P != NULL) {
		if (!EVP_Digest(*P, strlen((char *)*P), md, NULL, EVP_sha1(),
		    NULL)) {
			printf("EVP_Digest failed\n");
			goto err;
		}
		p = pt(md);
		if (strcmp(p, (char *)*R) != 0) {
			printf("error calculating SHA1 on '%s'\n", *P);
			printf("got %s instead of %s\n", p, *R);
			err++;
		} else
			printf("test %d ok\n", i);
		i++;
		R++;
		P++;
	}

	memset(buf, 'a', 1000);
	if (!EVP_DigestInit_ex(c, EVP_sha1(), NULL)) {
		printf("EVP_DigestInit_ex failed\n");
		goto err;
	}
	for (i = 0; i < 1000; i++) {
		if (!EVP_DigestUpdate(c, buf, 1000)) {
			printf("EVP_DigestUpdate failed\n");
			goto err;
		}
	}
	if (!EVP_DigestFinal_ex(c, md, NULL)) {
		printf("EVP_DigestFinal_ex failed\n");
		goto err;
	}
	p = pt(md);

	r = bigret;
	if (strcmp(p, r) != 0) {
		printf("error calculating SHA1 on 'a' * 1000\n");
		printf("got %s instead of %s\n", p, r);
		err++;
	} else
		printf("test 3 ok\n");

	EVP_MD_CTX_free(c);
	exit(err);

 err:
	EVP_MD_CTX_free(c);
	exit(1);
}

static char *
pt(unsigned char *md)
{
	int i;
	static char buf[80];

	for (i = 0; i < SHA_DIGEST_LENGTH; i++)
		snprintf(buf + i*2, sizeof(buf) - i*2, "%02x", md[i]);
	return (buf);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































Deleted jni/libressl/tests/sha256test.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*	$OpenBSD: sha256test.c,v 1.7 2021/12/29 22:56:25 tb Exp $	*/
/* ====================================================================
 * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
 * ====================================================================
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <openssl/sha.h>
#include <openssl/evp.h>

#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA256)
int
main(int argc, char *argv[])
{
	printf("No SHA256 support\n");
	return (0);
}
#else

unsigned char app_b1[SHA256_DIGEST_LENGTH] = {
	0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
	0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
	0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
	0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad,
};

unsigned char app_b2[SHA256_DIGEST_LENGTH] = {
	0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
	0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
	0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
	0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1,
};

unsigned char app_b3[SHA256_DIGEST_LENGTH] = {
	0xcd, 0xc7, 0x6e, 0x5c, 0x99, 0x14, 0xfb, 0x92,
	0x81, 0xa1, 0xc7, 0xe2, 0x84, 0xd7, 0x3e, 0x67,
	0xf1, 0x80, 0x9a, 0x48, 0xa4, 0x97, 0x20, 0x0e,
	0x04, 0x6d, 0x39, 0xcc, 0xc7, 0x11, 0x2c, 0xd0,
};

unsigned char addenum_1[SHA224_DIGEST_LENGTH] = {
	0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22,
	0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3,
	0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7,
	0xe3, 0x6c, 0x9d, 0xa7,
};

unsigned char addenum_2[SHA224_DIGEST_LENGTH] = {
	0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc,
	0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50,
	0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19,
	0x52, 0x52, 0x25, 0x25,
};

unsigned char addenum_3[SHA224_DIGEST_LENGTH] = {
	0x20, 0x79, 0x46, 0x55, 0x98, 0x0c, 0x91, 0xd8,
	0xbb, 0xb4, 0xc1, 0xea, 0x97, 0x61, 0x8a, 0x4b,
	0xf0, 0x3f, 0x42, 0x58, 0x19, 0x48, 0xb2, 0xee,
	0x4e, 0xe7, 0xad, 0x67,
};

int
main(int argc, char **argv) {
	unsigned char md[SHA256_DIGEST_LENGTH];
	int		i;
	int		ret = 1;
	EVP_MD_CTX	*evp = NULL;

	fprintf(stdout, "Testing SHA-256 ");

	EVP_Digest("abc",3,md,NULL,EVP_sha256(),NULL);
	if (memcmp(md, app_b1, sizeof(app_b1))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 1 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	EVP_Digest(
	    "abcdbcde""cdefdefg""efghfghi""ghijhijk"
	    "ijkljklm""klmnlmno""mnopnopq",
	    56, md, NULL, EVP_sha256(), NULL);
	if (memcmp(md, app_b2, sizeof(app_b2))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 2 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	if ((evp = EVP_MD_CTX_new()) == NULL) {
		fflush(stdout);
		fprintf(stderr, "\nEVP_MD_CTX_new() failed.\n");
		goto err;
	}
	if (!EVP_DigestInit_ex(evp, EVP_sha256(), NULL))
		goto err;
	for (i = 0; i < 1000000; i += 160) {
		if (!EVP_DigestUpdate(evp,
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
		    (1000000 - i) < 160 ? 1000000 - i : 160))
		goto err;
	}
	if (!EVP_DigestFinal_ex(evp, md, NULL))
		goto err;
	if (!EVP_MD_CTX_reset(evp))
		goto err;

	if (memcmp(md, app_b3, sizeof(app_b3))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 3 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	fprintf(stdout, " passed.\n"); fflush(stdout);

	fprintf(stdout, "Testing SHA-224 ");

	if (!EVP_Digest("abc",3,md,NULL,EVP_sha224(),NULL))
		goto err;
	if (memcmp(md, addenum_1, sizeof(addenum_1))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 1 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	if (!EVP_Digest(
	    "abcdbcde""cdefdefg""efghfghi""ghijhijk"
	    "ijkljklm""klmnlmno""mnopnopq",
	    56, md, NULL, EVP_sha224(), NULL))
		goto err;
	if (memcmp(md, addenum_2, sizeof(addenum_2))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 2 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	if (!EVP_DigestInit_ex (evp, EVP_sha224(), NULL))
		goto err;
	for (i = 0; i < 1000000; i += 64) {
		if (!EVP_DigestUpdate(evp,
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
		    (1000000 - i) < 64 ? 1000000 - i : 64))
			goto err;
	}
	if (!EVP_DigestFinal_ex(evp, md, NULL))
		goto err;
	if (!EVP_MD_CTX_reset(evp))
		goto err;

	if (memcmp(md, addenum_3, sizeof(addenum_3))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 3 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	fprintf(stdout, " passed.\n");
	fflush(stdout);

	ret = 0;

 err:
	EVP_MD_CTX_free(evp);

	return ret;
}
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































Deleted jni/libressl/tests/sha512test.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*	$OpenBSD: sha512test.c,v 1.7 2021/12/29 23:02:00 tb Exp $	*/
/* ====================================================================
 * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
 * ====================================================================
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <openssl/sha.h>
#include <openssl/evp.h>
#include <openssl/crypto.h>

#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA512)
int
main(int argc, char *argv[])
{
	printf("No SHA512 support\n");
	return (0);
}
#else

unsigned char app_c1[SHA512_DIGEST_LENGTH] = {
	0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
	0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
	0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
	0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
	0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
	0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
	0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
	0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f,
};

unsigned char app_c2[SHA512_DIGEST_LENGTH] = {
	0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
	0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
	0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
	0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
	0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
	0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
	0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
	0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09,
};

unsigned char app_c3[SHA512_DIGEST_LENGTH] = {
	0xe7, 0x18, 0x48, 0x3d, 0x0c, 0xe7, 0x69, 0x64,
	0x4e, 0x2e, 0x42, 0xc7, 0xbc, 0x15, 0xb4, 0x63,
	0x8e, 0x1f, 0x98, 0xb1, 0x3b, 0x20, 0x44, 0x28,
	0x56, 0x32, 0xa8, 0x03, 0xaf, 0xa9, 0x73, 0xeb,
	0xde, 0x0f, 0xf2, 0x44, 0x87, 0x7e, 0xa6, 0x0a,
	0x4c, 0xb0, 0x43, 0x2c, 0xe5, 0x77, 0xc3, 0x1b,
	0xeb, 0x00, 0x9c, 0x5c, 0x2c, 0x49, 0xaa, 0x2e,
	0x4e, 0xad, 0xb2, 0x17, 0xad, 0x8c, 0xc0, 0x9b,
};

unsigned char app_d1[SHA384_DIGEST_LENGTH] = {
	0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
	0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
	0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
	0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
	0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
	0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7,
};

unsigned char app_d2[SHA384_DIGEST_LENGTH] = {
	0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
	0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
	0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
	0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
	0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
	0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39,
};

unsigned char app_d3[SHA384_DIGEST_LENGTH] = {
	0x9d, 0x0e, 0x18, 0x09, 0x71, 0x64, 0x74, 0xcb,
	0x08, 0x6e, 0x83, 0x4e, 0x31, 0x0a, 0x4a, 0x1c,
	0xed, 0x14, 0x9e, 0x9c, 0x00, 0xf2, 0x48, 0x52,
	0x79, 0x72, 0xce, 0xc5, 0x70, 0x4c, 0x2a, 0x5b,
	0x07, 0xb8, 0xb3, 0xdc, 0x38, 0xec, 0xc4, 0xeb,
	0xae, 0x97, 0xdd, 0xd8, 0x7f, 0x3d, 0x89, 0x85,
};

int
main(int argc, char **argv)
{
	unsigned char md[SHA512_DIGEST_LENGTH];
	int		i;
	EVP_MD_CTX	*evp = NULL;

#ifdef OPENSSL_IA32_SSE2
	/* Alternative to this is to call OpenSSL_add_all_algorithms...
	 * The below code is retained exclusively for debugging purposes. */
	{
		char      *env;

		if ((env=getenv("OPENSSL_ia32cap")))
			OPENSSL_ia32cap = strtoul (env, NULL, 0);
	}
#endif

	fprintf(stdout, "Testing SHA-512 ");

	if (!EVP_Digest("abc", 3, md, NULL, EVP_sha512(), NULL))
		goto err;
	if (memcmp(md, app_c1, sizeof(app_c1))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 1 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	EVP_Digest(
	    "abcdefgh""bcdefghi""cdefghij""defghijk"
	    "efghijkl""fghijklm""ghijklmn""hijklmno"
	    "ijklmnop""jklmnopq""klmnopqr""lmnopqrs"
	    "mnopqrst""nopqrstu",
	    112, md, NULL, EVP_sha512(), NULL);
	if (memcmp(md, app_c2, sizeof(app_c2))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 2 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	if ((evp = EVP_MD_CTX_new()) == NULL) {
		fflush(stdout);
		fprintf(stderr, "\nEVP_MD_CTX_new() failed.\n");
		goto err;
	}
	if (!EVP_DigestInit_ex(evp, EVP_sha512(), NULL)) {
		fflush(stdout);
		fprintf(stderr, "\nEVP_DigestInit_ex failed.\n");
		goto err;
	}

	for (i = 0; i < 1000000; i += 288) {
		if (!EVP_DigestUpdate(evp,
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
		    (1000000 - i) < 288 ? 1000000 - i : 288)) {
			fflush(stdout);
			fprintf(stderr, "\nEVP_DigestUpdate failed.\n");
			goto err;
		}
	}
	if (!EVP_DigestFinal_ex(evp, md, NULL)) {
		fflush(stdout);
		fprintf(stderr, "\nEVP_DigestFinal failed.\n");
		goto err;
	}
	if (!EVP_MD_CTX_reset(evp)) {
		fflush(stdout);
		fprintf(stderr, "\nEVP_MD_CTX_reset failed.\n");
		goto err;
	}

	if (memcmp(md, app_c3, sizeof(app_c3))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 3 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	fprintf(stdout, " passed.\n");
	fflush(stdout);

	fprintf(stdout, "Testing SHA-384 ");

	EVP_Digest("abc", 3, md, NULL, EVP_sha384(), NULL);
	if (memcmp(md, app_d1, sizeof(app_d1))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 1 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	EVP_Digest(
	    "abcdefgh""bcdefghi""cdefghij""defghijk"
	    "efghijkl""fghijklm""ghijklmn""hijklmno"
	    "ijklmnop""jklmnopq""klmnopqr""lmnopqrs"
	    "mnopqrst""nopqrstu",
	    112, md, NULL, EVP_sha384(), NULL);
	if (memcmp(md, app_d2, sizeof(app_d2))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 2 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	if (!EVP_DigestInit_ex(evp, EVP_sha384(), NULL)) {
		fflush(stdout);
		fprintf(stderr, "\nEVP_DigestInit_ex failed.\n");
		goto err;
	}
	for (i = 0; i < 1000000; i += 64) {
		if (!EVP_DigestUpdate(evp,
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
		    "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
		    (1000000 - i) < 64 ? 1000000 - i : 64)) {
			fflush(stdout);
			fprintf(stderr, "\nEVP_DigestUpdate failed.\n");
			goto err;
		}
	}
	if (!EVP_DigestFinal_ex(evp, md, NULL)) {
		fflush(stdout);
		fprintf(stderr, "\nEVP_DigestFinal_ex failed.\n");
		goto err;
	}
	EVP_MD_CTX_free(evp);
	evp = NULL;

	if (memcmp(md, app_d3, sizeof(app_d3))) {
		fflush(stdout);
		fprintf(stderr, "\nTEST 3 of 3 failed.\n");
		goto err;
	}
	fprintf(stdout, ".");
	fflush(stdout);

	fprintf(stdout, " passed.\n");
	fflush(stdout);

	return 0;

 err:
	EVP_MD_CTX_free(evp);
	return 1;
}
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































Added jni/libressl/tests/sha_test.c.






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
/*	$OpenBSD: sha_test.c,v 1.4 2022/09/02 13:23:05 tb Exp $ */
/*
 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <openssl/evp.h>
#include <openssl/sha.h>

#include <stdint.h>
#include <string.h>

struct sha_test {
	const int algorithm;
	const uint8_t in[128];
	const size_t in_len;
	const uint8_t out[EVP_MAX_MD_SIZE];
};

static const struct sha_test sha_tests[] = {
	/* SHA-1 */
	{
		.algorithm = NID_sha1,
		.in = "abc",
		.in_len = 3,
		.out = {
			0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a,
			0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c,
			0x9c, 0xd0, 0xd8, 0x9d,
		}
	},
	{
		.algorithm = NID_sha1,
		.in = "",
		.in_len = 0,
		.out = {
			0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d,
			0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90,
			0xaf, 0xd8, 0x07, 0x09,
		}
	},
	{
		.algorithm = NID_sha1,
		.in =
		    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmno"
		    "mnopnopq",
		.in_len = 56,
		.out = {
			0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e,
			0xba, 0xae, 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5,
			0xe5, 0x46, 0x70, 0xf1,
		}
	},
	{
		.algorithm = NID_sha1,
		.in =
		    "abcdefghbcdefghicdefghijdefghijkefghijklfghijklm"
		    "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs"
		    "mnopqrstnopqrstu",
		.in_len = 112,
		.out = {
			0xa4, 0x9b, 0x24, 0x46, 0xa0, 0x2c, 0x64, 0x5b,
			0xf4, 0x19, 0xf9, 0x95, 0xb6, 0x70, 0x91, 0x25,
			0x3a, 0x04, 0xa2, 0x59,
		}
	},

	/* SHA-224 */
	{
		.algorithm = NID_sha224,
		.in = "abc",
		.in_len = 3,
		.out = {
			0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22,
			0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3,
			0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7,
			0xe3, 0x6c, 0x9d, 0xa7,
		}
	},
	{
		.algorithm = NID_sha224,
		.in = "",
		.in_len = 0,
		.out = {
			0xd1, 0x4a, 0x02, 0x8c, 0x2a, 0x3a, 0x2b, 0xc9,
			0x47, 0x61, 0x02, 0xbb, 0x28, 0x82, 0x34, 0xc4,
			0x15, 0xa2, 0xb0, 0x1f, 0x82, 0x8e, 0xa6, 0x2a,
			0xc5, 0xb3, 0xe4, 0x2f,
		}
	},
	{
		.algorithm = NID_sha224,
		.in =
		    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmno"
		    "mnopnopq",
		.in_len = 56,
		.out = {
			0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc,
			0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50,
			0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19,
			0x52, 0x52, 0x25, 0x25,
		}
	},
	{
		.algorithm = NID_sha224,
		.in =
		    "abcdefghbcdefghicdefghijdefghijkefghijklfghijklm"
		    "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs"
		    "mnopqrstnopqrstu",
		.in_len = 112,
		.out = {
			0xc9, 0x7c, 0xa9, 0xa5, 0x59, 0x85, 0x0c, 0xe9,
			0x7a, 0x04, 0xa9, 0x6d, 0xef, 0x6d, 0x99, 0xa9,
			0xe0, 0xe0, 0xe2, 0xab, 0x14, 0xe6, 0xb8, 0xdf,
			0x26, 0x5f, 0xc0, 0xb3,
		}
	},

	/* SHA-256 */
	{
		.algorithm = NID_sha256,
		.in = "abc",
		.in_len = 3,
		.out = {
			0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
			0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
			0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
			0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad,
		}
	},
	{
		.algorithm = NID_sha256,
		.in = "",
		.in_len = 0,
		.out = {
			0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14,
			0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24,
			0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
			0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55,
		}
	},
	{
		.algorithm = NID_sha256,
		.in =
		    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmno"
		    "mnopnopq",
		.in_len = 56,
		.out = {
			0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
			0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
			0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
			0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1,
		}
	},
	{
		.algorithm = NID_sha256,
		.in =
		    "abcdefghbcdefghicdefghijdefghijkefghijklfghijklm"
		    "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs"
		    "mnopqrstnopqrstu",
		.in_len = 112,
		.out = {
			0xcf, 0x5b, 0x16, 0xa7, 0x78, 0xaf, 0x83, 0x80,
			0x03, 0x6c, 0xe5, 0x9e, 0x7b, 0x04, 0x92, 0x37,
			0x0b, 0x24, 0x9b, 0x11, 0xe8, 0xf0, 0x7a, 0x51,
			0xaf, 0xac, 0x45, 0x03, 0x7a, 0xfe, 0xe9, 0xd1,
		}
	},

	/* SHA-384 */
	{
		.algorithm = NID_sha384,
		.in = "abc",
		.in_len = 3,
		.out = {
			0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
			0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
			0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
			0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
			0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
			0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7,
		}
	},
	{
		.algorithm = NID_sha384,
		.in = "",
		.in_len = 0,
		.out = {
			0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38,
			0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a,
			0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43,
			0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda,
			0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb,
			0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b,
		}
	},
	{
		.algorithm = NID_sha384,
		.in =
		    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmno"
		    "mnopnopq",
		.in_len = 56,
		.out = {
			0x33, 0x91, 0xfd, 0xdd, 0xfc, 0x8d, 0xc7, 0x39,
			0x37, 0x07, 0xa6, 0x5b, 0x1b, 0x47, 0x09, 0x39,
			0x7c, 0xf8, 0xb1, 0xd1, 0x62, 0xaf, 0x05, 0xab,
			0xfe, 0x8f, 0x45, 0x0d, 0xe5, 0xf3, 0x6b, 0xc6,
			0xb0, 0x45, 0x5a, 0x85, 0x20, 0xbc, 0x4e, 0x6f,
			0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b,
		}
	},
	{
		.algorithm = NID_sha384,
		.in =
		    "abcdefghbcdefghicdefghijdefghijkefghijklfghijklm"
		    "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs"
		    "mnopqrstnopqrstu",
		.in_len = 112,
		.out = {
			0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
			0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
			0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
			0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
			0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
			0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39,
		}
	},

	/* SHA-512 */
	{
		.algorithm = NID_sha512,
		.in = "abc",
		.in_len = 3,
		.out = {
			0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
			0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
			0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
			0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
			0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
			0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
			0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
			0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f,
		}
	},
	{
		.algorithm = NID_sha512,
		.in = "",
		.in_len = 0,
		.out = {
			0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd,
			0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07,
			0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc,
			0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce,
			0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0,
			0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f,
			0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81,
			0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e,
		}
	},
	{
		.algorithm = NID_sha512,
		.in =
		    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmno"
		    "mnopnopq",
		.in_len = 56,
		.out = {
			0x20, 0x4a, 0x8f, 0xc6, 0xdd, 0xa8, 0x2f, 0x0a,
			0x0c, 0xed, 0x7b, 0xeb, 0x8e, 0x08, 0xa4, 0x16,
			0x57, 0xc1, 0x6e, 0xf4, 0x68, 0xb2, 0x28, 0xa8,
			0x27, 0x9b, 0xe3, 0x31, 0xa7, 0x03, 0xc3, 0x35,
			0x96, 0xfd, 0x15, 0xc1, 0x3b, 0x1b, 0x07, 0xf9,
			0xaa, 0x1d, 0x3b, 0xea, 0x57, 0x78, 0x9c, 0xa0,
			0x31, 0xad, 0x85, 0xc7, 0xa7, 0x1d, 0xd7, 0x03,
			0x54, 0xec, 0x63, 0x12, 0x38, 0xca, 0x34, 0x45,
		}
	},
	{
		.algorithm = NID_sha512,
		.in =
		    "abcdefghbcdefghicdefghijdefghijkefghijklfghijklm"
		    "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs"
		    "mnopqrstnopqrstu",
		.in_len = 112,
		.out = {
			0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
			0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
			0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
			0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
			0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
			0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
			0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
			0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09,
		}
	},
};

struct sha_repetition_test {
	const int algorithm;
	const uint8_t in;
	const size_t in_repetitions;
	const uint8_t out[EVP_MAX_MD_SIZE];
};

static const struct sha_repetition_test sha_repetition_tests[] = {
	/* SHA-1 */
	{
		.algorithm = NID_sha1,
		.in = 'a',
		.in_repetitions = 1000000,
		.out = {
			0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4,
			0xf6, 0x1e, 0xeb, 0x2b, 0xdb, 0xad, 0x27, 0x31,
			0x65, 0x34, 0x01, 0x6f,
		}
	},

	/* SHA-224 */
	{
		.algorithm = NID_sha224,
		.in = 'a',
		.in_repetitions = 1000000,
		.out = {
			0x20, 0x79, 0x46, 0x55, 0x98, 0x0c, 0x91, 0xd8,
			0xbb, 0xb4, 0xc1, 0xea, 0x97, 0x61, 0x8a, 0x4b,
			0xf0, 0x3f, 0x42, 0x58, 0x19, 0x48, 0xb2, 0xee,
			0x4e, 0xe7, 0xad, 0x67,
		}
	},

	/* SHA-256 */
	{
		.algorithm = NID_sha256,
		.in = 'a',
		.in_repetitions = 1000000,
		.out = {
			0xcd, 0xc7, 0x6e, 0x5c, 0x99, 0x14, 0xfb, 0x92,
			0x81, 0xa1, 0xc7, 0xe2, 0x84, 0xd7, 0x3e, 0x67,
			0xf1, 0x80, 0x9a, 0x48, 0xa4, 0x97, 0x20, 0x0e,
			0x04, 0x6d, 0x39, 0xcc, 0xc7, 0x11, 0x2c, 0xd0,
		}
	},

	/* SHA-384 */
	{
		.algorithm = NID_sha384,
		.in = 'a',
		.in_repetitions = 1000000,
		.out = {
			0x9d, 0x0e, 0x18, 0x09, 0x71, 0x64, 0x74, 0xcb,
			0x08, 0x6e, 0x83, 0x4e, 0x31, 0x0a, 0x4a, 0x1c,
			0xed, 0x14, 0x9e, 0x9c, 0x00, 0xf2, 0x48, 0x52,
			0x79, 0x72, 0xce, 0xc5, 0x70, 0x4c, 0x2a, 0x5b,
			0x07, 0xb8, 0xb3, 0xdc, 0x38, 0xec, 0xc4, 0xeb,
			0xae, 0x97, 0xdd, 0xd8, 0x7f, 0x3d, 0x89, 0x85,
		}
	},

	/* SHA-512 */
	{
		.algorithm = NID_sha512,
		.in = 'a',
		.in_repetitions = 1000000,
		.out = {
			0xe7, 0x18, 0x48, 0x3d, 0x0c, 0xe7, 0x69, 0x64,
			0x4e, 0x2e, 0x42, 0xc7, 0xbc, 0x15, 0xb4, 0x63,
			0x8e, 0x1f, 0x98, 0xb1, 0x3b, 0x20, 0x44, 0x28,
			0x56, 0x32, 0xa8, 0x03, 0xaf, 0xa9, 0x73, 0xeb,
			0xde, 0x0f, 0xf2, 0x44, 0x87, 0x7e, 0xa6, 0x0a,
			0x4c, 0xb0, 0x43, 0x2c, 0xe5, 0x77, 0xc3, 0x1b,
			0xeb, 0x00, 0x9c, 0x5c, 0x2c, 0x49, 0xaa, 0x2e,
			0x4e, 0xad, 0xb2, 0x17, 0xad, 0x8c, 0xc0, 0x9b,
		}
	},
};

#define N_SHA_TESTS (sizeof(sha_tests) / sizeof(sha_tests[0]))
#define N_SHA_REPETITION_TESTS (sizeof(sha_repetition_tests) / sizeof(sha_repetition_tests[0]))

typedef unsigned char *(*sha_hash_func)(const unsigned char *, size_t,
    unsigned char *);

static int
sha_hash_from_algorithm(int algorithm, const char **out_label,
    sha_hash_func *out_func, const EVP_MD **out_md, size_t *out_len)
{
	const char *label;
	sha_hash_func sha_func;
	const EVP_MD *md;
	size_t len;

	switch (algorithm) {
	case NID_sha1:
		label = SN_sha1;
		sha_func = SHA1;
		md = EVP_sha1();
		len = SHA_DIGEST_LENGTH;
		break;
	case NID_sha224:
		label = SN_sha224;
		sha_func = SHA224;
		md = EVP_sha224();
		len = SHA224_DIGEST_LENGTH;
		break;
	case NID_sha256:
		label = SN_sha256;
		sha_func = SHA256;
		md = EVP_sha256();
		len = SHA256_DIGEST_LENGTH;
		break;
	case NID_sha384:
		label = SN_sha384;
		sha_func = SHA384;
		md = EVP_sha384();
		len = SHA384_DIGEST_LENGTH;
		break;
	case NID_sha512:
		label = SN_sha512;
		sha_func = SHA512;
		md = EVP_sha512();
		len = SHA512_DIGEST_LENGTH;
		break;
	default:
		fprintf(stderr, "FAIL: unknown algorithm (%d)\n",
		    algorithm);
		return 0;
	}

	if (out_label != NULL)
		*out_label = label;
	if (out_func != NULL)
		*out_func = sha_func;
	if (out_md != NULL)
		*out_md = md;
	if (out_len != NULL)
		*out_len = len;

	return 1;
}

static int
sha_test(void)
{
	sha_hash_func sha_func;
	const struct sha_test *st;
	EVP_MD_CTX *hash = NULL;
	const EVP_MD *md;
	uint8_t out[EVP_MAX_MD_SIZE];
	size_t in_len, out_len;
	size_t i;
	const char *label;
	int failed = 1;

	if ((hash = EVP_MD_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n");
		goto failed;
	}

	for (i = 0; i < N_SHA_TESTS; i++) {
		st = &sha_tests[i];
		if (!sha_hash_from_algorithm(st->algorithm, &label, &sha_func,
		    &md, &out_len))
			goto failed;

		/* Digest */
		memset(out, 0, sizeof(out));
		sha_func(st->in, st->in_len, out);
		if (memcmp(st->out, out, out_len) != 0) {
			fprintf(stderr, "FAIL (%s): mismatch\n", label);
			goto failed;
		}

		/* EVP single-shot digest */
		memset(out, 0, sizeof(out));
		if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) {
			fprintf(stderr, "FAIL (%s): EVP_Digest failed\n",
			    label);
			goto failed;
		}

		if (memcmp(st->out, out, out_len) != 0) {
			fprintf(stderr, "FAIL (%s): EVP single-shot mismatch\n",
			    label);
			goto failed;
		}

		/* EVP digest */
		memset(out, 0, sizeof(out));
		if (!EVP_DigestInit_ex(hash, md, NULL)) {
			fprintf(stderr, "FAIL (%s): EVP_DigestInit_ex failed\n",
			    label);
			goto failed;
		}

		in_len = st->in_len / 2;
		if (!EVP_DigestUpdate(hash, st->in, in_len)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestUpdate first half failed\n",
			    label);
			goto failed;
		}

		if (!EVP_DigestUpdate(hash, st->in + in_len,
		    st->in_len - in_len)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestUpdate second half failed\n",
			    label);
			goto failed;
		}

		if (!EVP_DigestFinal_ex(hash, out, NULL)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestFinal_ex failed\n",
			    label);
			goto failed;
		}

		if (memcmp(st->out, out, out_len) != 0) {
			fprintf(stderr, "FAIL (%s): EVP mismatch\n", label);
			goto failed;
		}
	}

	failed = 0;

 failed:
	EVP_MD_CTX_free(hash);
	return failed;
}

static int
sha_repetition_test(void)
{
	const struct sha_repetition_test *st;
	EVP_MD_CTX *hash = NULL;
	const EVP_MD *md;
	uint8_t buf[1024];
	uint8_t out[EVP_MAX_MD_SIZE];
	size_t out_len, part_len;
	size_t i, j;
	const char *label;
	int failed = 1;

	if ((hash = EVP_MD_CTX_new()) == NULL) {
		fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n");
		goto failed;
	}

	for (i = 0; i < N_SHA_REPETITION_TESTS; i++) {
		st = &sha_repetition_tests[i];
		if (!sha_hash_from_algorithm(st->algorithm, &label, NULL, &md,
		    &out_len))
			goto failed;

		/* EVP digest */
		if (!EVP_DigestInit_ex(hash, md, NULL)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestInit_ex failed\n",
			    label);
			goto failed;
		}

		memset(buf, st->in, sizeof(buf));

		for (j = 0; j < st->in_repetitions;) {
			part_len = arc4random_uniform(sizeof(buf));
			if (part_len > st->in_repetitions - j)
				part_len = st->in_repetitions - j;

			if (!EVP_DigestUpdate(hash, buf, part_len)) {
				fprintf(stderr,
				    "FAIL (%s): EVP_DigestUpdate failed\n",
				    label);
				goto failed;
			}

			j += part_len;
		}

		if (!EVP_DigestFinal_ex(hash, out, NULL)) {
			fprintf(stderr,
			    "FAIL (%s): EVP_DigestFinal_ex failed\n",
			    label);
			goto failed;
		}

		if (memcmp(st->out, out, out_len) != 0) {
			fprintf(stderr, "FAIL (%s): EVP mismatch\n", label);
			goto failed;
		}
	}

	failed = 0;

 failed:
	EVP_MD_CTX_free(hash);
	return failed;
}

int
main(int argc, char **argv)
{
	int failed = 0;

	failed |= sha_test();
	failed |= sha_repetition_test();

	return failed;
}
Added jni/libressl/tests/ssl_set_alpn_protos.c.
























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*	$OpenBSD: ssl_set_alpn_protos.c,v 1.2 2022/07/21 03:59:04 tb Exp $ */
/*
 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <err.h>
#include <stdio.h>

#include <openssl/ssl.h>

struct alpn_test {
	const char *description;
	const uint8_t protocols[24];
	size_t protocols_len;
	int ret;
};

static const struct alpn_test alpn_tests[] = {
	{
		.description = "valid protocol list",
		.protocols = {
			6, 's', 'p', 'd', 'y', '/', '1',
			8, 'h', 't', 't', 'p', '/', '1', '.', '1',
		},
		.protocols_len = 16,
		.ret = 0,
	},
	{
		.description = "zero length protocol",
		.protocols = {
			0,
		},
		.protocols_len = 1,
		.ret = 1,
	},
	{
		.description = "zero length protocol at start",
		.protocols = {
			0,
			8, 'h', 't', 't', 'p', '/', '1', '.', '1',
			6, 's', 'p', 'd', 'y', '/', '1',
		},
		.protocols_len = 17,
		.ret = 1,
	},
	{
		.description = "zero length protocol embedded",
		.protocols = {
			8, 'h', 't', 't', 'p', '/', '1', '.', '1',
			0,
			6, 's', 'p', 'd', 'y', '/', '1',
		},
		.protocols_len = 17,
		.ret = 1,
	},
	{
		.description = "zero length protocol at end",
		.protocols = {
			8, 'h', 't', 't', 'p', '/', '1', '.', '1',
			6, 's', 'p', 'd', 'y', '/', '1',
			0,
		},
		.protocols_len = 17,
		.ret = 1,
	},
	{
		.description = "protocol length too short",
		.protocols = {
			6, 'h', 't', 't', 'p', '/', '1', '.', '1',
		},
		.protocols_len = 9,
		.ret = 1,
	},
	{
		.description = "protocol length too long",
		.protocols = {
			8, 's', 'p', 'd', 'y', '/', '1',
		},
		.protocols_len = 7,
		.ret = 1,
	},
};

static const size_t N_ALPN_TESTS = sizeof(alpn_tests) / sizeof(alpn_tests[0]);

static int
test_ssl_set_alpn_protos(const struct alpn_test *tc)
{
	SSL_CTX *ctx;
	SSL *ssl;
	int ret;
	int failed = 0;

	if ((ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "SSL_CTX_new");

	ret = SSL_CTX_set_alpn_protos(ctx, tc->protocols, tc->protocols_len);
	if (ret != tc->ret) {
		warnx("%s: setting on SSL_CTX: want %d, got %d",
		    tc->description, tc->ret, ret);
		failed = 1;
	}

	if ((ssl = SSL_new(ctx)) == NULL)
		errx(1, "SSL_new");

	ret = SSL_set_alpn_protos(ssl, tc->protocols, tc->protocols_len);
	if (ret != tc->ret) {
		warnx("%s: setting on SSL: want %d, got %d",
		    tc->description, tc->ret, ret);
		failed = 1;
	}

	SSL_CTX_free(ctx);
	SSL_free(ssl);

	return failed;
}

static int
test_ssl_set_alpn_protos_edge_cases(void)
{
	SSL_CTX *ctx;
	SSL *ssl;
	const uint8_t valid[] = {
		6, 's', 'p', 'd', 'y', '/', '3',
		8, 'h', 't', 't', 'p', '/', '1', '.', '1',
	};
	int failed = 0;

	if ((ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "SSL_CTX_new");

	if (SSL_CTX_set_alpn_protos(ctx, valid, sizeof(valid)) != 0) {
		warnx("setting valid protocols on SSL_CTX failed");
		failed = 1;
	}
	if (SSL_CTX_set_alpn_protos(ctx, NULL, 0) != 0) {
		warnx("setting 'NULL, 0' on SSL_CTX failed");
		failed = 1;
	}
	if (SSL_CTX_set_alpn_protos(ctx, valid, 0) != 0) {
		warnx("setting 'valid, 0' on SSL_CTX failed");
		failed = 1;
	}
	if (SSL_CTX_set_alpn_protos(ctx, NULL, 43) != 0) {
		warnx("setting 'NULL, 43' on SSL_CTX failed");
		failed = 1;
	}

	if ((ssl = SSL_new(ctx)) == NULL)
		errx(1, "SSL_new");

	if (SSL_set_alpn_protos(ssl, valid, sizeof(valid)) != 0) {
		warnx("setting valid protocols on SSL failed");
		failed = 1;
	}
	if (SSL_set_alpn_protos(ssl, NULL, 0) != 0) {
		warnx("setting 'NULL, 0' on SSL failed");
		failed = 1;
	}
	if (SSL_set_alpn_protos(ssl, valid, 0) != 0) {
		warnx("setting 'valid, 0' on SSL failed");
		failed = 1;
	}
	if (SSL_set_alpn_protos(ssl, NULL, 43) != 0) {
		warnx("setting 'NULL, 43' on SSL failed");
		failed = 1;
	}

	SSL_CTX_free(ctx);
	SSL_free(ssl);

	return failed;
}

int
main(void)
{
	size_t i;
	int failed = 0;

	for (i = 0; i < N_ALPN_TESTS; i++)
		failed |= test_ssl_set_alpn_protos(&alpn_tests[i]);

	failed |= test_ssl_set_alpn_protos_edge_cases();

	if (!failed)
		printf("PASS %s\n", __FILE__);

	return failed;
}
Changes to jni/libressl/tests/ssltest.bat.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@echo off
setlocal enabledelayedexpansion
REM	ssltest.bat

set ssltest_bin=%1
set ssltest_bin=%ssltest_bin:/=\%
if not exist %ssltest_bin% exit /b 1

set openssl_bin=%2
set openssl_bin=%openssl_bin:/=\%
if not exist %openssl_bin% exit /b 1

%srcdir%\testssl.bat %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem ^
    %ssltest_bin% %openssl_bin%
if !errorlevel! neq 0 (
	exit /b 1
)

endlocal












|
|





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@echo off
setlocal enabledelayedexpansion
REM	ssltest.bat

set ssltest_bin=%1
set ssltest_bin=%ssltest_bin:/=\%
if not exist %ssltest_bin% exit /b 1

set openssl_bin=%2
set openssl_bin=%openssl_bin:/=\%
if not exist %openssl_bin% exit /b 1

%srcdir%\testssl.bat %srcdir%\server1-rsa.pem %srcdir%\server1-rsa-chain.pem ^
	%srcdir%\ca-root-rsa.pem %ssltest_bin% %openssl_bin%
if !errorlevel! neq 0 (
	exit /b 1
)

endlocal
Changes to jni/libressl/tests/ssltest.c.
1
2
3
4
5
6
7
8
/*	$OpenBSD: ssltest.c,v 1.33 2021/11/21 21:40:45 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
|







1
2
3
4
5
6
7
8
/*	$OpenBSD: ssltest.c,v 1.35 2022/07/07 13:10:22 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
430
431
432
433
434
435
436

437
438
439
440
441
442
443
	char *client_key = NULL;
	char *named_curve = NULL;
	SSL_CTX *s_ctx = NULL;
	SSL_CTX *c_ctx = NULL;
	const SSL_METHOD *meth = NULL;
	SSL *c_ssl, *s_ssl;
	int number = 1, reuse = 0;

	long bytes = 256L;
	DH *dh;
	int dhe1024dsa = 0;
	EC_KEY *ecdh = NULL;
	int no_dhe = 0;
	int no_ecdhe = 0;
	int print_time = 0;







>







430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
	char *client_key = NULL;
	char *named_curve = NULL;
	SSL_CTX *s_ctx = NULL;
	SSL_CTX *c_ctx = NULL;
	const SSL_METHOD *meth = NULL;
	SSL *c_ssl, *s_ssl;
	int number = 1, reuse = 0;
	int seclevel = 0;
	long bytes = 256L;
	DH *dh;
	int dhe1024dsa = 0;
	EC_KEY *ecdh = NULL;
	int no_dhe = 0;
	int no_ecdhe = 0;
	int print_time = 0;
490
491
492
493
494
495
496




497
498
499
500
501
502
503
			tls1_2 = 1;
		else if (strncmp(*argv, "-num", 4) == 0) {
			if (--argc < 1)
				goto bad;
			number = atoi(*(++argv));
			if (number == 0)
				number = 1;




		} else if (strcmp(*argv, "-bytes") == 0) {
			if (--argc < 1)
				goto bad;
			bytes = atol(*(++argv));
			if (bytes == 0L)
				bytes = 1L;
			i = strlen(argv[0]);







>
>
>
>







491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
			tls1_2 = 1;
		else if (strncmp(*argv, "-num", 4) == 0) {
			if (--argc < 1)
				goto bad;
			number = atoi(*(++argv));
			if (number == 0)
				number = 1;
		} else if (strncmp(*argv, "-seclevel", 9) == 0) {
			if (--argc < 1)
				goto bad;
			seclevel = atoi(*(++argv));
		} else if (strcmp(*argv, "-bytes") == 0) {
			if (--argc < 1)
				goto bad;
			bytes = atol(*(++argv));
			if (bytes == 0L)
				bytes = 1L;
			i = strlen(argv[0]);
616
617
618
619
620
621
622



623
624
625
626
627
628
629
	c_ctx = SSL_CTX_new(meth);
	s_ctx = SSL_CTX_new(meth);
	if ((c_ctx == NULL) || (s_ctx == NULL)) {
		ERR_print_errors(bio_err);
		goto end;
	}




	if (cipher != NULL) {
		SSL_CTX_set_cipher_list(c_ctx, cipher);
		SSL_CTX_set_cipher_list(s_ctx, cipher);
	}

	if (!no_dhe) {
		if (dhe1024dsa) {







>
>
>







621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
	c_ctx = SSL_CTX_new(meth);
	s_ctx = SSL_CTX_new(meth);
	if ((c_ctx == NULL) || (s_ctx == NULL)) {
		ERR_print_errors(bio_err);
		goto end;
	}

	SSL_CTX_set_security_level(c_ctx, seclevel);
	SSL_CTX_set_security_level(s_ctx, seclevel);

	if (cipher != NULL) {
		SSL_CTX_set_cipher_list(c_ctx, cipher);
		SSL_CTX_set_cipher_list(s_ctx, cipher);
	}

	if (!no_dhe) {
		if (dhe1024dsa) {
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
		}

		SSL_CTX_set_tmp_ecdh(s_ctx, ecdh);
		SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE);
		EC_KEY_free(ecdh);
	}

	if (!SSL_CTX_use_certificate_file(s_ctx, server_cert,
	    SSL_FILETYPE_PEM)) {
		ERR_print_errors(bio_err);
	} else if (!SSL_CTX_use_PrivateKey_file(s_ctx,
	    (server_key ? server_key : server_cert), SSL_FILETYPE_PEM)) {
		ERR_print_errors(bio_err);
		goto end;
	}

	if (client_auth) {
		SSL_CTX_use_certificate_file(c_ctx, client_cert,
		    SSL_FILETYPE_PEM);
		SSL_CTX_use_PrivateKey_file(c_ctx,
		    (client_key ? client_key : client_cert),
		    SSL_FILETYPE_PEM);
	}

	if ((!SSL_CTX_load_verify_locations(s_ctx, CAfile, CApath)) ||
	    (!SSL_CTX_set_default_verify_paths(s_ctx)) ||







|
<








|
<







663
664
665
666
667
668
669
670

671
672
673
674
675
676
677
678
679

680
681
682
683
684
685
686
		}

		SSL_CTX_set_tmp_ecdh(s_ctx, ecdh);
		SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE);
		EC_KEY_free(ecdh);
	}

	if (!SSL_CTX_use_certificate_chain_file(s_ctx, server_cert)) {

		ERR_print_errors(bio_err);
	} else if (!SSL_CTX_use_PrivateKey_file(s_ctx,
	    (server_key ? server_key : server_cert), SSL_FILETYPE_PEM)) {
		ERR_print_errors(bio_err);
		goto end;
	}

	if (client_auth) {
		SSL_CTX_use_certificate_chain_file(c_ctx, client_cert);

		SSL_CTX_use_PrivateKey_file(c_ctx,
		    (client_key ? client_key : client_cert),
		    SSL_FILETYPE_PEM);
	}

	if ((!SSL_CTX_load_verify_locations(s_ctx, CAfile, CApath)) ||
	    (!SSL_CTX_set_default_verify_paths(s_ctx)) ||
Changes to jni/libressl/tests/ssltest.sh.
18
19
20
21
22
23
24
25

26
	fi
fi

if [ -z $srcdir ]; then
	srcdir=.
fi

$srcdir/testssl $srcdir/server.pem $srcdir/server.pem $srcdir/ca.pem \

	$ssltest_bin $openssl_bin







|
>

18
19
20
21
22
23
24
25
26
27
	fi
fi

if [ -z $srcdir ]; then
	srcdir=.
fi

$srcdir/testssl $srcdir/server1-rsa.pem $srcdir/server1-rsa-chain.pem \
	$srcdir/ca-root-rsa.pem \
	$ssltest_bin $openssl_bin
Changes to jni/libressl/tests/testssl.
62
63
64
65
66
67
68
69












70
71
72
73
74
75
76
77
78
79
80
81
82
    if [ $? -ne 0 ] ; then
      echo "Failed $cipher"
      exit 1
    fi
  done
done
for protocol in TLSv1.3; do
  echo "Testing ciphersuites for $protocol"












  for cipher in `$openssl ciphers -v "$protocol" |
    awk "/ $protocol / { print \\$1 }"`; do
    echo "Testing $cipher"
    $ssltest -cipher $cipher
    if [ $? -ne 0 ] ; then
      echo "Failed $cipher"
      exit 1
    fi
  done
done

#############################################################################








|
>
>
>
>
>
>
>
>
>
>
>
>



|
|
|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    if [ $? -ne 0 ] ; then
      echo "Failed $cipher"
      exit 1
    fi
  done
done
for protocol in TLSv1.3; do
  echo "Testing ciphersuites for $protocol at security level 2"
  for cipher in `$openssl ciphers -v "$protocol" |
    awk "/ $protocol / { print \\$1 }"`; do
    echo "Testing $cipher"
    $ssltest -cipher $cipher -seclevel 2
    if [ $? -ne 0 ] ; then
      echo "Failed $cipher"
      exit 1
    fi
  done
done
for protocol in TLSv1.3; do
  echo "Testing ciphersuites for $protocol at security level 3"
  for cipher in `$openssl ciphers -v "$protocol" |
    awk "/ $protocol / { print \\$1 }"`; do
    echo "Testing $cipher"
    $ssltest -cipher $cipher -seclevel 3
    if [ $? -eq 0 ] ; then
      echo "Failed $cipher should not have succeeded"
      exit 1
    fi
  done
done

#############################################################################

Changes to jni/libressl/tests/tls_prf.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tls_prf.c,v 1.6 2022/02/06 09:19:46 anton Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tls_prf.c,v 1.7 2022/06/10 22:00:15 tb Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
	unsigned char *out = NULL;
	const SSL_CIPHER *cipher;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	int failure = 1;
	int len;

	fprintf(stderr, "Test %i - %s\n", test_no, tpt->desc);

	if ((out = malloc(TLS_PRF_OUT_LEN)) == NULL)
		errx(1, "failed to allocate out");

	if ((ssl_ctx = SSL_CTX_new(tpt->ssl_method())) == NULL)
		errx(1, "failed to create SSL context");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)







|







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
	unsigned char *out = NULL;
	const SSL_CIPHER *cipher;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	int failure = 1;
	int len;

	fprintf(stderr, "Test %d - %s\n", test_no, tpt->desc);

	if ((out = malloc(TLS_PRF_OUT_LEN)) == NULL)
		errx(1, "failed to allocate out");

	if ((ssl_ctx = SSL_CTX_new(tpt->ssl_method())) == NULL)
		errx(1, "failed to create SSL context");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
		memset(out, 'A', TLS_PRF_OUT_LEN);

		if (tls1_PRF(ssl, TLS_PRF_SECRET, sizeof(TLS_PRF_SECRET),
		    TLS_PRF_SEED1, sizeof(TLS_PRF_SEED1), TLS_PRF_SEED2,
		    sizeof(TLS_PRF_SEED2), TLS_PRF_SEED3, sizeof(TLS_PRF_SEED3),
		    TLS_PRF_SEED4, sizeof(TLS_PRF_SEED4), TLS_PRF_SEED5,
		    sizeof(TLS_PRF_SEED5), out, len) != 1) {
			fprintf(stderr, "FAIL: tls_PRF failed for len %i\n",
			    len);
			goto failure;
		}

		if (memcmp(out, tpt->out, len) != 0) {
			fprintf(stderr, "FAIL: tls_PRF output differs for "
			    "len %i\n", len);
			fprintf(stderr, "output:\n");
			hexdump(out, TLS_PRF_OUT_LEN);
			fprintf(stderr, "test data:\n");
			hexdump(tpt->out, TLS_PRF_OUT_LEN);
			fprintf(stderr, "\n");
			goto failure;
		}







|






|







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
		memset(out, 'A', TLS_PRF_OUT_LEN);

		if (tls1_PRF(ssl, TLS_PRF_SECRET, sizeof(TLS_PRF_SECRET),
		    TLS_PRF_SEED1, sizeof(TLS_PRF_SEED1), TLS_PRF_SEED2,
		    sizeof(TLS_PRF_SEED2), TLS_PRF_SEED3, sizeof(TLS_PRF_SEED3),
		    TLS_PRF_SEED4, sizeof(TLS_PRF_SEED4), TLS_PRF_SEED5,
		    sizeof(TLS_PRF_SEED5), out, len) != 1) {
			fprintf(stderr, "FAIL: tls_PRF failed for len %d\n",
			    len);
			goto failure;
		}

		if (memcmp(out, tpt->out, len) != 0) {
			fprintf(stderr, "FAIL: tls_PRF output differs for "
			    "len %d\n", len);
			fprintf(stderr, "output:\n");
			hexdump(out, TLS_PRF_OUT_LEN);
			fprintf(stderr, "test data:\n");
			hexdump(tpt->out, TLS_PRF_OUT_LEN);
			fprintf(stderr, "\n");
			goto failure;
		}
Changes to jni/libressl/tests/tlsexttest.c.
1
2
3
4
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21


22
23
24
25





























26
27
28
29
30
31
32
/* $OpenBSD: tlsexttest.c,v 1.60 2022/02/08 19:00:36 tb Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>

 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <err.h>



#include "ssl_locl.h"

#include "bytestring.h"
#include "ssl_tlsext.h"






























static void
hexdump(const unsigned char *buf, size_t len)
{
	size_t i;

	for (i = 1; i <= len; i++)
|




>
















>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* $OpenBSD: tlsexttest.c,v 1.75 2022/08/21 19:46:19 jsing Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <err.h>

#include <openssl/tls1.h>

#include "ssl_locl.h"

#include "bytestring.h"
#include "ssl_tlsext.h"

struct tls_extension_funcs {
	int (*needs)(SSL *s, uint16_t msg_type);
	int (*build)(SSL *s, uint16_t msg_type, CBB *cbb);
	int (*parse)(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
};

const struct tls_extension *tls_extension_find(uint16_t, size_t *);
const struct tls_extension_funcs *tlsext_funcs(const struct tls_extension *,
    int);

static int
tls_extension_funcs(int type, const struct tls_extension_funcs **client_funcs,
    const struct tls_extension_funcs **server_funcs)
{
	const struct tls_extension *ext;
	size_t idx;

	if ((ext = tls_extension_find(type, &idx)) == NULL)
		return 0;

	if ((*client_funcs = tlsext_funcs(ext, 0)) == NULL)
		return 0;

	if ((*server_funcs = tlsext_funcs(ext, 1)) == NULL)
		return 0;

	return 1;
}

static void
hexdump(const unsigned char *buf, size_t len)
{
	size_t i;

	for (i = 1; i <= len; i++)
115
116
117
118
119
120
121


122
123
124
125
126


127
128
129
130
131
132
133
134

135
136
137
138
139
140
141



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
	/* ProtocolName protocol_name_list<2..2^16-1> -- ALPN names */
	0x00, 0x09, /* len of all names */
	/* opaque ProtocolName<1..2^8-1> -- 'http/1.1' */
	0x08, /* len */
	0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31
};



static int
test_tlsext_alpn_client(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	CBB_init(&cbb, 0);


	failure = 1;

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");




	/* By default, we don't need this */
	if (tlsext_alpn_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need ALPN by default\n");
		goto err;
	}

	/*
	 * Prereqs:
	 * 1) Set s->internal->alpn_client_proto_list
	 *    - Using SSL_set_alpn_protos()
	 * 2) We have not finished or renegotiated.
	 *    - s->s3->tmp.finish_md_len == 0
	 */
	if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val,
	    sizeof(tlsext_alpn_single_proto_val)) != 0) {
		FAIL("should be able to set ALPN to http/1.1\n");
		goto err;
	}
	if (!tlsext_alpn_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ALPN by now\n");
		goto err;
	}

	/* Make sure we can build the client with a single proto. */

	if (!tlsext_alpn_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ALPN\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_alpn_single_proto)) {







>
>





>
>






|

>
|






>
>
>

|
















|
|





|







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
	/* ProtocolName protocol_name_list<2..2^16-1> -- ALPN names */
	0x00, 0x09, /* len of all names */
	/* opaque ProtocolName<1..2^8-1> -- 'http/1.1' */
	0x08, /* len */
	0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31
};

#define TLSEXT_TYPE_alpn TLSEXT_TYPE_application_layer_protocol_negotiation

static int
test_tlsext_alpn_client(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_alpn, &client_funcs, &server_funcs))
		errx(1, "failed to fetch ALPN funcs");

	/* By default, we don't need this */
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need ALPN by default\n");
		goto err;
	}

	/*
	 * Prereqs:
	 * 1) Set s->internal->alpn_client_proto_list
	 *    - Using SSL_set_alpn_protos()
	 * 2) We have not finished or renegotiated.
	 *    - s->s3->tmp.finish_md_len == 0
	 */
	if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val,
	    sizeof(tlsext_alpn_single_proto_val)) != 0) {
		FAIL("should be able to set ALPN to http/1.1\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ALPN by default\n");
		goto err;
	}

	/* Make sure we can build the client with a single proto. */

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ALPN\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_alpn_single_proto)) {
183
184
185
186
187
188
189
190

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
		FAIL("client ALPN differs:\n");
		compare_data(data, dlen, tlsext_alpn_single_proto,
		    sizeof(tlsext_alpn_single_proto));
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	/* Make sure we can parse the single proto. */

	CBS_init(&cbs, tlsext_alpn_single_proto,
	    sizeof(tlsext_alpn_single_proto));
	if (!tlsext_alpn_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse ALPN\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>







|







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
		FAIL("client ALPN differs:\n");
		compare_data(data, dlen, tlsext_alpn_single_proto,
		    sizeof(tlsext_alpn_single_proto));
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	/* Make sure we can parse the single proto. */

	CBS_init(&cbs, tlsext_alpn_single_proto,
	    sizeof(tlsext_alpn_single_proto));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse ALPN\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
	/* Make sure we can build the clienthello with multiple entries. */

	if (SSL_set_alpn_protos(ssl, tlsext_alpn_multiple_protos_val,
	    sizeof(tlsext_alpn_multiple_protos_val)) != 0) {
		FAIL("should be able to set ALPN to http/1.1\n");
		goto err;
	}
	if (!tlsext_alpn_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ALPN by now\n");
		goto err;
	}

	if (!tlsext_alpn_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ALPN\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_alpn_multiple_protos)) {







|




|







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
	/* Make sure we can build the clienthello with multiple entries. */

	if (SSL_set_alpn_protos(ssl, tlsext_alpn_multiple_protos_val,
	    sizeof(tlsext_alpn_multiple_protos_val)) != 0) {
		FAIL("should be able to set ALPN to http/1.1\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ALPN by now\n");
		goto err;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ALPN\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_alpn_multiple_protos)) {
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
		goto err;
	}

	/* Make sure we can parse multiple protos */

	CBS_init(&cbs, tlsext_alpn_multiple_protos,
	    sizeof(tlsext_alpn_multiple_protos));
	if (!tlsext_alpn_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse ALPN\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|







299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
		goto err;
	}

	/* Make sure we can parse multiple protos */

	CBS_init(&cbs, tlsext_alpn_multiple_protos,
	    sizeof(tlsext_alpn_multiple_protos));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse ALPN\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320


321
322
323
324
325
326
327
328

329
330
331
332
333
334
335



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

	/* Make sure we can remove the list and avoid ALPN */

	free(ssl->internal->alpn_client_proto_list);
	ssl->internal->alpn_client_proto_list = NULL;
	ssl->internal->alpn_client_proto_list_len = 0;

	if (tlsext_alpn_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ALPN by default\n");
		goto err;
	}

	failure = 0;

 err:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

static int
test_tlsext_alpn_server(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	CBB_init(&cbb, 0);


	failure = 1;

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");




	/* By default, ALPN isn't needed. */
	if (tlsext_alpn_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need ALPN by default\n");
		goto err;
	}

	/*
	 * The server has a single ALPN selection which is set by
	 * SSL_CTX_set_alpn_select_cb() and calls SSL_select_next_proto().
	 *
	 * This will be a plain name and separate length.
	 */
	if ((ssl->s3->alpn_selected = malloc(sizeof(tlsext_alpn_single_proto_name))) == NULL) {
		errx(1, "failed to malloc");
	}
	memcpy(ssl->s3->alpn_selected, tlsext_alpn_single_proto_name,
	    sizeof(tlsext_alpn_single_proto_name));
	ssl->s3->alpn_selected_len = sizeof(tlsext_alpn_single_proto_name);

	if (!tlsext_alpn_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ALPN after a protocol is selected\n");
		goto err;
	}

	/* Make sure we can build a server with one protocol */

	if (!tlsext_alpn_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should be able to build a response\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_alpn_single_proto)) {







|




















>
>






|

>
|






>
>
>

|

















|






|







334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416

	/* Make sure we can remove the list and avoid ALPN */

	free(ssl->internal->alpn_client_proto_list);
	ssl->internal->alpn_client_proto_list = NULL;
	ssl->internal->alpn_client_proto_list_len = 0;

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ALPN by default\n");
		goto err;
	}

	failure = 0;

 err:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

static int
test_tlsext_alpn_server(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_alpn, &client_funcs, &server_funcs))
		errx(1, "failed to fetch ALPN funcs");

	/* By default, ALPN isn't needed. */
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need ALPN by default\n");
		goto err;
	}

	/*
	 * The server has a single ALPN selection which is set by
	 * SSL_CTX_set_alpn_select_cb() and calls SSL_select_next_proto().
	 *
	 * This will be a plain name and separate length.
	 */
	if ((ssl->s3->alpn_selected = malloc(sizeof(tlsext_alpn_single_proto_name))) == NULL) {
		errx(1, "failed to malloc");
	}
	memcpy(ssl->s3->alpn_selected, tlsext_alpn_single_proto_name,
	    sizeof(tlsext_alpn_single_proto_name));
	ssl->s3->alpn_selected_len = sizeof(tlsext_alpn_single_proto_name);

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ALPN after a protocol is selected\n");
		goto err;
	}

	/* Make sure we can build a server with one protocol */

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should be able to build a response\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_alpn_single_proto)) {
378
379
380
381
382
383
384
385

386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
		FAIL("client ALPN differs:\n");
		compare_data(data, dlen, tlsext_alpn_single_proto,
		    sizeof(tlsext_alpn_single_proto));
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	/* Make sure we can parse the single proto. */

	CBS_init(&cbs, tlsext_alpn_single_proto,
	    sizeof(tlsext_alpn_single_proto));

	/* Shouldn't be able to parse without requesting */
	if (tlsext_alpn_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("Should only parse server if we requested it\n");
		goto err;
	}

	/* Should be able to parse once requested. */
	if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val,
	    sizeof(tlsext_alpn_single_proto_val)) != 0) {
		FAIL("should be able to set ALPN to http/1.1\n");
		goto err;
	}
	if (!tlsext_alpn_server_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("Should be able to parse server when we request it\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>









|










|







425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
		FAIL("client ALPN differs:\n");
		compare_data(data, dlen, tlsext_alpn_single_proto,
		    sizeof(tlsext_alpn_single_proto));
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	/* Make sure we can parse the single proto. */

	CBS_init(&cbs, tlsext_alpn_single_proto,
	    sizeof(tlsext_alpn_single_proto));

	/* Shouldn't be able to parse without requesting */
	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("Should only parse server if we requested it\n");
		goto err;
	}

	/* Should be able to parse once requested. */
	if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val,
	    sizeof(tlsext_alpn_single_proto_val)) != 0) {
		FAIL("should be able to set ALPN to http/1.1\n");
		goto err;
	}
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("Should be able to parse server when we request it\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457

	/* Make sure we can remove the list and avoid ALPN */

	free(ssl->s3->alpn_selected);
	ssl->s3->alpn_selected = NULL;
	ssl->s3->alpn_selected_len = 0;

	if (tlsext_alpn_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ALPN by default\n");
		goto err;
	}

	failure = 0;

 err:
	CBB_cleanup(&cbb);







|
|







490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505

	/* Make sure we can remove the list and avoid ALPN */

	free(ssl->s3->alpn_selected);
	ssl->s3->alpn_selected = NULL;
	ssl->s3->alpn_selected_len = 0;

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need ALPN by default\n");
		goto err;
	}

	failure = 0;

 err:
	CBB_cleanup(&cbb);
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504


505
506
507
508
509
510
511
512
513
514
515
516
517
518
519




520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563

564

565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
	0x00, 0x1d,  /* X25519 (29) */
	0x00, 0x17,  /* secp256r1 (23) */
	0x00, 0x18,  /* secp384r1 (24) */
	0x00, 0x19,  /* secp521r1 (25) */
};

static uint16_t tlsext_supportedgroups_client_secp384r1_val[] = {
	0x0018   /* tls1_ec_nid2curve_id(NID_secp384r1) */
};
static uint8_t tlsext_supportedgroups_client_secp384r1[] = {
	0x00, 0x02,
	0x00, 0x18  /* secp384r1 (24) */
};

/* Example from RFC 4492 section 5.1.1 */
static uint16_t tlsext_supportedgroups_client_nistp192and224_val[] = {
	0x0013,  /* tls1_ec_nid2curve_id(NID_X9_62_prime192v1) */
	0x0015   /* tls1_ec_nid2curve_id(NID_secp224r1) */
};
static uint8_t tlsext_supportedgroups_client_nistp192and224[] = {
	0x00, 0x04,
	0x00, 0x13, /* secp192r1 aka NIST P-192 */
	0x00, 0x15  /* secp224r1 aka NIST P-224 */
};

static int
test_tlsext_supportedgroups_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	size_t dlen;
	int failure, alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	/*
	 * Default ciphers include EC so we need it by default.
	 */
	if (!tlsext_supportedgroups_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves for default "
		    "ciphers\n");
		goto err;
	}

	/*
	 * Exclude cipher suites so we can test not including it.
	 */
	if (!SSL_set_cipher_list(ssl, "TLSv1.2:!ECDHE:!ECDSA")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (tlsext_supportedgroups_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need Ellipticcurves\n");
		goto err;
	}

	/*
	 * Use libtls default for the rest of the testing
	 */
	if (!SSL_set_cipher_list(ssl, "TLSv1.2+AEAD+ECDHE")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (!tlsext_supportedgroups_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves\n");
		goto err;
	}

	/*
	 * Test with a session secp384r1.  The default is used instead.
	 */
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if ((ssl->session->tlsext_supportedgroups = malloc(sizeof(uint16_t)))
	    == NULL) {
		FAIL("client could not malloc\n");
		goto err;
	}

	ssl->session->tlsext_supportedgroups[0] = tls1_ec_nid2curve_id(NID_secp384r1);

	ssl->session->tlsext_supportedgroups_length = 1;

	if (!tlsext_supportedgroups_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves\n");
		goto err;
	}

	if (!tlsext_supportedgroups_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build Ellipticcurves\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








|








|
|













>
>















>
>
>
>



|












|











|















>
|
>


|




|







522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
	0x00, 0x1d,  /* X25519 (29) */
	0x00, 0x17,  /* secp256r1 (23) */
	0x00, 0x18,  /* secp384r1 (24) */
	0x00, 0x19,  /* secp521r1 (25) */
};

static uint16_t tlsext_supportedgroups_client_secp384r1_val[] = {
	0x0018   /* tls1_ec_nid2group_id(NID_secp384r1) */
};
static uint8_t tlsext_supportedgroups_client_secp384r1[] = {
	0x00, 0x02,
	0x00, 0x18  /* secp384r1 (24) */
};

/* Example from RFC 4492 section 5.1.1 */
static uint16_t tlsext_supportedgroups_client_nistp192and224_val[] = {
	0x0013,  /* tls1_ec_nid2group_id(NID_X9_62_prime192v1) */
	0x0015   /* tls1_ec_nid2group_id(NID_secp224r1) */
};
static uint8_t tlsext_supportedgroups_client_nistp192and224[] = {
	0x00, 0x04,
	0x00, 0x13, /* secp192r1 aka NIST P-192 */
	0x00, 0x15  /* secp224r1 aka NIST P-224 */
};

static int
test_tlsext_supportedgroups_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	size_t dlen;
	int failure, alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_supported_groups, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch supported groups funcs");

	/*
	 * Default ciphers include EC so we need it by default.
	 */
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves for default "
		    "ciphers\n");
		goto err;
	}

	/*
	 * Exclude cipher suites so we can test not including it.
	 */
	if (!SSL_set_cipher_list(ssl, "TLSv1.2:!ECDHE:!ECDSA")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need Ellipticcurves\n");
		goto err;
	}

	/*
	 * Use libtls default for the rest of the testing
	 */
	if (!SSL_set_cipher_list(ssl, "TLSv1.2+AEAD+ECDHE")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves\n");
		goto err;
	}

	/*
	 * Test with a session secp384r1.  The default is used instead.
	 */
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if ((ssl->session->tlsext_supportedgroups = malloc(sizeof(uint16_t)))
	    == NULL) {
		FAIL("client could not malloc\n");
		goto err;
	}
	if (!tls1_ec_nid2group_id(NID_secp384r1,
	    &ssl->session->tlsext_supportedgroups[0]))
		goto err;
	ssl->session->tlsext_supportedgroups_length = 1;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves\n");
		goto err;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build Ellipticcurves\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

593
594
595
596
597
598
599
600

601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
		goto err;
	}

	/*
	 * Test parsing secp384r1
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	CBS_init(&cbs, tlsext_supportedgroups_client_secp384r1,
	    sizeof(tlsext_supportedgroups_client_secp384r1));
	if (!tlsext_supportedgroups_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client Ellipticcurves\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>









|







649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
		goto err;
	}

	/*
	 * Test parsing secp384r1
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	CBS_init(&cbs, tlsext_supportedgroups_client_secp384r1,
	    sizeof(tlsext_supportedgroups_client_secp384r1));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client Ellipticcurves\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
635
636
637
638
639
640
641
642

643
644
645
646
647
648
649
650
651

652


653

654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
		goto err;
	}

	/*
	 * Use a custom order.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);


	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if ((ssl->internal->tlsext_supportedgroups = malloc(sizeof(uint16_t) * 2)) == NULL) {
		FAIL("client could not malloc\n");
		goto err;
	}

	ssl->internal->tlsext_supportedgroups[0] = tls1_ec_nid2curve_id(NID_X9_62_prime192v1);


	ssl->internal->tlsext_supportedgroups[1] = tls1_ec_nid2curve_id(NID_secp224r1);

	ssl->internal->tlsext_supportedgroups_length = 2;

	if (!tlsext_supportedgroups_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves\n");
		goto err;
	}

	if (!tlsext_supportedgroups_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build Ellipticcurves\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








|
>









>
|
>
>
|
>


|




|







692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
		goto err;
	}

	/*
	 * Use a custom order.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if ((ssl->internal->tlsext_supportedgroups = malloc(sizeof(uint16_t) * 2)) == NULL) {
		FAIL("client could not malloc\n");
		goto err;
	}
	if (!tls1_ec_nid2group_id(NID_X9_62_prime192v1,
	    &ssl->internal->tlsext_supportedgroups[0]))
		goto err;
	if (!tls1_ec_nid2group_id(NID_secp224r1,
	    &ssl->internal->tlsext_supportedgroups[1]))
		goto err;
	ssl->internal->tlsext_supportedgroups_length = 2;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Ellipticcurves\n");
		goto err;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build Ellipticcurves\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

688
689
690
691
692
693
694
695

696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
		goto err;
	}

	/*
	 * Parse non-default curves to session.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Reset back to the default list. */
	free(ssl->internal->tlsext_supportedgroups);
	ssl->internal->tlsext_supportedgroups = NULL;
	ssl->internal->tlsext_supportedgroups_length = 0;

	CBS_init(&cbs, tlsext_supportedgroups_client_nistp192and224,
	    sizeof(tlsext_supportedgroups_client_nistp192and224));
	if (!tlsext_supportedgroups_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client Ellipticcurves\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>














|







750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
		goto err;
	}

	/*
	 * Parse non-default curves to session.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Reset back to the default list. */
	free(ssl->internal->tlsext_supportedgroups);
	ssl->internal->tlsext_supportedgroups = NULL;
	ssl->internal->tlsext_supportedgroups_length = 0;

	CBS_init(&cbs, tlsext_supportedgroups_client_nistp192and224,
	    sizeof(tlsext_supportedgroups_client_nistp192and224));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client Ellipticcurves\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
747
748
749
750
751
752
753


754
755
756
757
758
759
760
761
762




763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778

/* elliptic_curves is only used by the client so this doesn't test much. */
static int
test_tlsext_supportedgroups_server(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure;

	failure = 1;

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if (tlsext_supportedgroups_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need elliptic_curves\n");
		goto err;
	}

	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if (tlsext_supportedgroups_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need elliptic_curves\n");
		goto err;
	}

	failure = 0;

 err:







>
>









>
>
>
>
|







|







810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847

/* elliptic_curves is only used by the client so this doesn't test much. */
static int
test_tlsext_supportedgroups_server(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;

	failure = 1;

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_supported_groups, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch supported groups funcs");

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need elliptic_curves\n");
		goto err;
	}

	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need elliptic_curves\n");
		goto err;
	}

	failure = 0;

 err:
817
818
819
820
821
822
823


824
825
826
827
828
829
830
831

832
833
834
835
836




837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884

static int
test_tlsext_ecpf_client(void)
{
	uint8_t *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	size_t dlen;
	int failure, alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	/*
	 * Default ciphers include EC so we need it by default.
	 */
	if (!tlsext_ecpf_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ECPointFormats for default "
		    "ciphers\n");
		goto err;
	}

	/*
	 * Exclude EC cipher suites so we can test not including it.
	 */
	if (!SSL_set_cipher_list(ssl, "ALL:!ECDHE:!ECDH")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (tlsext_ecpf_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need ECPointFormats\n");
		goto err;
	}

	/*
	 * Use libtls default for the rest of the testing
	 */
	if (!SSL_set_cipher_list(ssl, "TLSv1.2+AEAD+ECDHE")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (!tlsext_ecpf_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ECPointFormats\n");
		goto err;
	}

	/*
	 * The default ECPointFormats should only have uncompressed
	 */
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if (!tlsext_ecpf_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








>
>







|
>





>
>
>
>




|












|











|










|







886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960

static int
test_tlsext_ecpf_client(void)
{
	uint8_t *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	size_t dlen;
	int failure, alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_ec_point_formats, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch ecpf funcs");

	/*
	 * Default ciphers include EC so we need it by default.
	 */
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ECPointFormats for default "
		    "ciphers\n");
		goto err;
	}

	/*
	 * Exclude EC cipher suites so we can test not including it.
	 */
	if (!SSL_set_cipher_list(ssl, "ALL:!ECDHE:!ECDH")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need ECPointFormats\n");
		goto err;
	}

	/*
	 * Use libtls default for the rest of the testing
	 */
	if (!SSL_set_cipher_list(ssl, "TLSv1.2+AEAD+ECDHE")) {
		FAIL("client should be able to set cipher list\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ECPointFormats\n");
		goto err;
	}

	/*
	 * The default ECPointFormats should only have uncompressed
	 */
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

898
899
900
901
902
903
904
905

906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
		goto err;
	}

	/*
	 * Make sure we can parse the default.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	CBS_init(&cbs, tlsext_ecpf_hello_uncompressed,
	    sizeof(tlsext_ecpf_hello_uncompressed));
	if (!tlsext_ecpf_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>









|







974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
		goto err;
	}

	/*
	 * Make sure we can parse the default.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	CBS_init(&cbs, tlsext_ecpf_hello_uncompressed,
	    sizeof(tlsext_ecpf_hello_uncompressed));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
935
936
937
938
939
940
941
942

943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
		goto err;
	}

	/*
	 * Test with a custom order.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if ((ssl->internal->tlsext_ecpointformatlist = malloc(sizeof(uint8_t) * 3)) == NULL) {
		FAIL("client could not malloc\n");
		goto err;
	}
	ssl->internal->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	ssl->internal->tlsext_ecpointformatlist[1] = TLSEXT_ECPOINTFORMAT_uncompressed;
	ssl->internal->tlsext_ecpointformatlist[2] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2;
	ssl->internal->tlsext_ecpointformatlist_length = 3;

	if (!tlsext_ecpf_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ECPointFormats with a custom "
		    "format\n");
		goto err;
	}

	if (!tlsext_ecpf_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








|
>
















|





|







1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
		goto err;
	}

	/*
	 * Test with a custom order.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if ((ssl->internal->tlsext_ecpointformatlist = malloc(sizeof(uint8_t) * 3)) == NULL) {
		FAIL("client could not malloc\n");
		goto err;
	}
	ssl->internal->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	ssl->internal->tlsext_ecpointformatlist[1] = TLSEXT_ECPOINTFORMAT_uncompressed;
	ssl->internal->tlsext_ecpointformatlist[2] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2;
	ssl->internal->tlsext_ecpointformatlist_length = 3;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ECPointFormats with a custom "
		    "format\n");
		goto err;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

986
987
988
989
990
991
992
993

994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
		goto err;
	}

	/*
	 * Make sure that we can parse this custom order.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Reset the custom list so we go back to the default uncompressed. */
	free(ssl->internal->tlsext_ecpointformatlist);
	ssl->internal->tlsext_ecpointformatlist = NULL;
	ssl->internal->tlsext_ecpointformatlist_length = 0;

	CBS_init(&cbs, tlsext_ecpf_hello_prefer_order,
	    sizeof(tlsext_ecpf_hello_prefer_order));
	if (!tlsext_ecpf_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>














|







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
		goto err;
	}

	/*
	 * Make sure that we can parse this custom order.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Reset the custom list so we go back to the default uncompressed. */
	free(ssl->internal->tlsext_ecpointformatlist);
	ssl->internal->tlsext_ecpointformatlist = NULL;
	ssl->internal->tlsext_ecpointformatlist_length = 0;

	CBS_init(&cbs, tlsext_ecpf_hello_prefer_order,
	    sizeof(tlsext_ecpf_hello_prefer_order));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
1042
1043
1044
1045
1046
1047
1048


1049
1050
1051
1052
1053
1054
1055
1056

1057
1058
1059
1060
1061




1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097

static int
test_tlsext_ecpf_server(void)
{
	uint8_t *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	size_t dlen;
	int failure, alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Setup the state so we can call needs. */
	if ((ssl->s3->hs.cipher =
	    ssl3_get_cipher_by_id(TLS1_CK_ECDHE_ECDSA_CHACHA20_POLY1305))
	    == NULL) {
		FAIL("server cannot find cipher\n");
		goto err;
	}
	if ((ssl->session->tlsext_ecpointformatlist = malloc(sizeof(uint8_t)))
	    == NULL) {
		FAIL("server could not malloc\n");
		goto err;
	}
	ssl->session->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	ssl->session->tlsext_ecpointformatlist_length = 1;

	if (!tlsext_ecpf_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ECPointFormats now\n");
		goto err;
	}

	/*
	 * The server will ignore the session list and use either a custom
	 * list or the default (uncompressed).
	 */
	if (!tlsext_ecpf_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








>
>







|
>





>
>
>
>



















|








|







1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183

static int
test_tlsext_ecpf_server(void)
{
	uint8_t *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	size_t dlen;
	int failure, alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_ec_point_formats, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch ecpf funcs");

	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Setup the state so we can call needs. */
	if ((ssl->s3->hs.cipher =
	    ssl3_get_cipher_by_id(TLS1_CK_ECDHE_ECDSA_CHACHA20_POLY1305))
	    == NULL) {
		FAIL("server cannot find cipher\n");
		goto err;
	}
	if ((ssl->session->tlsext_ecpointformatlist = malloc(sizeof(uint8_t)))
	    == NULL) {
		FAIL("server could not malloc\n");
		goto err;
	}
	ssl->session->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	ssl->session->tlsext_ecpointformatlist_length = 1;

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ECPointFormats now\n");
		goto err;
	}

	/*
	 * The server will ignore the session list and use either a custom
	 * list or the default (uncompressed).
	 */
	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

1111
1112
1113
1114
1115
1116
1117
1118

1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141

1142
1143
1144
1145
1146
1147
1148
		goto err;
	}

	/*
	 * Cannot parse a non-default list without at least uncompressed.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	CBS_init(&cbs, tlsext_ecpf_hello_prime,
	    sizeof(tlsext_ecpf_hello_prime));
	if (tlsext_ecpf_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("must include uncompressed in server ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	/*
	 * Test with a custom order that replaces the default uncompressed.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");








|
>









|












|
>







1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
		goto err;
	}

	/*
	 * Cannot parse a non-default list without at least uncompressed.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	CBS_init(&cbs, tlsext_ecpf_hello_prime,
	    sizeof(tlsext_ecpf_hello_prime));
	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("must include uncompressed in server ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	/*
	 * Test with a custom order that replaces the default uncompressed.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
		goto err;
	}
	ssl->internal->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	ssl->internal->tlsext_ecpointformatlist[1] = TLSEXT_ECPOINTFORMAT_uncompressed;
	ssl->internal->tlsext_ecpointformatlist[2] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2;
	ssl->internal->tlsext_ecpointformatlist_length = 3;

	if (!tlsext_ecpf_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ECPointFormats\n");
		goto err;
	}

	if (!tlsext_ecpf_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








|




|







1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
		goto err;
	}
	ssl->internal->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
	ssl->internal->tlsext_ecpointformatlist[1] = TLSEXT_ECPOINTFORMAT_uncompressed;
	ssl->internal->tlsext_ecpointformatlist[2] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2;
	ssl->internal->tlsext_ecpointformatlist_length = 3;

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ECPointFormats\n");
		goto err;
	}

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build ECPointFormats\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

1194
1195
1196
1197
1198
1199
1200
1201

1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
		goto err;
	}

	/*
	 * Should be able to parse the custom list into a session list.
	 */
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Reset back to the default (uncompressed) */
	free(ssl->internal->tlsext_ecpointformatlist);
	ssl->internal->tlsext_ecpointformatlist = NULL;
	ssl->internal->tlsext_ecpointformatlist_length = 0;

	CBS_init(&cbs, tlsext_ecpf_hello_prefer_order,
	    sizeof(tlsext_ecpf_hello_prefer_order));
	if (!tlsext_ecpf_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>














|







1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
		goto err;
	}

	/*
	 * Should be able to parse the custom list into a session list.
	 */
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	/* Reset back to the default (uncompressed) */
	free(ssl->internal->tlsext_ecpointformatlist);
	ssl->internal->tlsext_ecpointformatlist = NULL;
	ssl->internal->tlsext_ecpointformatlist_length = 0;

	CBS_init(&cbs, tlsext_ecpf_hello_prefer_order,
	    sizeof(tlsext_ecpf_hello_prefer_order));
	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server ECPointFormats\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
1277
1278
1279
1280
1281
1282
1283


1284
1285
1286
1287
1288
1289
1290
1291
1292

1293
1294
1295
1296
1297
1298




1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327

static int
test_tlsext_ri_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLSv1_2_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if (tlsext_ri_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need RI\n");
		goto err;
	}

	if (!SSL_renegotiate(ssl)) {
		FAIL("client failed to set renegotiate\n");
		goto err;
	}

	if (!tlsext_ri_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need RI\n");
		goto err;
	}

	memcpy(ssl->s3->previous_client_finished, tlsext_ri_prev_client,
	    sizeof(tlsext_ri_prev_client));
	ssl->s3->previous_client_finished_len = sizeof(tlsext_ri_prev_client);

	ssl->s3->renegotiate_seen = 0;

	if (!tlsext_ri_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build RI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








>
>








|
>






>
>
>
>
|









|










|







1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423

static int
test_tlsext_ri_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLSv1_2_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_renegotiate, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch ri funcs");

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need RI\n");
		goto err;
	}

	if (!SSL_renegotiate(ssl)) {
		FAIL("client failed to set renegotiate\n");
		goto err;
	}

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need RI\n");
		goto err;
	}

	memcpy(ssl->s3->previous_client_finished, tlsext_ri_prev_client,
	    sizeof(tlsext_ri_prev_client));
	ssl->s3->previous_client_finished_len = sizeof(tlsext_ri_prev_client);

	ssl->s3->renegotiate_seen = 0;

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build RI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_ri_client, sizeof(tlsext_ri_client));
		goto err;
	}

	CBS_init(&cbs, tlsext_ri_client, sizeof(tlsext_ri_client));
	if (!tlsext_ri_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client RI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|







1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_ri_client, sizeof(tlsext_ri_client));
		goto err;
	}

	CBS_init(&cbs, tlsext_ri_client, sizeof(tlsext_ri_client));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client RI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377

	memset(ssl->s3->previous_client_finished, 0,
	    sizeof(ssl->s3->previous_client_finished));

	ssl->s3->renegotiate_seen = 0;

	CBS_init(&cbs, tlsext_ri_client, sizeof(tlsext_ri_client));
	if (tlsext_ri_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("parsed invalid client RI\n");
		failure = 1;
		goto err;
	}

	if (ssl->s3->renegotiate_seen == 1) {
		FAIL("renegotiate seen set\n");
		goto err;
	}







|

<







1457
1458
1459
1460
1461
1462
1463
1464
1465

1466
1467
1468
1469
1470
1471
1472

	memset(ssl->s3->previous_client_finished, 0,
	    sizeof(ssl->s3->previous_client_finished));

	ssl->s3->renegotiate_seen = 0;

	CBS_init(&cbs, tlsext_ri_client, sizeof(tlsext_ri_client));
	if (server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("parsed invalid client RI\n");

		goto err;
	}

	if (ssl->s3->renegotiate_seen == 1) {
		FAIL("renegotiate seen set\n");
		goto err;
	}
1389
1390
1391
1392
1393
1394
1395


1396
1397
1398
1399
1400
1401
1402
1403
1404

1405
1406
1407
1408
1409
1410




1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441

static int
test_tlsext_ri_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	ssl->version = TLS1_2_VERSION;
	if (tlsext_ri_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need RI\n");
		goto err;
	}

	ssl->s3->send_connection_binding = 1;

	if (!tlsext_ri_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need RI\n");
		goto err;
	}

	memcpy(ssl->s3->previous_client_finished, tlsext_ri_prev_client,
	    sizeof(tlsext_ri_prev_client));
	ssl->s3->previous_client_finished_len = sizeof(tlsext_ri_prev_client);

	memcpy(ssl->s3->previous_server_finished, tlsext_ri_prev_server,
	    sizeof(tlsext_ri_prev_server));
	ssl->s3->previous_server_finished_len = sizeof(tlsext_ri_prev_server);

	ssl->s3->renegotiate_seen = 0;

	if (!tlsext_ri_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build RI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








>
>








|
>






>
>
>
>

|






|














|







1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543

static int
test_tlsext_ri_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_renegotiate, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch ri funcs");

	ssl->version = TLS1_2_VERSION;
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need RI\n");
		goto err;
	}

	ssl->s3->send_connection_binding = 1;

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need RI\n");
		goto err;
	}

	memcpy(ssl->s3->previous_client_finished, tlsext_ri_prev_client,
	    sizeof(tlsext_ri_prev_client));
	ssl->s3->previous_client_finished_len = sizeof(tlsext_ri_prev_client);

	memcpy(ssl->s3->previous_server_finished, tlsext_ri_prev_server,
	    sizeof(tlsext_ri_prev_server));
	ssl->s3->previous_server_finished_len = sizeof(tlsext_ri_prev_server);

	ssl->s3->renegotiate_seen = 0;

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build RI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_ri_server, sizeof(tlsext_ri_server));
		goto err;
	}

	CBS_init(&cbs, tlsext_ri_server, sizeof(tlsext_ri_server));
	if (!tlsext_ri_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server RI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|







1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_ri_server, sizeof(tlsext_ri_server));
		goto err;
	}

	CBS_init(&cbs, tlsext_ri_server, sizeof(tlsext_ri_server));
	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server RI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
	    sizeof(ssl->s3->previous_client_finished));
	memset(ssl->s3->previous_server_finished, 0,
	    sizeof(ssl->s3->previous_server_finished));

	ssl->s3->renegotiate_seen = 0;

	CBS_init(&cbs, tlsext_ri_server, sizeof(tlsext_ri_server));
	if (tlsext_ri_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("parsed invalid server RI\n");
		goto err;
	}

	if (ssl->s3->renegotiate_seen == 1) {
		FAIL("renegotiate seen set\n");
		goto err;







|







1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
	    sizeof(ssl->s3->previous_client_finished));
	memset(ssl->s3->previous_server_finished, 0,
	    sizeof(ssl->s3->previous_server_finished));

	ssl->s3->renegotiate_seen = 0;

	CBS_init(&cbs, tlsext_ri_server, sizeof(tlsext_ri_server));
	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("parsed invalid server RI\n");
		goto err;
	}

	if (ssl->s3->renegotiate_seen == 1) {
		FAIL("renegotiate seen set\n");
		goto err;
1514
1515
1516
1517
1518
1519
1520


1521
1522
1523
1524
1525
1526


1527

1528
1529
1530
1531
1532




1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585


1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602


1603
1604
1605
1606
1607
1608


1609

1610
1611
1612
1613
1614
1615




1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636


1637
1638
1639
1640
1641
1642
1643

static int
test_tlsext_sigalgs_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure = 0;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;



	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION;

	if (tlsext_sigalgs_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		fprintf(stderr, "FAIL: client should not need sigalgs\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;

	if (!tlsext_sigalgs_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		fprintf(stderr, "FAIL: client should need sigalgs\n");
		failure = 1;
		goto done;
	}

	if (!tlsext_sigalgs_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		fprintf(stderr, "FAIL: client failed to build sigalgs\n");
		failure = 1;
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_sigalgs_client)) {
		fprintf(stderr, "FAIL: got client sigalgs with length %zu, "
		    "want length %zu\n", dlen, sizeof(tlsext_sigalgs_client));
		failure = 1;
		goto done;
	}

	if (memcmp(data, tlsext_sigalgs_client, dlen) != 0) {
		fprintf(stderr, "FAIL: client SNI differs:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client));
		failure = 1;
		goto done;
	}

	CBS_init(&cbs, tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client));
	if (!tlsext_sigalgs_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		fprintf(stderr, "FAIL: failed to parse client SNI\n");
		failure = 1;
		goto done;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto done;
	}



 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

#if 0
static int
test_tlsext_sigalgs_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure = 0;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;



	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if (tlsext_sigalgs_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		fprintf(stderr, "FAIL: server should not need sigalgs\n");
		failure = 1;
		goto done;
	}

	if (tlsext_sigalgs_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		fprintf(stderr, "FAIL: server should not build sigalgs\n");
		failure = 1;
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	CBS_init(&cbs, tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client));
	if (tlsext_sigalgs_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		fprintf(stderr, "FAIL: server should not parse sigalgs\n");
		failure = 1;
		goto done;
	}



 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);








>
>
|





>
>
|
>





>
>
>
>



|
|
<





|
|
<



|
|
<







|

<




|




<




|
|
<






>
>

















>
>
|





>
>
|
>






>
>
>
>
|
|
<



|
|
<







|
|
<


>
>







1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648

1649
1650
1651
1652
1653
1654
1655

1656
1657
1658
1659
1660

1661
1662
1663
1664
1665
1666
1667
1668
1669

1670
1671
1672
1673
1674
1675
1676
1677
1678

1679
1680
1681
1682
1683
1684

1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733

1734
1735
1736
1737
1738

1739
1740
1741
1742
1743
1744
1745
1746
1747

1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758

static int
test_tlsext_sigalgs_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_signature_algorithms,
	    &client_funcs, &server_funcs))
		errx(1, "failed to fetch sigalgs funcs");

	ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION;

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need sigalgs\n");

		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need sigalgs\n");

		goto done;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build sigalgs\n");

		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_sigalgs_client)) {
		FAIL("got client sigalgs length %zu, "
		    "want length %zu\n", dlen, sizeof(tlsext_sigalgs_client));

		goto done;
	}

	if (memcmp(data, tlsext_sigalgs_client, dlen) != 0) {
		FAIL("client SNI differs:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client));

		goto done;
	}

	CBS_init(&cbs, tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client SNI\n");

		goto done;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto done;
	}

	failure = 0;

 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

#if 0
static int
test_tlsext_sigalgs_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_server_name, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch sigalgs funcs");

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need sigalgs\n");

		goto done;
	}

	if (server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should not build sigalgs\n");

		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	CBS_init(&cbs, tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client));
	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("server should not parse sigalgs\n");

		goto done;
	}

	failure = 0;

 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

1664
1665
1666
1667
1668
1669
1670


1671
1672
1673
1674
1675
1676
1677
1678


1679
1680
1681
1682
1683
1684
1685


1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709

static int
test_tlsext_sni_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;




	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	CBB_init(&cbb, 0);



	if (tlsext_sni_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SNI\n");
		goto err;
	}

	if (!SSL_set_tlsext_host_name(ssl, TEST_SNI_SERVERNAME)) {
		FAIL("client failed to set server name\n");
		goto err;
	}

	if (!tlsext_sni_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SNI\n");
		goto err;
	}

	if (!tlsext_sni_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SNI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB");
		goto err;







>
>








>
>






|
>
>

|









|




|







1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830

static int
test_tlsext_sni_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_server_name, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch sni funcs");

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SNI\n");
		goto err;
	}

	if (!SSL_set_tlsext_host_name(ssl, TEST_SNI_SERVERNAME)) {
		FAIL("client failed to set server name\n");
		goto err;
	}

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SNI\n");
		goto err;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SNI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB");
		goto err;
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
	 * disable SNI.
	 */
	if (!SSL_set_tlsext_host_name(ssl, NULL)) {
		FAIL("cannot set host name to NULL");
		goto err;
	}

	if (tlsext_sni_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SNI\n");
		goto err;
	}

	if ((ssl->session = SSL_SESSION_new()) == NULL) {
		FAIL("failed to create session");
		goto err;
	}

	ssl->internal->hit = 0;

	CBS_init(&cbs, tlsext_sni_client, sizeof(tlsext_sni_client));
	if (!tlsext_sni_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client SNI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|












|







1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
	 * disable SNI.
	 */
	if (!SSL_set_tlsext_host_name(ssl, NULL)) {
		FAIL("cannot set host name to NULL");
		goto err;
	}

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SNI\n");
		goto err;
	}

	if ((ssl->session = SSL_SESSION_new()) == NULL) {
		FAIL("failed to create session");
		goto err;
	}

	ssl->internal->hit = 0;

	CBS_init(&cbs, tlsext_sni_client, sizeof(tlsext_sni_client));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client SNI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
	if ((ssl->session->tlsext_hostname = strdup("notthesame.libressl.org")) ==
	    NULL) {
		FAIL("failed to strdup tlsext_hostname");
		goto err;
	}

	CBS_init(&cbs, tlsext_sni_client, sizeof(tlsext_sni_client));
	if (tlsext_sni_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("parsed client with mismatched SNI\n");
		goto err;
	}

	failure = 0;

 err:







|







1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
	if ((ssl->session->tlsext_hostname = strdup("notthesame.libressl.org")) ==
	    NULL) {
		FAIL("failed to strdup tlsext_hostname");
		goto err;
	}

	CBS_init(&cbs, tlsext_sni_client, sizeof(tlsext_sni_client));
	if (server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("parsed client with mismatched SNI\n");
		goto err;
	}

	failure = 0;

 err:
1796
1797
1798
1799
1800
1801
1802


1803
1804
1805
1806
1807
1808
1809
1810
1811

1812
1813
1814
1815
1816




1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847

static int
test_tlsext_sni_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if (tlsext_sni_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SNI\n");
		goto err;
	}

	if (!SSL_set_tlsext_host_name(ssl, TEST_SNI_SERVERNAME)) {
		FAIL("client failed to set server name\n");
		goto err;
	}

	if ((ssl->session->tlsext_hostname = strdup(TEST_SNI_SERVERNAME)) ==
	    NULL)
		errx(1, "failed to strdup tlsext_hostname");

	if (!tlsext_sni_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need SNI\n");
		goto err;
	}

	if (!tlsext_sni_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build SNI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");








>
>








|
>





>
>
>
>




|













|




|







1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975

static int
test_tlsext_sni_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_server_name, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch sni funcs");

	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SNI\n");
		goto err;
	}

	if (!SSL_set_tlsext_host_name(ssl, TEST_SNI_SERVERNAME)) {
		FAIL("client failed to set server name\n");
		goto err;
	}

	if ((ssl->session->tlsext_hostname = strdup(TEST_SNI_SERVERNAME)) ==
	    NULL)
		errx(1, "failed to strdup tlsext_hostname");

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need SNI\n");
		goto err;
	}

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build SNI\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
		goto err;
	}

	free(ssl->session->tlsext_hostname);
	ssl->session->tlsext_hostname = NULL;

	CBS_init(&cbs, tlsext_sni_server, sizeof_tlsext_sni_server);
	if (!tlsext_sni_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server SNI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|







1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
		goto err;
	}

	free(ssl->session->tlsext_hostname);
	ssl->session->tlsext_hostname = NULL;

	CBS_init(&cbs, tlsext_sni_server, sizeof_tlsext_sni_server);
	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server SNI\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
1893
1894
1895
1896
1897
1898
1899

















































































































































































































































































1900
1901
1902
1903
1904
1905
1906
1907
1908
1909


1910
1911
1912
1913
1914
1915
1916
1917
1918

1919
1920
1921
1922
1923
1924




1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}


















































































































































































































































































static unsigned char tls_ocsp_client_default[] = {
	0x01, 0x00, 0x00, 0x00, 0x00
};

static int
test_tlsext_ocsp_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	size_t dlen;
	int failure;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if (tlsext_ocsp_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need ocsp\n");
		goto err;
	}
	SSL_set_tlsext_status_type(ssl, TLSEXT_STATUSTYPE_ocsp);

	if (!tlsext_ocsp_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need ocsp\n");
		goto err;
	}
	if (!tlsext_ocsp_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SNI\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tls_ocsp_client_default)) {
		FAIL("got ocsp client with length %zu, "
		    "want length %zu\n", dlen,
		    sizeof(tls_ocsp_client_default));
		goto err;
	}
	if (memcmp(data, tls_ocsp_client_default, dlen) != 0) {
		FAIL("ocsp client differs:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tls_ocsp_client_default,
		    sizeof(tls_ocsp_client_default));
		goto err;
	}
	CBS_init(&cbs, tls_ocsp_client_default,
	    sizeof(tls_ocsp_client_default));
	if (!tlsext_ocsp_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse ocsp client\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










>
>








|
>






>
>
>
>
|
|




|
|


|







|





|









|
|







2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}


/*
 * QUIC transport parameters extension - RFC 90210 :)
 */

#define TEST_QUIC_TRANSPORT_DATA "0123456789abcdef"

static unsigned char tlsext_quic_transport_data[] = {
	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
	0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
};

static int
test_tlsext_quic_transport_parameters_client(void)
{
	const SSL_QUIC_METHOD quic_method;
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	CBB cbb;
	CBS cbs;
	int alert;
	const uint8_t *out_bytes;
	size_t out_bytes_len;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_quic_transport_parameters,
	    &client_funcs, &server_funcs))
		errx(1, "failed to fetch quic transport parameter funcs");

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need QUIC\n");
		goto err;
	}

	if (!SSL_set_quic_transport_params(ssl,
	    TEST_QUIC_TRANSPORT_DATA, strlen(TEST_QUIC_TRANSPORT_DATA))) {
		FAIL("client failed to set QUIC parametes\n");
		goto err;
	}

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need QUIC\n");
		goto err;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	ssl->s3->hs.negotiated_tls_version = TLS1_3_VERSION;

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need QUIC\n");
		goto err;
	}

	ssl->quic_method = &quic_method;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need QUIC\n");
		goto err;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build QUIC\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB");
		goto err;
	}

	if (dlen != sizeof(tlsext_quic_transport_data)) {
		FAIL("got client QUIC with length %zu, "
		    "want length %zu\n", dlen,
		    sizeof(tlsext_quic_transport_data));
		goto err;
	}

	if (memcmp(data, tlsext_quic_transport_data, dlen) != 0) {
		FAIL("client QUIC differs:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_quic_transport_data,
		    sizeof(tlsext_quic_transport_data));
		goto err;
	}

	CBS_init(&cbs, tlsext_quic_transport_data,
	    sizeof(tlsext_quic_transport_data));

	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("server_parse of QUIC from server failed\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	SSL_get_peer_quic_transport_params(ssl, &out_bytes, &out_bytes_len);

	if (out_bytes_len != strlen(TEST_QUIC_TRANSPORT_DATA)) {
		FAIL("server_parse QUIC length differs, got %zu want %zu\n",
		    out_bytes_len,
		    sizeof(tlsext_quic_transport_data));
		goto err;
	}

	if (memcmp(out_bytes, TEST_QUIC_TRANSPORT_DATA,
	    out_bytes_len) != 0) {
		FAIL("server_parse QUIC differs from sent:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_quic_transport_data,
		    sizeof(tlsext_quic_transport_data));
		goto err;
	}

	failure = 0;

 err:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

static int
test_tlsext_quic_transport_parameters_server(void)
{
	const SSL_QUIC_METHOD quic_method;
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;
	const uint8_t *out_bytes;
	size_t out_bytes_len;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_quic_transport_parameters,
	    &client_funcs, &server_funcs))
		errx(1, "failed to fetch quic transport parameter funcs");

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need QUIC\n");
		goto err;
	}

	if (!SSL_set_quic_transport_params(ssl,
	    TEST_QUIC_TRANSPORT_DATA, strlen(TEST_QUIC_TRANSPORT_DATA))) {
		FAIL("server failed to set QUIC parametes\n");
		goto err;
	}

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_EE)) {
		FAIL("server should not need QUIC\n");
		goto err;
	}

	ssl->quic_method = &quic_method;

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_EE)) {
		FAIL("server should need QUIC\n");
		goto err;
	}

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_EE, &cbb)) {
		FAIL("server failed to build QUIC\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_quic_transport_data)) {
		FAIL("got server QUIC with length %zu, want length %zu\n",
		    dlen, sizeof(tlsext_quic_transport_data));
		goto err;
	}

	if (memcmp(data, tlsext_quic_transport_data, dlen) != 0) {
		FAIL("saved server QUIC differs:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_quic_transport_data,
		    sizeof(tlsext_quic_transport_data));
		goto err;
	}

	CBS_init(&cbs, tlsext_quic_transport_data,
	    sizeof(tlsext_quic_transport_data));

	ssl->quic_method = NULL;

	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_EE, &cbs, &alert)) {
		FAIL("QUIC parse should have failed!\n");
		goto err;
	}

	ssl->quic_method = &quic_method;

	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("client_parse of QUIC from server failed\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	SSL_get_peer_quic_transport_params(ssl, &out_bytes, &out_bytes_len);

	if (out_bytes_len != strlen(TEST_QUIC_TRANSPORT_DATA)) {
		FAIL("client QUIC length differs, got %zu want %zu\n",
		    out_bytes_len,
		    sizeof(tlsext_quic_transport_data));
		goto err;
	}

	if (memcmp(out_bytes, TEST_QUIC_TRANSPORT_DATA, out_bytes_len) != 0) {
		FAIL("client QUIC differs from sent:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tlsext_quic_transport_data,
		    sizeof(tlsext_quic_transport_data));
		goto err;
	}

	failure = 0;

 err:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

static unsigned char tls_ocsp_client_default[] = {
	0x01, 0x00, 0x00, 0x00, 0x00
};

static int
test_tlsext_ocsp_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	size_t dlen;
	int failure;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_status_request, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch ocsp funcs");

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need TLSEXT_TYPE_status_request\n");
		goto err;
	}
	SSL_set_tlsext_status_type(ssl, TLSEXT_STATUSTYPE_ocsp);

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need TLSEXT_TYPE_status_request\n");
		goto err;
	}
	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SNI\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tls_ocsp_client_default)) {
		FAIL("got TLSEXT_TYPE_status_request client with length %zu, "
		    "want length %zu\n", dlen,
		    sizeof(tls_ocsp_client_default));
		goto err;
	}
	if (memcmp(data, tls_ocsp_client_default, dlen) != 0) {
		FAIL("TLSEXT_TYPE_status_request client differs:\n");
		fprintf(stderr, "received:\n");
		hexdump(data, dlen);
		fprintf(stderr, "test data:\n");
		hexdump(tls_ocsp_client_default,
		    sizeof(tls_ocsp_client_default));
		goto err;
	}
	CBS_init(&cbs, tls_ocsp_client_default,
	    sizeof(tls_ocsp_client_default));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse TLSEXT_TYPE_status_request client\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

1978
1979
1980
1981
1982
1983
1984


1985
1986
1987
1988
1989
1990
1991

1992
1993
1994
1995
1996
1997




1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017

static int
test_tlsext_ocsp_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	size_t dlen;
	int failure;
	CBB cbb;

	failure = 1;

	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if (tlsext_ocsp_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need ocsp\n");
		goto err;
	}

	ssl->internal->tlsext_status_expected = 1;

	if (!tlsext_ocsp_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need ocsp\n");
		goto err;
	}
	if (!tlsext_ocsp_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build ocsp\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	failure = 0;







>
>






|
>






>
>
>
>
|
|





|
|


|
|







2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432

static int
test_tlsext_ocsp_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	size_t dlen;
	int failure;
	CBB cbb;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_status_request, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch ocsp funcs");

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need TLSEXT_TYPE_status_request\n");
		goto err;
	}

	ssl->internal->tlsext_status_expected = 1;

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need TLSEXT_TYPE_status_request\n");
		goto err;
	}
	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build TLSEXT_TYPE_status_request\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	failure = 0;
2037
2038
2039
2040
2041
2042
2043


2044
2045
2046
2047
2048
2049
2050
2051

2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063




2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092


























2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171

2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221

static int
test_tlsext_sessionticket_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure;
	CBB cbb;
	size_t dlen;
	uint8_t dummy[1234];

	failure = 1;

	CBB_init(&cbb, 0);


	/* Create fake session tickets with random data. */
	arc4random_buf(tlsext_sessionticket_hello_min,
	    sizeof(tlsext_sessionticket_hello_min));
	arc4random_buf(tlsext_sessionticket_hello_max,
	    sizeof(tlsext_sessionticket_hello_max));

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	/* Should need a ticket by default. */
	if (!tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Sessionticket for default "
		    "ciphers\n");
		goto err;
	}

	/* Test disabling tickets. */
	if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) {
		FAIL("Cannot disable tickets in the TLS connection\n");
		goto err;
	}
	if (tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SessionTicket if it was disabled\n");
		goto err;
	}

	/* Test re-enabling tickets. */
	if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) {
		FAIL("Cannot re-enable tickets in the TLS connection\n");
		goto err;
	}
	if (!tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SessionTicket if it was disabled\n");
		goto err;
	}

	/* Since we don't have a session, we should build an empty ticket. */
	if (!tlsext_sessionticket_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {


























		FAIL("Cannot build a ticket\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
	if (dlen != 0) {
		FAIL("Expected 0 length but found %zu\n", dlen);
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);
	free(data);
	data = NULL;

	/* With a new session (but no ticket), we should still have 0 length */
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");
	if (!tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should still want a session ticket with a new session\n");
		goto err;
	}
	if (!tlsext_sessionticket_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("Cannot build a ticket\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
	if (dlen != 0) {
		FAIL("Expected 0 length but found %zu\n", dlen);
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);
	free(data);
	data = NULL;

	/* With a new session (and ticket), we should use that ticket */
	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	arc4random_buf(&dummy, sizeof(dummy));
	if ((ssl->session->tlsext_tick = malloc(sizeof(dummy))) == NULL) {
		errx(1, "failed to malloc");
	}
	memcpy(ssl->session->tlsext_tick, dummy, sizeof(dummy));
	ssl->session->tlsext_ticklen = sizeof(dummy);

	if (!tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should still want a session ticket with a new session\n");
		goto err;
	}
	if (!tlsext_sessionticket_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("Cannot build a ticket\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
	if (dlen != sizeof(dummy)) {
		FAIL("Expected %zu length but found %zu\n", sizeof(dummy), dlen);
		goto err;
	}
	if (memcmp(data, dummy, dlen) != 0) {
		FAIL("server SNI differs:\n");
		compare_data(data, dlen,
		    dummy, sizeof(dummy));
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;
	free(ssl->session->tlsext_tick);
	ssl->session->tlsext_tick = NULL;
	ssl->session->tlsext_ticklen = 0;

	/*
	 * Send in NULL to disable session tickets at runtime without going
	 * through SSL_set_options().
	 */
	if (!SSL_set_session_ticket_ext(ssl, NULL, 0)) {
		FAIL("Could not set a NULL custom ticket\n");
		goto err;
	}
	/* Should not need a ticket in this case */
	if (tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should not want to use session tickets with a NULL custom\n");
		goto err;
	}

	/*
	 * If you want to remove the tlsext_session_ticket behavior, you have
	 * to do it manually.
	 */
	free(ssl->internal->tlsext_session_ticket);
	ssl->internal->tlsext_session_ticket = NULL;

	if (!tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should need a session ticket again when the custom one is removed\n");
		goto err;
	}

	/* Test a custom session ticket (not recommended in practice) */
	if (!SSL_set_session_ticket_ext(ssl, tlsext_sessionticket_hello_max,
	    sizeof(tlsext_sessionticket_hello_max))) {
		FAIL("Should be able to set a custom ticket\n");
		goto err;
	}
	if (!tlsext_sessionticket_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should need a session ticket again when the custom one is not empty\n");
		goto err;
	}
	if (!tlsext_sessionticket_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("Cannot build a ticket with a max length random payload\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}







>
>







|
>












>
>
>
>

|










|









|





|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













|
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<















|



|



















|
>















|











|










|



|







2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554





2555



















2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646

static int
test_tlsext_sessionticket_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	CBB cbb;
	size_t dlen;
	uint8_t dummy[1234];

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	/* Create fake session tickets with random data. */
	arc4random_buf(tlsext_sessionticket_hello_min,
	    sizeof(tlsext_sessionticket_hello_min));
	arc4random_buf(tlsext_sessionticket_hello_max,
	    sizeof(tlsext_sessionticket_hello_max));

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_session_ticket, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch session ticket funcs");

	/* Should need a ticket by default. */
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need Sessionticket for default "
		    "ciphers\n");
		goto err;
	}

	/* Test disabling tickets. */
	if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) {
		FAIL("Cannot disable tickets in the TLS connection\n");
		goto err;
	}
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SessionTicket if it was disabled\n");
		goto err;
	}

	/* Test re-enabling tickets. */
	if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) {
		FAIL("Cannot re-enable tickets in the TLS connection\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SessionTicket if it was disabled\n");
		goto err;
	}

	/* Since we don't have a session, we should build an empty ticket. */
	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("Cannot build a ticket\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
	if (dlen != 0) {
		FAIL("Expected 0 length but found %zu\n", dlen);
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	/* With a new session (but no ticket), we should still have 0 length */
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should still want a session ticket with a new session\n");
		goto err;
	}
	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("Cannot build a ticket\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
	if (dlen != 0) {
		FAIL("Expected 0 length but found %zu\n", dlen);
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))





		errx(1, "Failed to create CBB");



















	free(data);
	data = NULL;

	/* With a new session (and ticket), we should use that ticket */
	SSL_SESSION_free(ssl->session);
	if ((ssl->session = SSL_SESSION_new()) == NULL)
		errx(1, "failed to create session");

	arc4random_buf(&dummy, sizeof(dummy));
	if ((ssl->session->tlsext_tick = malloc(sizeof(dummy))) == NULL) {
		errx(1, "failed to malloc");
	}
	memcpy(ssl->session->tlsext_tick, dummy, sizeof(dummy));
	ssl->session->tlsext_ticklen = sizeof(dummy);

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should still want a session ticket with a new session\n");
		goto err;
	}
	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("Cannot build a ticket\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
	if (dlen != sizeof(dummy)) {
		FAIL("Expected %zu length but found %zu\n", sizeof(dummy), dlen);
		goto err;
	}
	if (memcmp(data, dummy, dlen) != 0) {
		FAIL("server SNI differs:\n");
		compare_data(data, dlen,
		    dummy, sizeof(dummy));
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;
	free(ssl->session->tlsext_tick);
	ssl->session->tlsext_tick = NULL;
	ssl->session->tlsext_ticklen = 0;

	/*
	 * Send in NULL to disable session tickets at runtime without going
	 * through SSL_set_options().
	 */
	if (!SSL_set_session_ticket_ext(ssl, NULL, 0)) {
		FAIL("Could not set a NULL custom ticket\n");
		goto err;
	}
	/* Should not need a ticket in this case */
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should not want to use session tickets with a NULL custom\n");
		goto err;
	}

	/*
	 * If you want to remove the tlsext_session_ticket behavior, you have
	 * to do it manually.
	 */
	free(ssl->internal->tlsext_session_ticket);
	ssl->internal->tlsext_session_ticket = NULL;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should need a session ticket again when the custom one is removed\n");
		goto err;
	}

	/* Test a custom session ticket (not recommended in practice) */
	if (!SSL_set_session_ticket_ext(ssl, tlsext_sessionticket_hello_max,
	    sizeof(tlsext_sessionticket_hello_max))) {
		FAIL("Should be able to set a custom ticket\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("Should need a session ticket again when the custom one is not empty\n");
		goto err;
	}
	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("Cannot build a ticket with a max length random payload\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
2246
2247
2248
2249
2250
2251
2252


2253
2254
2255
2256
2257
2258
2259

2260
2261
2262
2263
2264
2265
2266




2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311


static int
test_tlsext_sessionticket_server(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure;
	uint8_t *data = NULL;
	size_t dlen;
	CBB cbb;

	CBB_init(&cbb, 0);


	failure = 1;

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	/*
	 * By default, should not need a session ticket since the ticket
	 * is not yet expected.
	 */
	if (tlsext_sessionticket_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SessionTicket by default\n");
		goto err;
	}

	/* Test disabling tickets. */
	if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) {
		FAIL("Cannot disable tickets in the TLS connection\n");
		goto err;
	}
	if (tlsext_sessionticket_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SessionTicket if it was disabled\n");
		goto err;
	}

	/* Test re-enabling tickets. */
	if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) {
		FAIL("Cannot re-enable tickets in the TLS connection\n");
		goto err;
	}
	if (tlsext_sessionticket_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SessionTicket yet\n");
		goto err;
	}

	/* Set expected to require it. */
	ssl->internal->tlsext_ticket_expected = 1;
	if (!tlsext_sessionticket_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should now be required for SessionTicket\n");
		goto err;
	}

	/* server hello's session ticket should always be 0 length payload. */
	if (!tlsext_sessionticket_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("Cannot build a ticket with a max length random payload\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}







>
>





|

>
|






>
>
>
>




|









|









|






|





|







2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743


static int
test_tlsext_sessionticket_server(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	uint8_t *data = NULL;
	size_t dlen;
	CBB cbb;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_session_ticket, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch session ticket funcs");

	/*
	 * By default, should not need a session ticket since the ticket
	 * is not yet expected.
	 */
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SessionTicket by default\n");
		goto err;
	}

	/* Test disabling tickets. */
	if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) {
		FAIL("Cannot disable tickets in the TLS connection\n");
		goto err;
	}
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SessionTicket if it was disabled\n");
		goto err;
	}

	/* Test re-enabling tickets. */
	if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) {
		FAIL("Cannot re-enable tickets in the TLS connection\n");
		goto err;
	}
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SessionTicket yet\n");
		goto err;
	}

	/* Set expected to require it. */
	ssl->internal->tlsext_ticket_expected = 1;
	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should now be required for SessionTicket\n");
		goto err;
	}

	/* server hello's session ticket should always be 0 length payload. */
	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("Cannot build a ticket with a max length random payload\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("Cannot finish CBB\n");
		goto err;
	}
2377
2378
2379
2380
2381
2382
2383


2384
2385
2386
2387
2388
2389
2390
2391

2392
2393
2394
2395
2396
2397
2398
2399




2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424

static int
test_tlsext_srtp_client(void)
{
	SRTP_PROTECTION_PROFILE *prof;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	CBB_init(&cbb, 0);


	failure = 1;

	/* SRTP is for DTLS */
	if ((ssl_ctx = SSL_CTX_new(DTLSv1_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	/* By default, we don't need this */
	if (tlsext_srtp_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SRTP by default\n");
		goto err;
	}

	if (SSL_set_tlsext_use_srtp(ssl, tlsext_srtp_single_profile) != 0) {
		FAIL("should be able to set a single SRTP\n");
		goto err;
	}
	if (!tlsext_srtp_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SRTP\n");
		goto err;
	}

	/* Make sure we can build the client with a single profile. */

	if (!tlsext_srtp_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SRTP\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_srtp_single)) {







>
>






|

>
|







>
>
>
>

|








|






|







2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863

static int
test_tlsext_srtp_client(void)
{
	SRTP_PROTECTION_PROFILE *prof;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	/* SRTP is for DTLS */
	if ((ssl_ctx = SSL_CTX_new(DTLSv1_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_use_srtp, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch srtp funcs");

	/* By default, we don't need this */
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need SRTP by default\n");
		goto err;
	}

	if (SSL_set_tlsext_use_srtp(ssl, tlsext_srtp_single_profile) != 0) {
		FAIL("should be able to set a single SRTP\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SRTP\n");
		goto err;
	}

	/* Make sure we can build the client with a single profile. */

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SRTP\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_srtp_single)) {
2433
2434
2435
2436
2437
2438
2439
2440

2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
		FAIL("client SRTP differs:\n");
		compare_data(data, dlen, tlsext_srtp_single,
		    sizeof(tlsext_srtp_single));
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	/* Make sure we can parse the single profile. */

	if (SSL_get_selected_srtp_profile(ssl) != NULL) {
		FAIL("SRTP profile should not be set yet\n");
		goto err;
	}

	CBS_init(&cbs, tlsext_srtp_single, sizeof(tlsext_srtp_single));
	if (!tlsext_srtp_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if ((prof = SSL_get_selected_srtp_profile(ssl)) == NULL) {
		FAIL("SRTP profile should be set now\n");
		goto err;
	}
	if (strcmp(prof->name, tlsext_srtp_aes128cmsha80) != 0) {
		FAIL("SRTP profile was not set properly\n");
		goto err;
	}

	if (!tlsext_srtp_server_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should send server extension when profile selected\n");
		goto err;
	}

	/* Make sure we can build the clienthello with multiple entries. */

	if (SSL_set_tlsext_use_srtp(ssl, tlsext_srtp_multiple_profiles) != 0) {
		FAIL("should be able to set SRTP to multiple profiles\n");
		goto err;
	}
	if (!tlsext_srtp_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SRTP by now\n");
		goto err;
	}

	if (!tlsext_srtp_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SRTP\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_srtp_multiple)) {







|
>











|

















|










|




|







2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
		FAIL("client SRTP differs:\n");
		compare_data(data, dlen, tlsext_srtp_single,
		    sizeof(tlsext_srtp_single));
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	/* Make sure we can parse the single profile. */

	if (SSL_get_selected_srtp_profile(ssl) != NULL) {
		FAIL("SRTP profile should not be set yet\n");
		goto err;
	}

	CBS_init(&cbs, tlsext_srtp_single, sizeof(tlsext_srtp_single));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if ((prof = SSL_get_selected_srtp_profile(ssl)) == NULL) {
		FAIL("SRTP profile should be set now\n");
		goto err;
	}
	if (strcmp(prof->name, tlsext_srtp_aes128cmsha80) != 0) {
		FAIL("SRTP profile was not set properly\n");
		goto err;
	}

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should send server extension when profile selected\n");
		goto err;
	}

	/* Make sure we can build the clienthello with multiple entries. */

	if (SSL_set_tlsext_use_srtp(ssl, tlsext_srtp_multiple_profiles) != 0) {
		FAIL("should be able to set SRTP to multiple profiles\n");
		goto err;
	}
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need SRTP by now\n");
		goto err;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build SRTP\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_srtp_multiple)) {
2502
2503
2504
2505
2506
2507
2508
2509

2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
		FAIL("client SRTP differs:\n");
		compare_data(data, dlen, tlsext_srtp_multiple,
		    sizeof(tlsext_srtp_multiple));
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	/* Make sure we can parse multiple profiles (selects server preferred) */

	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple,
	    sizeof(tlsext_srtp_multiple));
	if (!tlsext_srtp_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if ((prof = SSL_get_selected_srtp_profile(ssl)) == NULL) {
		FAIL("SRTP profile should be set now\n");
		goto err;
	}
	if (strcmp(prof->name, tlsext_srtp_aes128cmsha80) != 0) {
		FAIL("SRTP profile was not set properly\n");
		goto err;
	}

	if (!tlsext_srtp_server_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should send server extension when profile selected\n");
		goto err;
	}

	/*
	 * Make sure we can parse the clienthello with multiple entries
	 * where one is unknown.
	 */
	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple_one_valid,
	    sizeof(tlsext_srtp_multiple_one_valid));
	if (!tlsext_srtp_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if ((prof = SSL_get_selected_srtp_profile(ssl)) == NULL) {
		FAIL("SRTP profile should be set now\n");
		goto err;
	}
	if (strcmp(prof->name, tlsext_srtp_aes128cmsha32) != 0) {
		FAIL("SRTP profile was not set properly\n");
		goto err;
	}

	if (!tlsext_srtp_server_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should send server extension when profile selected\n");
		goto err;
	}

	/* Make sure we fall back to negotiated when none work. */

	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple_invalid,
	    sizeof(tlsext_srtp_multiple_invalid));
	if (!tlsext_srtp_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("should be able to fall back to negotiated\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	/* If we fallback, the server should NOT send the extension. */
	if (SSL_get_selected_srtp_profile(ssl) != NULL) {
		FAIL("should not have selected a profile when none found\n");
		goto err;
	}
	if (tlsext_srtp_server_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should not send server tlsext when no profile found\n");
		goto err;
	}

	failure = 0;

 err:







|
>









|

















|












|

















|










|













|







2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
		FAIL("client SRTP differs:\n");
		compare_data(data, dlen, tlsext_srtp_multiple,
		    sizeof(tlsext_srtp_multiple));
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	/* Make sure we can parse multiple profiles (selects server preferred) */

	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple,
	    sizeof(tlsext_srtp_multiple));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if ((prof = SSL_get_selected_srtp_profile(ssl)) == NULL) {
		FAIL("SRTP profile should be set now\n");
		goto err;
	}
	if (strcmp(prof->name, tlsext_srtp_aes128cmsha80) != 0) {
		FAIL("SRTP profile was not set properly\n");
		goto err;
	}

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should send server extension when profile selected\n");
		goto err;
	}

	/*
	 * Make sure we can parse the clienthello with multiple entries
	 * where one is unknown.
	 */
	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple_one_valid,
	    sizeof(tlsext_srtp_multiple_one_valid));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if ((prof = SSL_get_selected_srtp_profile(ssl)) == NULL) {
		FAIL("SRTP profile should be set now\n");
		goto err;
	}
	if (strcmp(prof->name, tlsext_srtp_aes128cmsha32) != 0) {
		FAIL("SRTP profile was not set properly\n");
		goto err;
	}

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should send server extension when profile selected\n");
		goto err;
	}

	/* Make sure we fall back to negotiated when none work. */

	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple_invalid,
	    sizeof(tlsext_srtp_multiple_invalid));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("should be able to fall back to negotiated\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	/* If we fallback, the server should NOT send the extension. */
	if (SSL_get_selected_srtp_profile(ssl) != NULL) {
		FAIL("should not have selected a profile when none found\n");
		goto err;
	}
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("should not send server tlsext when no profile found\n");
		goto err;
	}

	failure = 0;

 err:
2608
2609
2610
2611
2612
2613
2614


2615
2616
2617
2618
2619
2620
2621
2622

2623
2624
2625
2626
2627
2628
2629
2630




2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657

static int
test_tlsext_srtp_server(void)
{
	const SRTP_PROTECTION_PROFILE *prof;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	CBB_init(&cbb, 0);


	failure = 1;

	/* SRTP is for DTLS */
	if ((ssl_ctx = SSL_CTX_new(DTLSv1_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	/* By default, we don't need this */
	if (tlsext_srtp_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SRTP by default\n");
		goto err;
	}

	if (srtp_find_profile_by_name(tlsext_srtp_aes128cmsha80, &prof,
	    strlen(tlsext_srtp_aes128cmsha80))) {
		FAIL("should be able to find the given profile\n");
		goto err;
	}
	ssl->internal->srtp_profile = prof;
	if (!tlsext_srtp_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need SRTP by now\n");
		goto err;
	}

	/* Make sure we can build the server with a single profile. */

	if (!tlsext_srtp_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build SRTP\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_srtp_single)) {







>
>






|

>
|







>
>
>
>

|










|






|







3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105

static int
test_tlsext_srtp_server(void)
{
	const SRTP_PROTECTION_PROFILE *prof;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	uint8_t *data = NULL;
	CBB cbb;
	CBS cbs;
	int failure, alert;
	size_t dlen;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	/* SRTP is for DTLS */
	if ((ssl_ctx = SSL_CTX_new(DTLSv1_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_use_srtp, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch srtp funcs");

	/* By default, we don't need this */
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need SRTP by default\n");
		goto err;
	}

	if (srtp_find_profile_by_name(tlsext_srtp_aes128cmsha80, &prof,
	    strlen(tlsext_srtp_aes128cmsha80))) {
		FAIL("should be able to find the given profile\n");
		goto err;
	}
	ssl->internal->srtp_profile = prof;
	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need SRTP by now\n");
		goto err;
	}

	/* Make sure we can build the server with a single profile. */

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server failed to build SRTP\n");
		goto err;
	}
	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish CBB");

	if (dlen != sizeof(tlsext_srtp_single)) {
2666
2667
2668
2669
2670
2671
2672
2673

2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
		FAIL("server SRTP differs:\n");
		compare_data(data, dlen, tlsext_srtp_single,
		    sizeof(tlsext_srtp_single));
		goto err;
	}

	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);

	free(data);
	data = NULL;

	/* Make sure we can parse the single profile. */
	ssl->internal->srtp_profile = NULL;

	if (SSL_get_selected_srtp_profile(ssl) != NULL) {
		FAIL("SRTP profile should not be set yet\n");
		goto err;
	}

	/* Setup the environment as if a client sent a list of profiles. */
	if (SSL_set_tlsext_use_srtp(ssl, tlsext_srtp_multiple_profiles) != 0) {
		FAIL("should be able to set multiple profiles in SRTP\n");
		goto err;
	}

	CBS_init(&cbs, tlsext_srtp_single, sizeof(tlsext_srtp_single));
	if (!tlsext_srtp_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}







|
>


















|







3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
		FAIL("server SRTP differs:\n");
		compare_data(data, dlen, tlsext_srtp_single,
		    sizeof(tlsext_srtp_single));
		goto err;
	}

	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");
	free(data);
	data = NULL;

	/* Make sure we can parse the single profile. */
	ssl->internal->srtp_profile = NULL;

	if (SSL_get_selected_srtp_profile(ssl) != NULL) {
		FAIL("SRTP profile should not be set yet\n");
		goto err;
	}

	/* Setup the environment as if a client sent a list of profiles. */
	if (SSL_set_tlsext_use_srtp(ssl, tlsext_srtp_multiple_profiles) != 0) {
		FAIL("should be able to set multiple profiles in SRTP\n");
		goto err;
	}

	CBS_init(&cbs, tlsext_srtp_single, sizeof(tlsext_srtp_single));
	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse SRTP\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
	}

	/* Make sure we cannot parse multiple profiles */
	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple,
	    sizeof(tlsext_srtp_multiple));
	if (tlsext_srtp_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("should not find multiple entries from the server\n");
		goto err;
	}

	/* Make sure we cannot parse a server with unknown profile */
	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_single_invalid,
	    sizeof(tlsext_srtp_single_invalid));
	if (tlsext_srtp_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("should not be able to parse this\n");
		goto err;
	}

	failure = 0;

 err:







|









|







3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
	}

	/* Make sure we cannot parse multiple profiles */
	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_multiple,
	    sizeof(tlsext_srtp_multiple));
	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("should not find multiple entries from the server\n");
		goto err;
	}

	/* Make sure we cannot parse a server with unknown profile */
	ssl->internal->srtp_profile = NULL;

	CBS_init(&cbs, tlsext_srtp_single_invalid,
	    sizeof(tlsext_srtp_single_invalid));
	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("should not be able to parse this\n");
		goto err;
	}

	failure = 0;

 err:
2756
2757
2758
2759
2760
2761
2762


2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780




2781
2782
2783
2784
2785
2786
2787

static int
test_tlsext_clienthello_build(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	size_t dlen;
	int failure;
	CBB cbb;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) {
		FAIL("failed to create SSL_CTX");
		goto err;
	}

	if ((ssl = SSL_new(ssl_ctx)) == NULL) {
		FAIL("failed to create SSL");
		goto err;
	}





	ssl->s3->hs.our_min_tls_version = TLS1_VERSION;
	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;

	if (!tlsext_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("failed to build clienthello extensions\n");
		goto err;







>
>


















>
>
>
>







3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242

static int
test_tlsext_clienthello_build(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	size_t dlen;
	int failure;
	CBB cbb;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) {
		FAIL("failed to create SSL_CTX");
		goto err;
	}

	if ((ssl = SSL_new(ssl_ctx)) == NULL) {
		FAIL("failed to create SSL");
		goto err;
	}

	if (!tls_extension_funcs(TLSEXT_TYPE_supported_versions, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch supported versions funcs");

	ssl->s3->hs.our_min_tls_version = TLS1_VERSION;
	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;

	if (!tlsext_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("failed to build clienthello extensions\n");
		goto err;
2805
2806
2807
2808
2809
2810
2811
2812

2813
2814
2815
2816
2817
2818
2819
		    sizeof(tlsext_clienthello_default));
		goto err;
	}

	free(data);
	data = NULL;
	CBB_cleanup(&cbb);
	CBB_init(&cbb, 0);


	/* Switch to TLSv1.1, disable EC ciphers and session tickets. */
	ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION;
	if (!SSL_set_cipher_list(ssl, "TLSv1.2:!ECDHE:!ECDSA")) {
		FAIL("failed to set cipher list\n");
		goto err;
	}







|
>







3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
		    sizeof(tlsext_clienthello_default));
		goto err;
	}

	free(data);
	data = NULL;
	CBB_cleanup(&cbb);
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	/* Switch to TLSv1.1, disable EC ciphers and session tickets. */
	ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION;
	if (!SSL_set_cipher_list(ssl, "TLSv1.2:!ECDHE:!ECDSA")) {
		FAIL("failed to set cipher list\n");
		goto err;
	}
2923
2924
2925
2926
2927
2928
2929
2930

2931
2932
2933
2934
2935
2936
2937
		    sizeof(tlsext_serverhello_default));
		goto err;
	}

	CBB_cleanup(&cbb);
	free(data);
	data = NULL;
	CBB_init(&cbb, 0);


	/* Turn a few things on so we get extensions... */
	ssl->s3->send_connection_binding = 1;
	ssl->s3->hs.cipher =
	    ssl3_get_cipher_by_id(TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256);
	ssl->internal->tlsext_status_expected = 1;
	ssl->internal->tlsext_ticket_expected = 1;







|
>







3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
		    sizeof(tlsext_serverhello_default));
		goto err;
	}

	CBB_cleanup(&cbb);
	free(data);
	data = NULL;
	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	/* Turn a few things on so we get extensions... */
	ssl->s3->send_connection_binding = 1;
	ssl->s3->hs.cipher =
	    ssl3_get_cipher_by_id(TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256);
	ssl->internal->tlsext_status_expected = 1;
	ssl->internal->tlsext_ticket_expected = 1;
2989
2990
2991
2992
2993
2994
2995


2996
2997
2998
2999
3000
3001


3002

3003
3004
3005
3006
3007




3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065



3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081


3082
3083
3084
3085
3086
3087


3088

3089
3090
3091
3092
3093
3094




3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140



3141
3142
3143
3144
3145
3146
3147

static int
test_tlsext_versions_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure = 0;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;



	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION;

	if (tlsext_versions_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need versions\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;

	if (tlsext_versions_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need versions\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;

	if (!tlsext_versions_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need versions\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.our_min_tls_version = TLS1_VERSION;
	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;

	if (!tlsext_versions_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client should have built versions\n");
		failure = 1;
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");
		failure = 1;
		goto done;
	}

	if (dlen != sizeof(tlsext_versions_client)) {
		FAIL("got versions with length %zu, "
		    "want length %zu\n", dlen, sizeof(tlsext_versions_client));
		failure = 1;
		goto done;
	}

	CBS_init(&cbs, data, dlen);
	if (!tlsext_versions_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client versions\n");
		failure = 1;
		goto done;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		failure = 1;
		goto done;
	}



 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}


static int
test_tlsext_versions_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure = 0;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;



	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	ssl->s3->hs.negotiated_tls_version = TLS1_2_VERSION;

	if (tlsext_versions_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need versions\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.negotiated_tls_version = TLS1_3_VERSION;

	if (!tlsext_versions_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need versions\n");
		failure = 1;
		goto done;
	}

	if (!tlsext_versions_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should have built versions\n");
		failure = 1;
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");
		failure = 1;
		goto done;
	}

	if (dlen != sizeof(tlsext_versions_server)) {
		FAIL("got versions with length %zu, "
		    "want length %zu\n", dlen, sizeof(tlsext_versions_server));
		failure = 1;
		goto done;
	}

	CBS_init(&cbs, data, dlen);
	if (!tlsext_versions_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse client versions\n");
		failure = 1;
		goto done;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		failure = 1;
		goto done;
	}



 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);







>
>
|





>
>
|
>





>
>
>
>



|

<





|

<





|

<






|

<





<






<




|

<




<


>
>
>









<






>
>
|





>
>
|
>






>
>
>
>


|

<





|

<



|

<





<






<




|

<




<


>
>
>







3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478

3479
3480
3481
3482
3483
3484
3485

3486
3487
3488
3489
3490
3491
3492

3493
3494
3495
3496
3497
3498
3499
3500

3501
3502
3503
3504
3505

3506
3507
3508
3509
3510
3511

3512
3513
3514
3515
3516
3517

3518
3519
3520
3521

3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535

3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567

3568
3569
3570
3571
3572
3573
3574

3575
3576
3577
3578
3579

3580
3581
3582
3583
3584

3585
3586
3587
3588
3589
3590

3591
3592
3593
3594
3595
3596

3597
3598
3599
3600

3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612

static int
test_tlsext_versions_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_supported_versions, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch supported versions funcs");

	ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION;

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need versions\n");

		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need versions\n");

		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need versions\n");

		goto done;
	}

	ssl->s3->hs.our_min_tls_version = TLS1_VERSION;
	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client should have built versions\n");

		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");

		goto done;
	}

	if (dlen != sizeof(tlsext_versions_client)) {
		FAIL("got versions with length %zu, "
		    "want length %zu\n", dlen, sizeof(tlsext_versions_client));

		goto done;
	}

	CBS_init(&cbs, data, dlen);
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client versions\n");

		goto done;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");

		goto done;
	}

	failure = 0;

 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}


static int
test_tlsext_versions_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_supported_versions, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch supported versions funcs");

	ssl->s3->hs.negotiated_tls_version = TLS1_2_VERSION;

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need versions\n");

		goto done;
	}

	ssl->s3->hs.negotiated_tls_version = TLS1_3_VERSION;

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need versions\n");

		goto done;
	}

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should have built versions\n");

		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");

		goto done;
	}

	if (dlen != sizeof(tlsext_versions_server)) {
		FAIL("got versions with length %zu, "
		    "want length %zu\n", dlen, sizeof(tlsext_versions_server));

		goto done;
	}

	CBS_init(&cbs, data, dlen);
	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse client versions\n");

		goto done;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");

		goto done;
	}

	failure = 0;

 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
3165
3166
3167
3168
3169
3170
3171


3172
3173
3174
3175
3176
3177


3178

3179
3180
3181
3182
3183




3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239

3240
3241
3242
3243
3244
3245
3246
3247
3248







3249
3250
3251
3252
3253
3254
3255


3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274


3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306

static int
test_tlsext_keyshare_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure = 0;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;



	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	if ((ssl->s3->hs.key_share =
	    tls_key_share_new_nid(NID_X25519)) == NULL)
		errx(1, "failed to create key share");
	if (!tls_key_share_generate(ssl->s3->hs.key_share))
		errx(1, "failed to generate key share");

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;
	if (tlsext_keyshare_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need keyshare\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (!tlsext_keyshare_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need keyshare\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (!tlsext_keyshare_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client should have built keyshare\n");
		failure = 1;
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");
		failure = 1;
		goto done;
	}

	if (dlen != sizeof(tlsext_keyshare_client)) {
		FAIL("got client keyshare with length %zu, "
		    "want length %zu\n", dlen, (size_t) sizeof(tlsext_keyshare_client));
		failure = 1;
		goto done;
	}

	(ssl)->version = TLS1_3_VERSION;
	CBS_init(&cbs, data, dlen);

	if (!tlsext_keyshare_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client keyshare\n");
		failure = 1;
		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		failure = 1;
		goto done;
	}



 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}








static int
test_tlsext_keyshare_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int decode_error;
	int failure = 1;
	size_t dlen, idx;
	int alert;
	CBB cbb;
	CBS cbs;
	uint8_t bogokey[] = {
		0xe5, 0xe8, 0x5a, 0xb9,	0x7e, 0x12, 0x62, 0xe3,
		0xd8, 0x7f, 0x6e, 0x3c,	0xec, 0xa6, 0x8b, 0x99,
		0x45, 0x77, 0x8e, 0x11,	0xb3, 0xb9, 0x12, 0xb6,
		0xbe, 0x35, 0xca, 0x51,	0x76, 0x1e, 0xe8, 0x22,
	};

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	CBB_init(&cbb, 0);



	ssl->s3->hs.negotiated_tls_version = TLS1_2_VERSION;
	if (tlsext_keyshare_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need keyshare\n");
		goto done;
	}

	ssl->s3->hs.negotiated_tls_version = TLS1_3_VERSION;
	if (tlsext_keyshare_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("client should not need keyshare\n");
		goto done;
	}

	if (tls_extension_find(TLSEXT_TYPE_key_share, &idx) == NULL) {
		FAIL("failed to find keyshare extension\n");
		goto done;
	}
	ssl->s3->hs.extensions_seen |= (1 << idx);

	if (!tlsext_keyshare_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need keyshare\n");
		goto done;
	}

	if (tlsext_keyshare_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should not have built a keyshare response\n");
		goto done;
	}

	if ((ssl->s3->hs.key_share =
		tls_key_share_new_nid(NID_X25519)) == NULL) {
		FAIL("failed to create key share");







>
>
|





>
>
|
>





>
>
>
>








|

<




|

<




|

<





<






<






|

<





<



>









>
>
>
>
>
>
>







>
>

|




|
|
|
|
|
<






|
>
>


|





|










|




|







3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667

3668
3669
3670
3671
3672
3673

3674
3675
3676
3677
3678
3679

3680
3681
3682
3683
3684

3685
3686
3687
3688
3689
3690

3691
3692
3693
3694
3695
3696
3697
3698

3699
3700
3701
3702
3703

3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743

3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784

static int
test_tlsext_keyshare_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_key_share, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch keyshare funcs");

	if ((ssl->s3->hs.key_share =
	    tls_key_share_new_nid(NID_X25519)) == NULL)
		errx(1, "failed to create key share");
	if (!tls_key_share_generate(ssl->s3->hs.key_share))
		errx(1, "failed to generate key share");

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need keyshare\n");

		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need keyshare\n");

		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client should have built keyshare\n");

		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");

		goto done;
	}

	if (dlen != sizeof(tlsext_keyshare_client)) {
		FAIL("got client keyshare with length %zu, "
		    "want length %zu\n", dlen, (size_t) sizeof(tlsext_keyshare_client));

		goto done;
	}

	(ssl)->version = TLS1_3_VERSION;
	CBS_init(&cbs, data, dlen);

	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client keyshare\n");

		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");

		goto done;
	}

	failure = 0;

 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

static const uint8_t bogokey[] = {
	0xe5, 0xe8, 0x5a, 0xb9,	0x7e, 0x12, 0x62, 0xe3,
	0xd8, 0x7f, 0x6e, 0x3c,	0xec, 0xa6, 0x8b, 0x99,
	0x45, 0x77, 0x8e, 0x11,	0xb3, 0xb9, 0x12, 0xb6,
	0xbe, 0x35, 0xca, 0x51,	0x76, 0x1e, 0xe8, 0x22,
};

static int
test_tlsext_keyshare_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int decode_error;
	int failure;
	size_t dlen, idx;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_key_share, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch keyshare funcs");

	ssl->s3->hs.negotiated_tls_version = TLS1_2_VERSION;
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need keyshare\n");
		goto done;
	}

	ssl->s3->hs.negotiated_tls_version = TLS1_3_VERSION;
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("client should not need keyshare\n");
		goto done;
	}

	if (tls_extension_find(TLSEXT_TYPE_key_share, &idx) == NULL) {
		FAIL("failed to find keyshare extension\n");
		goto done;
	}
	ssl->s3->hs.extensions_seen |= (1 << idx);

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should need keyshare\n");
		goto done;
	}

	if (server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should not have built a keyshare response\n");
		goto done;
	}

	if ((ssl->s3->hs.key_share =
		tls_key_share_new_nid(NID_X25519)) == NULL) {
		FAIL("failed to create key share");
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330

	if (!tls_key_share_peer_public(ssl->s3->hs.key_share, &cbs,
	    &decode_error, NULL)) {
		FAIL("failed to load peer public key\n");
		goto done;
	}

	if (!tlsext_keyshare_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should be able to build a keyshare response\n");
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");
		goto done;







|







3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808

	if (!tls_key_share_peer_public(ssl->s3->hs.key_share, &cbs,
	    &decode_error, NULL)) {
		FAIL("failed to load peer public key\n");
		goto done;
	}

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {
		FAIL("server should be able to build a keyshare response\n");
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");
		goto done;
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363

3364
3365
3366
3367
3368
3369
3370
	if (!tls_key_share_generate(ssl->s3->hs.key_share)) {
		FAIL("failed to generate key share");
		goto done;
	}

	CBS_init(&cbs, data, dlen);

	if (!tlsext_keyshare_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server keyshare\n");
		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto done;
	}

	failure = 0;

done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);







|










>







3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
	if (!tls_key_share_generate(ssl->s3->hs.key_share)) {
		FAIL("failed to generate key share");
		goto done;
	}

	CBS_init(&cbs, data, dlen);

	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server keyshare\n");
		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto done;
	}

	failure = 0;

done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
3381
3382
3383
3384
3385
3386
3387


3388
3389
3390
3391
3392
3393


3394

3395
3396
3397
3398
3399
3400




3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459


3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475


3476
3477
3478
3479
3480
3481


3482

3483
3484
3485
3486
3487
3488




3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562


3563
3564
3565
3566
3567
3568
3569
3570
3571

























































































































































































































3572
3573
3574
3575
3576
3577
3578

static int
test_tlsext_cookie_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure = 0;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;



	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;
	if (tlsext_cookie_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need cookie\n");
		failure = 1;
		goto done;
	}


	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (tlsext_cookie_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need cookie\n");
		failure = 1;
		goto done;
	}

	/* Normally would be set by receiving a server cookie in an HRR */
	ssl->s3->hs.tls13.cookie = strdup(cookie);
	ssl->s3->hs.tls13.cookie_len = strlen(cookie);

	if (!tlsext_cookie_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need cookie\n");
		failure = 1;
		goto done;
	}

	if (!tlsext_cookie_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client should have built a cookie response\n");
		failure = 1;
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");
		failure = 1;
		goto done;
	}

	if (dlen != strlen(cookie) + sizeof(uint16_t)) {
		FAIL("got cookie with length %zu, "
		    "want length %zu\n", dlen, strlen(cookie) +
		    sizeof(uint16_t));
		failure = 1;
		goto done;
	}

	CBS_init(&cbs, data, dlen);

	/* Checks cookie against what's in the hs.tls13 */
	if (!tlsext_cookie_server_parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client cookie\n");
		failure = 1;
		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		failure = 1;
		goto done;
	}



 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

static int
test_tlsext_cookie_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;


	int failure = 0;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;



	CBB_init(&cbb, 0);


	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");





	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;
	if (tlsext_cookie_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need cookie\n");
		failure = 1;
		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (tlsext_cookie_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need cookie\n");
		failure = 1;
		goto done;
	}

	/* Normally would be set by server before sending HRR */
	ssl->s3->hs.tls13.cookie = strdup(cookie);
	ssl->s3->hs.tls13.cookie_len = strlen(cookie);

	if (!tlsext_cookie_server_needs(ssl, SSL_TLSEXT_MSG_HRR)) {
		FAIL("server should need cookie\n");
		failure = 1;
		goto done;
	}

	if (!tlsext_cookie_server_build(ssl, SSL_TLSEXT_MSG_HRR, &cbb)) {
		FAIL("server should have built a cookie response\n");
		failure = 1;
		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");
		failure = 1;
		goto done;
	}

	if (dlen != strlen(cookie) + sizeof(uint16_t)) {
		FAIL("got cookie with length %zu, "
		    "want length %zu\n", dlen, strlen(cookie) +
		    sizeof(uint16_t));
		failure = 1;
		goto done;
	}

	CBS_init(&cbs, data, dlen);

	if (tlsext_cookie_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("client should not have parsed server cookie\n");
		failure = 1;
		goto done;
	}

	freezero(ssl->s3->hs.tls13.cookie, ssl->s3->hs.tls13.cookie_len);
	ssl->s3->hs.tls13.cookie = NULL;
	ssl->s3->hs.tls13.cookie_len = 0;

	if (!tlsext_cookie_client_parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server cookie\n");
		failure = 1;
		goto done;
	}

	if (memcmp(cookie, ssl->s3->hs.tls13.cookie,
		ssl->s3->hs.tls13.cookie_len) != 0) {
		FAIL("parsed server cookie does not match sent cookie\n");
		failure = 1;
		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		failure = 1;
		goto done;
	}



done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}


























































































































































































































struct tls_sni_test {
	const char *hostname;
	int is_ip;
	int valid;
};








>
>
|





>
>
|
>






>
>
>
>

|

<





|

<







|

<



|

<





<







<






|

<





<


>
>
















>
>
|





>
>
|
>






>
>
>
>

|

<




|

<







|

<



|

<





<







<





|

<







|

<






<





<


>
>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891

3892
3893
3894
3895
3896
3897
3898

3899
3900
3901
3902
3903
3904
3905
3906
3907

3908
3909
3910
3911
3912

3913
3914
3915
3916
3917

3918
3919
3920
3921
3922
3923
3924

3925
3926
3927
3928
3929
3930
3931
3932

3933
3934
3935
3936
3937

3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982

3983
3984
3985
3986
3987
3988

3989
3990
3991
3992
3993
3994
3995
3996
3997

3998
3999
4000
4001
4002

4003
4004
4005
4006
4007

4008
4009
4010
4011
4012
4013
4014

4015
4016
4017
4018
4019
4020
4021

4022
4023
4024
4025
4026
4027
4028
4029
4030

4031
4032
4033
4034
4035
4036

4037
4038
4039
4040
4041

4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278

static int
test_tlsext_cookie_client(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_cookie, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch cookie funcs");

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need cookie\n");

		goto done;
	}


	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need cookie\n");

		goto done;
	}

	/* Normally would be set by receiving a server cookie in an HRR */
	ssl->s3->hs.tls13.cookie = strdup(cookie);
	ssl->s3->hs.tls13.cookie_len = strlen(cookie);

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need cookie\n");

		goto done;
	}

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client should have built a cookie response\n");

		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");

		goto done;
	}

	if (dlen != strlen(cookie) + sizeof(uint16_t)) {
		FAIL("got cookie with length %zu, "
		    "want length %zu\n", dlen, strlen(cookie) +
		    sizeof(uint16_t));

		goto done;
	}

	CBS_init(&cbs, data, dlen);

	/* Checks cookie against what's in the hs.tls13 */
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse client cookie\n");

		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");

		goto done;
	}

	failure = 0;

 done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

static int
test_tlsext_cookie_server(void)
{
	unsigned char *data = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	size_t dlen;
	int alert;
	CBB cbb;
	CBS cbs;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_cookie, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch cookie funcs");

	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need cookie\n");

		goto done;
	}

	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;
	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need cookie\n");

		goto done;
	}

	/* Normally would be set by server before sending HRR */
	ssl->s3->hs.tls13.cookie = strdup(cookie);
	ssl->s3->hs.tls13.cookie_len = strlen(cookie);

	if (!server_funcs->needs(ssl, SSL_TLSEXT_MSG_HRR)) {
		FAIL("server should need cookie\n");

		goto done;
	}

	if (!server_funcs->build(ssl, SSL_TLSEXT_MSG_HRR, &cbb)) {
		FAIL("server should have built a cookie response\n");

		goto done;
	}

	if (!CBB_finish(&cbb, &data, &dlen)) {
		FAIL("failed to finish CBB\n");

		goto done;
	}

	if (dlen != strlen(cookie) + sizeof(uint16_t)) {
		FAIL("got cookie with length %zu, "
		    "want length %zu\n", dlen, strlen(cookie) +
		    sizeof(uint16_t));

		goto done;
	}

	CBS_init(&cbs, data, dlen);

	if (client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("client should not have parsed server cookie\n");

		goto done;
	}

	freezero(ssl->s3->hs.tls13.cookie, ssl->s3->hs.tls13.cookie_len);
	ssl->s3->hs.tls13.cookie = NULL;
	ssl->s3->hs.tls13.cookie_len = 0;

	if (!client_funcs->parse(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
		FAIL("failed to parse server cookie\n");

		goto done;
	}

	if (memcmp(cookie, ssl->s3->hs.tls13.cookie,
		ssl->s3->hs.tls13.cookie_len) != 0) {
		FAIL("parsed server cookie does not match sent cookie\n");

		goto done;
	}

	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");

		goto done;
	}

	failure = 0;

done:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return (failure);
}

const uint8_t tlsext_default_psk_modes[] = {
	0x01, 0x01,
};

const uint8_t tlsext_psk_only_mode[] = {
	0x01, 0x00,
};

const uint8_t tlsext_psk_both_modes[] = {
	0x02, 0x00, 0x01,
};

static int
test_tlsext_psk_modes_client(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;
	uint8_t *data = NULL;
	size_t dlen;
	CBB cbb;
	CBS cbs;
	int alert;

	failure = 1;

	if (!CBB_init(&cbb, 0))
		errx(1, "Failed to create CBB");

	if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_psk_kex_modes, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch psk funcs");

	/* Disabled by default. */
	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need psk kex modes by default\n");
		goto err;
	}

	/*
	 * Prerequisites: use_psk_dhe_ke flag is set and
	 * our_max_tls_version >= TLSv1.3.
	 */

	ssl->s3->hs.tls13.use_psk_dhe_ke = 1;
	ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION;

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need psk kex modes with TLSv1.2\n");
		goto err;
	}

	ssl->s3->hs.tls13.use_psk_dhe_ke = 0;
	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;

	if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should not need psk kex modes without "
		    "use_psk_dhe_ke\n");
		goto err;
	}

	ssl->s3->hs.tls13.use_psk_dhe_ke = 1;
	ssl->s3->hs.our_max_tls_version = TLS1_3_VERSION;

	if (!client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) {
		FAIL("client should need psk kex modes with TLSv1.3\n");
		goto err;
	}

	/* Make sure we can build psk modes with DHE key establishment. */

	if (!client_funcs->build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
		FAIL("client failed to build psk kex modes\n");
		goto err;
	}

	if (!CBB_finish(&cbb, &data, &dlen))
		errx(1, "failed to finish psk kex CBB");

	if (dlen != sizeof(tlsext_default_psk_modes)) {
		FAIL("got client psk kex modes with length %zu, "
		    "want length %zu\n", dlen,
		    sizeof(tlsext_default_psk_modes));
		compare_data(data, dlen, tlsext_default_psk_modes,
		    sizeof(tlsext_default_psk_modes));
		goto err;
	}
	if (memcmp(data, tlsext_default_psk_modes, dlen) != 0) {
		FAIL("client psk kex modes differ:\n");
		compare_data(data, dlen, tlsext_default_psk_modes,
		    sizeof(tlsext_default_psk_modes));
		goto err;
	}

	CBB_cleanup(&cbb);
	free(data);
	data = NULL;

	/*
	 * Make sure we can parse the default psk modes and that use_psk_dhe_ke
	 * is set after parsing.
	 */

	ssl->s3->hs.tls13.use_psk_dhe_ke = 0;

	CBS_init(&cbs, tlsext_default_psk_modes,
	    sizeof(tlsext_default_psk_modes));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse psk kex modes\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if (ssl->s3->hs.tls13.use_psk_dhe_ke != 1) {
		FAIL("should have set use_psk_dhe_ke\n");
		goto err;
	}

	/*
	 * Make sure we can parse the psk-only mode and that use_psk_dhe_ke
	 * is still not set after parsing.
	 */

	ssl->s3->hs.tls13.use_psk_dhe_ke = 0;

	CBS_init(&cbs, tlsext_psk_only_mode, sizeof(tlsext_psk_only_mode));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse psk kex modes\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if (ssl->s3->hs.tls13.use_psk_dhe_ke != 0) {
		FAIL("should not have set use_psk_dhe_ke\n");
		goto err;
	}

	/*
	 * Make sure we can parse the extension indicating both modes and that
	 * use_psk_dhe_ke is set after parsing.
	 */

	ssl->s3->hs.tls13.use_psk_dhe_ke = 0;

	CBS_init(&cbs, tlsext_psk_both_modes, sizeof(tlsext_psk_both_modes));
	if (!server_funcs->parse(ssl, SSL_TLSEXT_MSG_CH, &cbs, &alert)) {
		FAIL("failed to parse psk kex modes\n");
		goto err;
	}
	if (CBS_len(&cbs) != 0) {
		FAIL("extension data remaining\n");
		goto err;
	}

	if (ssl->s3->hs.tls13.use_psk_dhe_ke != 1) {
		FAIL("should have set use_psk_dhe_ke\n");
		goto err;
	}

	failure = 0;

 err:
	CBB_cleanup(&cbb);
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);
	free(data);

	return failure;
}

static int
test_tlsext_psk_modes_server(void)
{
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	const struct tls_extension_funcs *client_funcs;
	const struct tls_extension_funcs *server_funcs;
	int failure;

	failure = 1;

	if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL)
		errx(1, "failed to create SSL_CTX");
	if ((ssl = SSL_new(ssl_ctx)) == NULL)
		errx(1, "failed to create SSL");

	if (!tls_extension_funcs(TLSEXT_TYPE_psk_kex_modes, &client_funcs,
	    &server_funcs))
		errx(1, "failed to fetch psk funcs");

	if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) {
		FAIL("server should not need psk kex modes\n");
		goto err;
	}

	failure = 0;

 err:
	SSL_CTX_free(ssl_ctx);
	SSL_free(ssl);

	return failure;
}

struct tls_sni_test {
	const char *hostname;
	int is_ip;
	int valid;
};

3676
3677
3678
3679
3680
3681
3682
3683
3684
3685


3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719



3720

3721
3722
3723
3724
3725
3726
3727
};

#define N_TLS_SNI_TESTS (sizeof(tls_sni_tests) / sizeof(*tls_sni_tests))

static int
test_tlsext_is_valid_hostname(const struct tls_sni_test *tst)
{
	int failure = 0;
	int is_ip;
	CBS cbs;



	CBS_init(&cbs, tst->hostname, strlen(tst->hostname));
	if (tlsext_sni_is_valid_hostname(&cbs, &is_ip) != tst->valid) {
		if (tst->valid) {
			FAIL("Valid hostname '%s' rejected\n",
			    tst->hostname);
		} else {
			FAIL("Invalid hostname '%s' accepted\n",
			    tst->hostname);
		}
		failure = 1;
		goto done;
	}
	if (tst->is_ip != is_ip) {
		if (tst->is_ip) {
			FAIL("Hostname '%s' is an IP literal but not "
			    "identified as one\n", tst->hostname);
		} else {
			FAIL("Hostname '%s' is not an IP literal but is "
			    "identified as one\n", tst->hostname);
		}
		failure = 1;
		goto done;
	}

	if (tst->valid) {
		CBS_init(&cbs, tst->hostname,
		    strlen(tst->hostname) + 1);
		if (tlsext_sni_is_valid_hostname(&cbs, &is_ip)) {
			FAIL("hostname with NUL byte accepted\n");
			failure = 1;
			goto done;
		}
	}



 done:

	return failure;
}

static int
test_tlsext_valid_hostnames(void)
{
	const struct tls_sni_test *tst;







|


>
>










<










<








<



>
>
>

>







4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397

4398
4399
4400
4401
4402
4403
4404
4405
4406
4407

4408
4409
4410
4411
4412
4413
4414
4415

4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
};

#define N_TLS_SNI_TESTS (sizeof(tls_sni_tests) / sizeof(*tls_sni_tests))

static int
test_tlsext_is_valid_hostname(const struct tls_sni_test *tst)
{
	int failure;
	int is_ip;
	CBS cbs;

	failure = 1;

	CBS_init(&cbs, tst->hostname, strlen(tst->hostname));
	if (tlsext_sni_is_valid_hostname(&cbs, &is_ip) != tst->valid) {
		if (tst->valid) {
			FAIL("Valid hostname '%s' rejected\n",
			    tst->hostname);
		} else {
			FAIL("Invalid hostname '%s' accepted\n",
			    tst->hostname);
		}

		goto done;
	}
	if (tst->is_ip != is_ip) {
		if (tst->is_ip) {
			FAIL("Hostname '%s' is an IP literal but not "
			    "identified as one\n", tst->hostname);
		} else {
			FAIL("Hostname '%s' is not an IP literal but is "
			    "identified as one\n", tst->hostname);
		}

		goto done;
	}

	if (tst->valid) {
		CBS_init(&cbs, tst->hostname,
		    strlen(tst->hostname) + 1);
		if (tlsext_sni_is_valid_hostname(&cbs, &is_ip)) {
			FAIL("hostname with NUL byte accepted\n");

			goto done;
		}
	}

	failure = 0;

 done:

	return failure;
}

static int
test_tlsext_valid_hostnames(void)
{
	const struct tls_sni_test *tst;
3778
3779
3780
3781
3782
3783
3784



3785
3786
3787
3788
3789



3790
3791
3792

#ifndef OPENSSL_NO_SRTP
	failed |= test_tlsext_srtp_client();
	failed |= test_tlsext_srtp_server();
#else
	fprintf(stderr, "Skipping SRTP tests due to OPENSSL_NO_SRTP\n");
#endif




	failed |= test_tlsext_clienthello_build();
	failed |= test_tlsext_serverhello_build();

	failed |= test_tlsext_valid_hostnames();




	return (failed);
}







>
>
>





>
>
>



4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501

#ifndef OPENSSL_NO_SRTP
	failed |= test_tlsext_srtp_client();
	failed |= test_tlsext_srtp_server();
#else
	fprintf(stderr, "Skipping SRTP tests due to OPENSSL_NO_SRTP\n");
#endif

	failed |= test_tlsext_psk_modes_client();
	failed |= test_tlsext_psk_modes_server();

	failed |= test_tlsext_clienthello_build();
	failed |= test_tlsext_serverhello_build();

	failed |= test_tlsext_valid_hostnames();

	failed |= test_tlsext_quic_transport_parameters_client();
	failed |= test_tlsext_quic_transport_parameters_server();

	return (failed);
}
Changes to jni/libressl/tests/tlslegacytest.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tlslegacytest.c,v 1.5 2021/11/20 16:36:55 tb Exp $ */
/*
 * Copyright (c) 2015, 2016, 2017, 2020 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tlslegacytest.c,v 1.6 2022/06/10 22:00:15 tb Exp $ */
/*
 * Copyright (c) 2015, 2016, 2017, 2020 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
tlslegacy_client_test(int testno, struct tlslegacy_client_test *tct)
{
	BIO *rbio = NULL, *wbio = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	int ret = 1;

	fprintf(stderr, "Test %i - %s\n", testno, tct->desc);

	if ((rbio = BIO_new_mem_buf(tct->server_response,
	    tct->server_response_len)) == NULL) {
		fprintf(stderr, "Failed to setup rbio\n");
		goto failure;
	}
	if ((wbio = BIO_new(BIO_s_mem())) == NULL) {







|







563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
tlslegacy_client_test(int testno, struct tlslegacy_client_test *tct)
{
	BIO *rbio = NULL, *wbio = NULL;
	SSL_CTX *ssl_ctx = NULL;
	SSL *ssl = NULL;
	int ret = 1;

	fprintf(stderr, "Test %d - %s\n", testno, tct->desc);

	if ((rbio = BIO_new_mem_buf(tct->server_response,
	    tct->server_response_len)) == NULL) {
		fprintf(stderr, "Failed to setup rbio\n");
		goto failure;
	}
	if ((wbio = BIO_new(BIO_s_mem())) == NULL) {
Changes to jni/libressl/tests/tlstest.c.
1
2
3
4
5
6
7
8
/* $OpenBSD: tlstest.c,v 1.13 2021/04/04 16:19:47 tb Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
|







1
2
3
4
5
6
7
8
/* $OpenBSD: tlstest.c,v 1.15 2022/07/16 07:46:08 tb Exp $ */
/*
 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
Added jni/libressl/tests/xchacha20_poly1305_tests.txt.




























































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# Test vectors generated from libsodium

KEY: 1f4774fbe6324700d62dd6a104e7b3ca7160cfd958413f2afdb96695475f007e
NONCE: 029174e5102710975a8a4a936075eb3e0f470d436884d250
IN:
AD:
CT:
TAG: f55cf0949af356f977479f1f187d7291

KEY: eb27969c7abf9aff79348e1e77f1fcba7508ceb29a7471961b017aef9ceaf1c2
NONCE: 990009311eab3459c1bee84b5b860bb5bdf93c7bec8767e2
IN: e7ec3d4b9f
AD:
CT: 66bd484861
TAG: 07e31b4dd0f51f0819a0641c86380f32

KEY: 4b6d89dbd7d019c0e1683d4c2a497305c778e2089ddb0f383f2c7fa2a5a52153
NONCE: 97525eb02a8d347fcf38c81b1be5c3ba59406241cf251ba6
IN: 074db54ef9fbc680b41a
AD:
CT: 1221898afd6f516f770f
TAG: 75e7182e7d715f5a32ee6733fd324539

KEY: 766997b1dc6c3c73b1f50e8c28c0fcb90f206258e685aff320f2d4884506c8f4
NONCE: 30e7a9454892ef304776b6dc3d2c2f767ed97041b331c173
IN: b8250c93ac6cf28902137b4522cc67
AD:
CT: e2a13eeff8831a35d9336cb3b5c5d9
TAG: 62fdf67735cad0172f9b88603b5f3c13

KEY: 6585031b5649fcabd9d4971d4ac5646fc7dca22f991dfa7dac39647001004e20
NONCE: 705ee25d03fec430e24c9c6ccaa633f5b86dd43682778278
IN: 9a4ca0633886a742e0241f132e8f90794c34dfd4
AD:
CT: 0a8e6fd4cd1640be77c4c87dde4ae6222c887ed7
TAG: edc4fbc91dfa07021e74ae0d9d1c98dc

KEY: dfc6f7c86a10a319ebcb6362997e585f55b67f3434f47dc4039c2d67973e3077
NONCE: 6097f30fd75229d928454c7d59a2d2c58bfddcb14c16438e
IN: 74c946a7f0733377e852a23087506a28dccef86e101a4359c0
AD:
CT: 6e8ea0bb4c2f1323841d8e236816c61c3295866b75cefb5c25
TAG: f16c0e9487ca7de5e7cb2a1b8bb370fc

KEY: 59b8d488773767c4804d918709cfec6c69a193371145bb94f183899851aaadac
NONCE: ad5bdf8f190ca2d2cc02a75bb62aa22274cb3c98fe2d25f2
IN: 066b9ed10f16d3dc132b409aae02d8cac209dd9b4fb789c4d34725ab2a1f
AD:
CT: 2bbd4542489006df66ad1462a932524642b139ddcbf86b6b480e9e6d976c
TAG: ca4835419ba029bc57010a8cc8bca80c

KEY: 8c0cb4633cf8dc6b4b9552d1035f85517cb1ba4c36bcbc43338a8c6c7d15ce20
NONCE: 8418b9655a0376fadefa3cdf8805815c4f7b56f467a74a95
IN: 50c205a9c5d4088ba8e59a96fcd837f5170669854547678288199f1078ff2a81f0b19a
AD:
CT: 8b55a12df1a85dd3fb19c34ab047a85849d15a30225bb5360bad1f0a8f5f2bd49f5898
TAG: bce13201df6e4a7e6d896262e45d969d

KEY: b45386a75a5772e34bd193e1946f69ebfb90c37ae4581d39c9669d75e4584f50
NONCE: 9fb763d0926585b5f726af9b8e3babdb331e9aa97f8d99ed
IN: 64df0e341145d9e4a0d090153591a74893bc36cb9dae1e9570d8fee62e907cf004f9d8a360343483
AD:
CT: 3146d8a5c898edd832ec9d126e93b3a433ec97dc47dce0e1985bda88c88c6aeca46fc7d9a68e30ab
TAG: 44fdb0d69abd8068442cb2ea6df8b2f2

KEY: f2efbd358dd353639a162be39a957d27c0175d5ab72aeba4a266aeda434e4a58
NONCE: 65a6f7ebe48de78beb183b518589a0afacf71b40a949fa59
IN: f7473947996e6682a3b9c720f03cfaf26bbcdaf76c83342d2ad922435e227a5d1eacbd9bd6ea1727ec19fb0e42
AD:
CT: 778a0fb701b9d671ccfaf1454e8928158ede9bb4395119356a8133036840c1bcbb8fe5e19922fbbcf8b18596e7
TAG: 9d195a89fdd29ca271405d3330f996f9

KEY: 9dd674fb4a30a7bb85fc78050479ab0e2c3cc9f9f5b8689a7a67413aca304b21
NONCE: ad9e8fe15940694725f232e88f79cda7c82fe1b8aae58ba4
IN: 7272bb6609cbd1399a0b89f6ea255165f99330aeb170ac88fccdd8e226df0952407e35718fb5edc9e987faabb271cc69f7e7
AD:
CT: 846901650cb38974463a18c367676e1579ebdaf3e96b57224e842f5d5f678f3270b9a15f01241795662befb3db0768800e25
TAG: 900004db3613acbeb33d65d74dd437d7

KEY: 280cbe7380a0d8bb4d8dd4476012f2eeb388a37b8b71067969abb99f6a888007
NONCE: 2e1854617c67002599e6b077a812c326deb22fe29d093cbb
IN: d0901ec3d31ece2832685ff577f383bdff26c31341ea254acee7c5929a5df74fea2aa964524dc680b2f55fbd4fea900e956c304cc4ac3c
AD:
CT: 546370726cc63068d3520d67f4f57f65d03b9ecec21c2a8c7b1133089ad28b07025a7181bddeb4a49f514fac1a44f64ee3af33d778fb98
TAG: 39084e33e42a1b05f58da65ba487d138

KEY: 887564f75afa78f595cdadcea7340d20f5c5a2df169d0ad14b15fe32ce337004
NONCE: 54c11df13d1f444da80b0964caeb59474b17b23a650a33f5
IN: f0f008eece79ecb24b715dff8a3456dfe253924b99f98f2f1b18564cced50925fca860d1c2d4785bdf4a964c76c3079efa6b37c4ba2cacc534fb590c
AD:
CT: 32bb077268568d569b39e8ccdeeeb447ef424eaa2ffab565209a19b16a25952f897e5405bb0d67d8c9005d1c0b32687164d17fa4d0f412b80414c025
TAG: 0bac7c0f8dce12917fbd4ed1738ac0cc

KEY: 21c6aa88eb1a320d251f71a4b312ca75347040990d869a1dd2a1982c30fda2c7
NONCE: 7dead2f1a3d9d45a9124a40efe8994300976991a4417ef4d
IN:
AD: e1bf7de4
CT:
TAG: 341e9d0687006f981bced2f985f953e6

KEY: 0c97b9a65ffcd80b8f7c20c3904d0d6dd8809a7f97d7f46d39a12c198a85da5d
NONCE: 1f2c1dbc5f52fc9c8f9ca7695515d01d15904b86f703fba3
IN: ecaf65b66d
AD: bd8a6f18
CT: 8d1b2b0e38
TAG: 27a7c7ac8bda627085414f0f31206a07

KEY: 4ab5e3595f39c4379a924e5f8ebcf3279075c08d18daff01d9ddfa40e03faf12
NONCE: 94e6ddc294f5f1531924ec018823343ebcc220a88ea5ee33
IN: c91b73abe5316c3effc6
AD: c576f6ea
CT: abe960fbc64b339c53b1
TAG: 7ebae48a2ff10117069324f04619ad6f

KEY: a1e6146c71c2ea22300e9063455f621e15bd5bf1a3762e17f845e1aba5dd5a9c
NONCE: 82ddb6929abff8a9ad03dfb86c0bb3e7c092d45ebfa60a1b
IN: f011f32ccc2955158c117f53cf7b12
AD: 5d14bc05
CT: 44592321c665f51e9ffea052df1fea
TAG: d556798b97f9b647729801419424affc

KEY: 7a1af30362c27fd55b8c24b7fca324d350decee1d1f8fae56b66253a9dd127dd
NONCE: 61201d6247992002e24e1a893180d4f0c19a3ae4cc74bf0c
IN: 5c7150b6a4daa362e62f82f676fdc4c4b558df64
AD: 00c49210
CT: 27d9e2730b6809c08efbd4b0d24639c7b67486f3
TAG: 5889fdee25379960038778e36b2cedb2

KEY: 0b3fd9073e545ac44a7967263ead139c9547f7a54f06228fd3c8609fa2620784
NONCE: 6450e1097d6f9ea76eb42e8e65972d501041c3a58baf8770
IN: d679ae442b0351e5bff9906b099d45aab4f6aea5306a7a794f
AD: 318d292b
CT: a3f9ee45316d7b0f948a26145ee4fd0552bc6dc25e577e777a
TAG: 0068a401a194b8417ec0e198baa81830

KEY: 047c7d378fe80c02ee48df6f679a859253aed534fdcdd87023eb3d2f93fcafe3
NONCE: ed240b0ff6f8ac585b3ea1ab2dab8080fc2f6401b010c5d0
IN: 7288afb4e0fa5c58602090a75c10d84b5f5f1c0e03498519afe457251aa7
AD: e4310302
CT: 87906b14ca3e32ab01523b31ae0bb74590ce9e1df0811e743a2c7a93415a
TAG: 3a0abeab93792b1ffe768d316da74741

KEY: 1ad4e42acc5dfd07eb0a2456e9103cd0e150a36c667eb2f2b73c0d1ac1089ce3
NONCE: 48efb52387284c5d38b4940c75f0c39a3f81f60bfebb48cb
IN: da7edb5b3193b4484f09efa85fcf85600968ecdc537d3829a469c866ee67b0df677866
AD: 446be8e3
CT: b76457ca99e95b6539b12f1d6bdac55a6d5c6469b1ff274459363ec05241f7e6e5d3ce
TAG: 06880ee508ce929da5a81f8b9de0031c

KEY: 702a554c1b703d4dd69ad51234293ab787a01e15bdb3ce88bf89e18c01a67164
NONCE: ea535d9c371241b9850b8b4a596b63db79eea60bd2cd9fbb
IN: a97156e9b39d05c00b811552d22088d7ee090a117a7f08adac574820d592021f16207720d49fb5fd
AD: ba5790e3
CT: 8d0b2b04479c33287096f0c6276a73f6c037edc1a2b28f8d3b2b8e6d4c5f9dc5113309dd3ecb15e6
TAG: 3cf303305e12924d29c223976699fb73

KEY: 1bb7303fefa4d8d344bb9a215901b2314324bf1f3aeb9df5d1c1532c3a55ebf1
NONCE: a304551e5f0dc98995ddfee6215a9995023a3696debfd302
IN: 6cf6819ce3e7ed9d4f85f4a5699701dbcaf3161adc210c0b7825ddfd83d6d7c685db62f68b3801ccc8a786066d
AD: 901c5feb
CT: bc5ef09c111f76e54f897e6fce4aee1d25b6ed934f641ed5262d0c5eed45f610a6aea3b58b7771e34256d43a16
TAG: b83f73f7995ba1b243dbf48ddfeb8e3a

KEY: 24b294f6cbac10d87158d1c6aca83b337d596132afac7633f69a3b3e58823f11
NONCE: 805772ff619cc6fcc5ec0e9965435d6f74a2290c055ec754
IN: 65e8581286868caabcec1a9814db00b805edc660b94ee3babc6ce19a3ca868bd322105484d59b4ce02ced4071bc16642a1f2
AD: 7ae1c561
CT: fe1d463b1466e8e411f0b0700f90760472ee5141f3e5afef43fd729f1623dca75cd4d00576765b335f8b2b77b00527599cb3
TAG: 111d8540fd5ec04b9ba16ed810133026

KEY: 38e63e8b6402ac3f6d1641a1e3b74d2074be0fe41129975a3ff62b74ca52af05
NONCE: 228d671b036710cbdaa72e9bf1d9ed6982b0bb3428a69fd6
IN: 20a8d18878924d09aac32853c10e73dbd741134b7050ae6999839f2dbc727cb0052b5497c4bbd2a89e716278f15c81b871953614a49693
AD: e9e6ac73
CT: 80e0fe8eb26e5df229c6d939c944d440a37aa3cabf76eab5b9a420095513021ea4241ab367f6f44a20817b14631549ae6c96aa963970e1
TAG: 1e80fbafcc7168e0494fce4cd76d692c

KEY: 4325dd8406fdb8431a81f1b5db3603995256de36121019724cca2190c87a6e83
NONCE: dcbf3077b36d5d678d668fd2d0c99284c780b55c4658ea75
IN: 4f599ad04f79be9add10fdc649b8be53e1062ea5e9c2bed22265dc6fb30d5ab4fd4425b38ff14d8e68013405bec1eff8c9ef3069902e492aac73dcd9
AD: 6fa0d757
CT: 7decbdc7043495c59ecc64e720436bb0708b586a46f8745f74391477f5a2520905dfcebc3765a330999013d309dfaa997bf70bab6a0b8f4f2a2a3cdf
TAG: 051ec4ecce208d9be0cd17f434e13be3

KEY: 2d3d9ed4bc9eb9668733bafbb73e88be2cd17021c3a23be69b981d9f0df71df1
NONCE: 84cae69639240c82b58895997511f145e474ebe1b008f391
IN:
AD: 64db597c26a4c3da
CT:
TAG: 2a22c4a962d46a719014ab7b0ffaf6d3

KEY: 09ec4e79a02db53b19b54dd2d3592afc92c74ef57d1e0f51f3726a6631b1b73f
NONCE: 2907ced16e0777fedb1e2de30df11b3fd712af41dd714a4b
IN: b6e50cd4ea
AD: b5488e9b7f339b7b
CT: 0163e75330
TAG: e29401c6d756adcc516580ae656852aa

KEY: 9d5ac25a417b8a57b85332979e8a7cbad23617bb27772bbccc2acb0acae7b755
NONCE: ff152421688dd6af7fef87817b508493a32d97a06fbda4f3
IN: 92f4b9bc809be77e6a0d
AD: 892b793f7a6e0727
CT: bcc594f59de8ee8c22c6
TAG: 1a8275816c0d32a1b6cfd41fa3889558

KEY: eccf80c5f744d2ecc932f95ade0d9fe9327e19795023db1846d68d04720a2401
NONCE: abc050fad8876589633b222d6a0f2e0bf709f73610aa23ee
IN: 45a380e438405314510c166bac6840
AD: c32c9a1ce6852046
CT: 9fa452dc9ca04c16ff7bde9925e246
TAG: 3d5e826162fa78de3fc043af26044a08

KEY: b1912d6bc3cff47f0c3beccff85d7cd915b70ab88d0d3a8a59e994e1b0da8ac8
NONCE: d8756090a42eea14ff25be890e66bfe4949fad498776ea20
IN: e2f85df2ebcfa6045bd521abfe8af37fc88a0be1
AD: 4576bb59b78032c8
CT: 5eb6324aa48e0a4f72f5cb0a4917faf93af4209c
TAG: 774f8077f039588495045fee07950e14

KEY: 85162b111c9f3163f57c2cbc311a1e9aeed9dd6136b5784bc9c0b5052f8bffbd
NONCE: 23cdb8b546bb8a5a746b24446f0ab4199f0543d915ff51f1
IN: dc81000077d5743beef09ac91663885d984212bbccf3dbe6f3
AD: 3084f3e9c4d0a15f
CT: 692d17ae0b524ec6edc0cf49b69ac90c99bed44691f7ae63b7
TAG: efe72ff84b3bccb4d83a27ddc574bc21

KEY: b05ca358d8ca79f51283d83e2673bfb741c379ba271a773b8dd9c6a108e758d3
NONCE: 9a53ad79f535c6e9da011463063c896f2ec7645e6e3548fc
IN: 44e793742c774020e7349c996418042dc0dc30ee2bfd2654008c8929a436
AD: 71ab5948c5e0f4c6
CT: c5eddb7aeaa175b5f3dab68cf746f2acaf56fc62b29804629e25e2d63879
TAG: bec3b7a8b8dad22ff3d14d26273294d2

KEY: abb5136a01354c765a96e832df58bec3b088bd19dc4d6bd6674f2f02007ebdaa
NONCE: 71267ac9f4fe5caa1d52cd85948a170a778f0141d54dbffe
IN: afb526fe41c4e2a767ce77c4145b9d054268f5f3b279237dec97f8bc46f9d158868b86
AD: 047baa2b04748b62
CT: 0032d4c1e65da2266539464c5d3c2b1618454a6af0e7f1e3cfc87845c75f2f4ae8b03f
TAG: b526a95a33f17ab61f2cdfc1e2dd486a

KEY: bb826ed38008a0d7fb34c0c1a1a1149d2cad16b691d5129cc83f5eff2b3e5748
NONCE: 4e02fe0915d81e9d5a62e5b3551b9db882e3873c0aaa230d
IN: 20270d291a8d9791b0f5e35a64387bb4237bad61169841d7e1667c994ad49869c7d5580ffa752a2d
AD: db852a275081e29b
CT: d740012efb7e1bb986ce2c535134a45f658b92163c109bdecf1ce5b836879fe9e006a56be1fac8d7
TAG: 21e931042e7df80695262198a06286c9

KEY: 938d2c59f6f3e2e7316726537932372e05e8c1b5577aae0ee870bf712ff001ab
NONCE: fb4d71cf7eb2f70df9759a64c76a36b75203f88bf64f4edb
IN: 8910415d674a93c54c8f5e4aa88e59648d9a0a5039a66837d58ab14f0665a5f6d9af9b839f9033d0fe8bc58f19
AD: a3fca278a63bf944
CT: 1905c6987a702980b7f87f1ed2d3ae073abe1401b23434f3db43b5c37c979c2068ce9a92afedcdc218003848ea
TAG: 1bd712f64777381f68be5ccc73f364a3

KEY: dd0521842f498d23236692a22db0eb2f0f14fef57577e5fb194503e206b0973d
NONCE: 519e0eee8f86c75c7a364e0905a5d10d82073e11b91083a5
IN: 61ff13acb99c5a7fd1921ec787c8de23c1a712ff002b08cecc644a78c47341eab78e7680380c93c7d53d5e56ef050d6ff192
AD: bb5c4e5ae8f7e461
CT: 9bfdb0fd195fa5d37da3416b3b1e8f67bd2a456eb0317c02aabf9aac9d833a19bda299e6388e7b7119be235761477a34d49e
TAG: 0f0c03b8423583cb8305a74f622fa1f9

KEY: 189bd84be3fb02723539b29cf76d41507c8b85b7217777ee1fb8f84a24aa7fee
NONCE: ef1bf39f22ba2edf86853505c24fafdf62c1a067963c63ba
IN: d5f96e240b5dd77b9fb2bf11c154fcbff312a791c3eb0717684e4fd84bf943e788050b47e76c427f42f3e5344b2636091603ba3b1d7a91
AD: 93368a8e0900c7b6
CT: c55a8b7f587bee4f97514582c5115582abffd6312914d76c2568be6836f62ba098789ed897c9a7508a5dc214bf8c218664f29941ccdfd6
TAG: 78f87352dcb1143038c95dc6e7352cfd

KEY: 23a2dbfcd02d265805169fa86e6927c7d49c9a24d2707884e18955e32dafc542
NONCE: 305c7851f46f23ea8d832d5ed09d266714fd14f82ba0f69c
IN: 224de94a938d49cad46144e657e548bd86690a1b57b81558095eace59df1c552600dea389aaa609304fbc1eadf2241f2118c8bdf04522e1898efe1d4
AD: 0075b20502bd29b2
CT: 8e10c59369bbb0d72958100b05788498f59588795e075b8bce21d92d320206348b04010ced9b8cd3d651e825488915ce4a6e4f1af2f4d2f77b955376
TAG: c39f0595ae8112dea6ef96df1c12458b

KEY: 264e3c3f47bdf795cdde57d9a30be5a4da8b18463c0e3e05df28b7bf4e56410b
NONCE: 3ee09b6e205c261bf48ac53a9ba0afa460a5d5c0f2d80be8
IN:
AD: 8eeec09d8972cb8ab0069554
CT:
TAG: 245a034d84edab9fa6f0decb6b984766

KEY: d8ba98a272b5f91797b04b114311c3b92b7f2e3bb72edb7f78ed311b9f8ea2ad
NONCE: 481de9a06eee76a501e3c2b9d7423d90596193ad9d8a6564
IN: 9ee1a3134d
AD: 928653701f6d6c8429b08c0d
CT: 459a07898f
TAG: 9188ec8d8e3bd91dcfda48fcc76773f7

KEY: ac9afd627a745df682bb003517056f07876eb94d2f8c610c61b6ac0d34ec4ec0
NONCE: eaae7b8704530db1e8c3dcc968a00604a333c7c27ba51b16
IN: f7c3f6ee2e9c03394dc8
AD: 796620b367d5f041821baf69
CT: d4a69005790cc91d8d34
TAG: e4c83def113afcf83a1ea8cb204a0eae

KEY: ea1a07c1fd60a5421f1fb6c43b4318090e290c97aa3bfa037e6fc5ee00fd47d4
NONCE: 37327805cce92b38a669affbca1de92e068727fcf6fbb09a
IN: 7002ca765b91913ee719e7521ef5ac
AD: 64e7c48fc3041eac0734737f
CT: 9d8857a8c52a9ab3bf44b024b191b6
TAG: d072c31714a7d0fe1596fd443a96e715

KEY: b3beb34fe0229fc8f49b354e941025bde6a788f25017a60e8a49591ed5d7e7da
NONCE: dd0e9fec76de1f6efb022b12164f7e9248b8e8c01d14ac02
IN: acf360d7529a42be1f132f74745a940da9e823f2
AD: 1489ca8d852f0a8547dbe8bc
CT: 2e8718372d6e8167213cf112dc41c80377244f5a
TAG: e4f31e8f84b9356999dc60989009e698

KEY: 9357cecd10bab8d2e42ed88c0386204827c3b76e9e51150d09fd4e3b4e0e1e6f
NONCE: 81f2106a5379e0ed861cf76b3cf95afb17515478b5cbcae9
IN: ee51a0f25d091288b5e2b91ad11d491329e48b35a18a3a8685
AD: b80cb677f4b409cd1537363b
CT: f681f19fa8de1fdea3538001a46f30fa6333b76d6439337e68
TAG: afad5e6d282d9df6d8119c32237b3e60

KEY: 9f868600fbf81e40398b7dfb201fcae35d34bba10908860b0b2bf8b942b4e8fa
NONCE: 2ddcc13c97185614095d437900b8c0a9170e0a4a50e46ba5
IN: 133fa3ac176fee6df67472752e41c6834f13300c0064ff5b190f903b7ac7
AD: 0d61321fbee8bb1f3f5cb454
CT: b93abb311ec0bf018dc300c7d511b42ade72780373186e231820b44f22f0
TAG: f8bd2f649a337783ff911e37966037bd

KEY: 05affcdfce0a28539924370db8d80a78b835254778ec41acbff52bfab092fa33
NONCE: 3edaeb185f7273b1a7cccba54f84c5f7d6583433b49d3694
IN: 7657581faad266cc1037962a380c8aa5306f88000427d0a05397696b503790ad2643c6
AD: d7c213e9e6f4a40f3e5b662c
CT: 5eb19080aadc89f2329da4f5c41dc60568651c424c1b05d827f2bfb8dbff42c5a08224
TAG: 2da20087b5674f0b967d1baa664bbd82

KEY: 645ed60ec74ddfe1f02694792db4436c262d20405d8645cd9755d64876219799
NONCE: d83665b44c1fdf567299f2b8501e9c0e7ae2dda0bb8f2c82
IN: ceee69d32ad4667a00909964d9611bf34fd98be41ad7f0feaaaff8169060d64cf310c13bcb9394cf
AD: 57379f8f44191ec9cf3b1a07
CT: 4496a0666f0f895ebce224b448a04502f2ae7b354d868b7c54295bf051162e82c530c767d1ffd2cc
TAG: 1ffc56da4fb961ffdfabe66d82ec8f29

KEY: 06624c9a75bb7dbe224a3f23791281f53c40b407a14161a3f82f34924623dc02
NONCE: e647b8b4739bf542a81d72d695e1cd6ba348fa593987ac47
IN: 2658763f8d70e8c3303582d66ba3d736ce9d407e9507f6c6627e382d0144da157d73d0aee10ef034083cdd9013
AD: 75536443a6c2189a57d553bb
CT: 305cab5c2f9a6edccac307d6965febe3c86f2a1e31ac8c74e88924a10c2a29106bce980c803b7886985bba8ec5
TAG: 8c12bb58c84175b9f601b704d0f8a25c

KEY: 63aeb46083100bbcc430f4f09bcc34410df9cfd5883d629e4af8645ffabb89c2
NONCE: b09830874dc549195a5d6da93b9dcc12aa1ec8af201c96bd
IN: 1b3c9050e0a062f5a5cff7bec8706864cf8648142ec5cb1f9867ace384e9b2bba33aab8dc83e83b2d2fac70cd5189f2b5ab5
AD: 7dcc05b0940198bd5c68cdf1
CT: d8b22e5d381de08a50b163c00dbbca6c07d61c80199cebd52234c7bd4f7ed0a90d47ef05617cdb8e3f782875ae629c0f0ad6
TAG: 194077f0e6d415bf7307d171e8484a9c

KEY: 4826c1bf8b48088fece4008922173c500ff45790f945b1027f36110da4fecc92
NONCE: 3a78fc7397944d762303b0a75974ac92a60e250bf112600a
IN: d26e3a2b92120ff8056bb992660cc8a2364792589c16a518b8d232b8184aed05ba8d4fd0b2ad2b928cd873e11905a21ffece5f1e63c974
AD: 904d2cd3e50f7bfb9352f142
CT: 21f4cf679662fad36f57945fc0c0753c3791261eb58d643278dfe1f14bfb585c5a01370ba96f18dc3f6b6945a2c6997330b24f12f5219a
TAG: 95397c54428f9d069c511b5c82e0151c

KEY: ec526c03d8a08e8a63751112428a76399c399e8b83d98c9247c73164805ac8fe
NONCE: 2cc1a6ae89c2a091415fa2964b44a0e5da629d40d77b77f1
IN: 567377f5b6df5442e70bc9a31bc450bd4febfcf89d7ca611353c7e612d8b7e36e859f6365ec7e5e99e9e0e882532666dd7203d06f6e25439ed871237
AD: 35575b56716868b66cd21e24
CT: 6b738274fe974438f1f5fca8ef1ee7df664f1e72bc54ccd3fb58c4a3df67ef9a73261df41ffe9c52aeafc8be4f6524baf9efb1558d4a57defec7bee3
TAG: 92599d4b14a795e8c375ec2a8960b4dc

Changes to jni/libressl/tls/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2020 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|


|







1
2
3
4
5
6
7
8
9
10
11
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261


262
263
264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@


CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@

EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@







<
<



















>
>










>







234
235
236
237
238
239
240


241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`


am__DIST_COMMON = $(srcdir)/Makefile.in \
	$(top_srcdir)/Makefile.am.common $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = true
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = true
AUTOHEADER = true
AUTOMAKE = true
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \







<







681
682
683
684
685
686
687

688
689
690
691
692
693
694
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
Changes to jni/libressl/tls/VERSION.
1
25:0:0
|
1
26:0:0