Commit Graph

20741 Commits

Author SHA1 Message Date
Naoki MATSUMOTO cd4865d88c std.crypto.sign.ecdsa: accepts unusual parameters like EcdsaP384Sha256 (#13302)
This commit accepts unusual parameters like EcdsaP384Sha256.
Some certifictes(below certs are in /etc/ssl/certs/ca-certificates.crt on Ubuntu 22.04) use EcdsaP384Sha256 to sign itself.
- Subject: C=GR, L=Athens, O=Hellenic Academic and Research Institutions Cert. Authority, CN=Hellenic Academic and Research Institutions ECC RootCA 2015
- Subject: C=US, ST=Texas, L=Houston, O=SSL Corporation, CN=SSL.com EV Root Certification Authority ECC
- Subject: C=US, ST=Texas, L=Houston, O=SSL Corporation, CN=SSL.com Root Certification Authority ECC

In verify(), hash array `h` is allocated to be larger than the scalar.encoded_length.
The array is regarded as big-endian.
Hash values are filled in the back of the array and the rest bytes in front are filled with zero.

In sign(), the hash array is allocated and filled as same as verify().
In deterministicScalar(), hash bytes are insufficient to generate `k`
To generate `k` without narrowing its value range,
this commit uses algorithm stage h. in  "Section 3.2 Generation of k" in RFC6979.
2022-10-26 13:18:06 +02:00
Frank Denis 22b71b1376 crypto/bcrypt: don't reimplement base64, just use a custom alphabet
Now that std.base64 supports everything bcrypt needs to encode its
parameters, we don't need to include another implementation.
2022-10-25 21:52:03 -07:00
Jacob Young 55c5da1b20 fmt: fix f80 hex formatting
These ifs were missing a case for f80 which should have shifted by one,
but we can just compute the correct value instead.  Also, we want the
fractional bits to be a multiple of four, not the mantissa bits, since
the mantissa could have a leading one which we want to be separated.
2022-10-25 09:04:04 -07:00
Andrew Kelley b3cd38ea4a link: add an explicit error set for flush() and flushModule()
This makes it easier to understand how control flow should happen in
various cases; already just by doing this it is revealed that
UndefinedSymbol and UndefinedSymbolReference should be merged, and that
MissingMainEntrypoint should be removed in favor of the ErrorFlags
mechanism thath we already have for missing the main entrypoint.

The main motivation for this change, however, is preventing a compile
error when there is conditional compilation inside linker
implementations, causing the flush() error set to depend on compilation
options. With this change, the error set is fixed, and, notably, the
`-Donly-c` flag no longer has compilation errors due to this error set.
2022-10-24 23:30:57 -07:00
Andrew Kelley 4f04759c87 build: add -Donly-c option
This option can be used to produce a C backend build of the self-hosted
compiler, which only has the C backend enabled. Once the C backend is
capable of self-hosting, this will be a way for us to replace our stage1
codebase with a C backend build of self-hosted, which we can then use
for bootstrapping. See #5246 for more details.

Using this option right now results in a crash because the C backend is
not yet passing all the behavior tests.
2022-10-23 20:05:12 -07:00
Jakub Konka 828735ac03 macho: handle majority of DW_FORM_ values for DWARF4 in the linker 2022-10-23 21:53:36 +02:00
Andrew Kelley 04472af328 Merge pull request #13251 from Vexu/c-abi
implement ARM C ABI, separate C ABI tests from standalone tests
2022-10-23 12:16:58 -07:00
Andrew Kelley a3033c7bd9 Merge pull request #13267 from ziglang/macho-threaded-sha256
link.MachO: multi-thread first round of sha256 hashing
2022-10-23 11:35:03 -07:00
Jakub Konka 2f37278540 macho: temp hash buffer has to live as long as pread error resolution 2022-10-23 10:15:42 +02:00
Jakub Konka 1bbafbc65f macho: increment temp buffer when calculating hashes 2022-10-23 09:58:47 +02:00
Andrew Kelley 0ae60f7236 CMake: detect use of CMAKE_PREFIX_PATH env var
CMake recognizes the CMAKE_PREFIX_PATH environment variable for some
things, and also the CMAKE_PREFIX_PATH cache variable for other things.
However, it does not relate these two things, i.e. if the environment
variable is set, CMake does not populate the cache variable in a
corresponding manner. Some package systems, such as Homebrew, set the
environment variable but not the cache variable. Furthermore, the
environment variable follows the system path separator, such as ':' on
POSIX and ';' on Windows, but the cache variable follows CMake's array
behavior, i.e. always ';' for a separator.

Closes #13242
2022-10-22 20:30:08 -07:00
Andrew Kelley f82a82f889 Revert "fix CI failures with commit "ci: make directory structure in releases consistent""
This reverts commit 54c8861bc4.

This caused CI failure.
2022-10-22 20:29:24 -07:00
Eric Joldasov 54c8861bc4 fix CI failures with commit "ci: make directory structure in releases consistent" 2022-10-22 16:43:35 -07:00
Andrew Kelley 4a2f1e748e link.MachO: multi-thread first round of sha256 hashing
when computing the adhoc code signature
2022-10-22 16:03:59 -07:00
Veikka Tuominen f2a7aba586 x86_64 llvm: correct lowering of ptr sized float struct
Closes #13211
2022-10-22 22:00:59 +03:00
Andrew Kelley e67c756b91 Merge pull request #13260 from ziglang/zld-sync
macho: faster and more memory efficient linker
2022-10-22 10:14:46 -07:00
Veikka Tuominen be10f95994 ARM C ABI: workaround i128 issues 2022-10-22 19:32:56 +03:00
Jan Philipp Hafer 776f7de967 update compiler_rt README and prettify it
This documents status of routines and adds the next work item
"Decimal float library routines", which are only recommended for
binary data. Complete absence of tests is also documented.
This does not document the various aliases, e.g. those for ARM.

Missing Integer library routines:
- __addvsi3
- __addvdi3
- __addvti3
- __addvdi3
- __addvti3
- __subvsi3
- __subvdi3
- __subvti3
- __subvdi3
- __subvti3
- __mulvsi3
- __mulvdi3
- __mulvti3
- __mulvdi3
- __mulvti3

Missing floating library routines:
- __powisf2
- __powidf2
- __powitf2
- __powixf2

Missing routines for symbol-level compatibility to gcc:
- __ashlsi3
- __ashrsi3
- __lshrsi3
2022-10-22 09:23:50 -07:00
Andrew Kelley 10b8c4d8f0 CI: drone: skip some ReleaseFast and ReleaseSmall std lib tests
Follow-up commit to b9103bd514.
2022-10-22 09:19:05 -07:00
Luuk de Gram cdf7e7dba9 fix: correctly import memcmp.zig in compiler-rt
cmp.zig was accidently being referenced twice, rather than importing
memcmp.zig. This means that its symbols were also not included in
the generated compiler-rt output.
2022-10-22 16:56:33 +02:00
Jakub Konka 593b75b109 macho: some docs 2022-10-22 14:53:53 +02:00
Veikka Tuominen 3f41979061 replace some panics with try in C ABI tests 2022-10-22 14:52:26 +03:00
Veikka Tuominen 5e0b4836a1 stage2: implement RISCV C ABI 2022-10-22 14:52:26 +03:00
Veikka Tuominen 8fa91939a8 build.zig: separate C ABI tests from standalone tests 2022-10-22 11:31:41 +03:00
Veikka Tuominen 12a2ccfb45 make C ABI tests compile on powerpc 2022-10-22 11:31:41 +03:00
Veikka Tuominen 031c768cc8 add C ABI tests for simd vectors 2022-10-22 11:31:41 +03:00
Jakub Konka 086cee844a macho: refactor dead code stripping conditions
1. If an object file was not compiled with `MH_SUBSECTIONS_VIA_SYMBOLS`
   such a hand-written ASM on x86_64, treat the entire object file as
   not suitable for dead code stripping aka a GC root.
2. If there are non-extern relocs within a section, treat the entire
   section as a root, at least temporarily until we work out the exact
   conditions for marking the atoms live.
2022-10-22 07:59:24 +02:00
Jakub Konka 0cc4d54781 macho: do not skip over SUBTRACTOR reloc when dead stripping 2022-10-22 07:59:24 +02:00
Jakub Konka f8cbe29a17 macho: fix incorrect lookup of symbols when calculating subtractors 2022-10-22 07:59:24 +02:00
Jakub Konka 93cc5496e1 macho: rewrite movq to leaq when TLV is not external pointer 2022-10-22 07:59:24 +02:00
Jakub Konka 5823f19c5e macho: gracefully handle uninitialized symtabs in objects 2022-10-22 07:59:24 +02:00
Jakub Konka 2c2ff4558f macho: fix handling of lack of subsections and tracking of inner symbols 2022-10-22 07:59:24 +02:00
Jakub Konka 5edb8e0b8f macho: relax SUBTRACTOR assumption it not being a defined global 2022-10-22 07:59:23 +02:00
Jakub Konka bc1e714de6 macho: revert changes to file descriptors mgmt 2022-10-22 07:59:23 +02:00
Jakub Konka 15f1e6a60c macho: fix silly error where we would incorrectly skip a valid binding 2022-10-22 07:59:23 +02:00
Jakub Konka c15e03ac79 macho: fix bug in incorrectly splicing nodes in trie 2022-10-22 07:59:23 +02:00
Jakub Konka 5b9eaf2938 macho: do not assume __la_symbol_ptr was created 2022-10-22 07:59:23 +02:00
Jakub Konka 33d1942f27 macho: always create __TEXT segment 2022-10-22 07:59:23 +02:00
Jakub Konka e70adc7f1a macho: skip parsing __eh_frame until we know how to handle it 2022-10-22 07:59:23 +02:00
Jakub Konka baceaf65f2 macho: fix incorrectly erroring out with multiple sym definition 2022-10-22 07:59:23 +02:00
Jakub Konka a32bc0e39c macho: fix 32bit build 2022-10-22 07:59:23 +02:00
Jakub Konka 04a590a171 macho: remove unused nlist flags 2022-10-22 07:59:23 +02:00
Jakub Konka d57639a308 macho: upstream rewritten traditional linker, zld
kubkon/zld gitrev 5733ed87abe2f07e1330c3232a252e9defec638a
2022-10-22 07:59:23 +02:00
Andrew Kelley 09236d29b7 Merge pull request #12837 from topolarity/err-ret-trace-improvements-1923
stage2: Pop error trace frames for handled errors (#1923)
2022-10-21 20:24:37 -07:00
Andrew Kelley b9103bd514 CI: drone: skip ReleaseSafe std lib tests that link libc
To save a little bit of time and keep under the 2 hour mark.
2022-10-21 19:28:46 -07:00
Louis Pearson 8d4778b4f9 Support compiling for the android NDK (#13245) 2022-10-21 18:32:56 -04:00
Andrew Kelley 3b2f0c3eee Revert "ci: make directory structure in releases consistent"
This reverts commit 28054d96f0.

This caused CI failures.
2022-10-21 13:18:37 -07:00
Cody Tapscott c36a2c27a5 Change how Block propagates (error return) trace index
Instead of adding 3 fields to every `Block`, this adds just one. The
function-level information is saved in the `Sema` struct instead,
which is created/copied more rarely.
2022-10-21 12:46:46 -07:00
Cody Tapscott 74b9cbd895 stage2: Skip test exposing #13175
This PR (#12873) in combination with this particular test exposed
a pre-existing bug (#13175).

This means that the test for #13038 has regressed
2022-10-21 12:40:33 -07:00
Cody Tapscott a4523a2d4a builtin.zig: Do not overwrite error frames when trace full
Previously, we'd overwrite the errors in a circular buffer. Now that
error return traces are intended to follow a stack discipline, we no
longer have to support the index rolling over. By treating the trace
like a saturating stack, any pop/restore code still behaves correctly
past-the-end of the trace.

As a bonus, this adds a small blurb to let the user know when the trace
saturated and x number of frames were dropped.
2022-10-21 12:40:33 -07:00