Skip to content

Commit

Permalink
Merge branch 'vlang:master' into fix-vinit_caller
Browse files Browse the repository at this point in the history
  • Loading branch information
kbkpbot authored Jan 19, 2025
2 parents 9ea8525 + a93d94a commit 3e66827
Show file tree
Hide file tree
Showing 55 changed files with 798 additions and 6,610 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/toml_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ jobs:
run: make -j4 && ./v symlink
- name: Install dependencies
run: |
v retry -- sudo apt update
v retry -- sudo apt install --quiet -y jq libgc-dev
v retry -- v download https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64
sudo chmod 755 jq-linux64
sudo mv jq-linux64 /usr/bin/jq
- name: Show JQ Version
run: jq --version
Expand Down
5 changes: 3 additions & 2 deletions cmd/tools/modules/testing/common.v
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
skip_files << 'vlib/v/tests/websocket_logger_interface_should_compile_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/ecdsa_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/util_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ecdsa_seed_test.v' // requires OpenSSL
$if tinyc {
skip_files << 'examples/database/orm.v' // try fix it
}
Expand All @@ -273,8 +274,6 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
if !os.exists('/usr/local/include/wkhtmltox/pdf.h') {
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
}
skip_files << 'vlib/vweb/vweb_app_test.v' // imports the `sqlite` module, which in turn includes sqlite3.h
skip_files << 'vlib/x/vweb/tests/vweb_app_test.v' // imports the `sqlite` module, which in turn includes sqlite3.h
skip_files << 'vlib/veb/tests/veb_app_test.v' // imports the `sqlite` module, which in turn includes sqlite3.h
}
$if !macos {
Expand All @@ -284,13 +283,15 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
skip_files << 'vlib/crypto/ecdsa/ecdsa_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/util_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ecdsa_seed_test.v' // requires OpenSSL
skip_files << 'vlib/x/ttf/ttf_test.v'
skip_files << 'vlib/encoding/iconv/iconv_test.v' // needs libiconv to be installed
}
if github_job == 'tests-sanitize-memory-clang' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
skip_files << 'vlib/crypto/ecdsa/ecdsa_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/util_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ecdsa_seed_test.v' // requires OpenSSL
// Fails compilation with: `/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
skip_files << 'examples/sokol/sounds/simple_sin_tones.v'
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/tools/vtest-self.v
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ const skip_on_ubuntu_musl = [
'vlib/v/tests/websocket_logger_interface_should_compile_test.v',
'vlib/v/tests/fns/fn_literal_type_test.v',
'vlib/x/sessions/tests/db_store_test.v',
'vlib/x/vweb/tests/vweb_test.v',
'vlib/x/vweb/tests/vweb_app_test.v',
'vlib/veb/tests/veb_app_test.v',
]
const skip_on_linux = [
Expand Down
33 changes: 32 additions & 1 deletion vlib/crypto/ecdsa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,38 @@

`ecdsa` module for V language. Its a wrapper on top of openssl ecdsa functionality.
Its currently (expanded) to support the following curves:

- NIST P-256 curve, commonly referred as prime256v1 or secp256r1
- NIST P-384 curve, commonly referred as secp384r1
- NIST P-521 curve, commonly referred as secp521r1
- A famous Bitcoin curve, commonly referred as secp256k1
- A famous Bitcoin curve, commonly referred as secp256k1

> [!CAUTION]
> This module using low level OpenSSL opaque methods that mostly has been deprecated
> in OpenSSL 3.0.
> Please be aware, likely it would not compile with `-cstrict` options until
> its migrated into supported higher level API.

# Example
```v
import crypto.ecdsa
fn main() {
// create default NIST P-256 secp256r1 curve key pair. If you wish to generate another curve,
// use: `pbkey, pvkey := ecdsa.generate_key(nid: .secp521r1)!` instead.
pbkey, pvkey := ecdsa.generate_key()!
message_tobe_signed := 'Hello ecdsa'.bytes()
// create a signature with the recommended hash
signature := pvkey.sign(message_tobe_signed)!
// verify the message with the signature
verified := pbkey.verify(message_tobe_signed, signature)!
dump(verified) // should be true
// free allocated keys when you have done with your work.
pbkey.free()
pvkey.free()
}
```
Loading

0 comments on commit 3e66827

Please sign in to comment.