Skip to content

Commit

Permalink
Merge branch 'main' into dmr/mypy-crypto_generichash
Browse files Browse the repository at this point in the history
  • Loading branch information
DMRobertson authored Nov 30, 2021
2 parents 3227a9b + 494f3df commit 7f4a039
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Setup python
uses: actions/setup-python@v2.3.0
uses: actions/setup-python@v2.3.1
with:
python-version: ${{ matrix.PYTHON.VERSION }}
- name: Install tox and coverage
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Setup python
uses: actions/setup-python@v2.3.0
uses: actions/setup-python@v2.3.1
with:
python-version: ${{ matrix.PYTHON.VERSION }}
- name: Install tox and coverage
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Setup python
uses: actions/setup-python@v2.3.0
uses: actions/setup-python@v2.3.1
with:
python-version: ${{ matrix.PYTHON.VERSION }}
architecture: ${{ matrix.WINDOWS.ARCH }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Setup python
uses: actions/setup-python@v2.3.0
uses: actions/setup-python@v2.3.1
with:
python-version: ${{ matrix.PYTHON.VERSION }}
architecture: ${{ matrix.WINDOWS.ARCH }}
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ignore_missing_imports = true
module = [
"nacl.bindings.crypto_aead",
"nacl.bindings.crypto_box",
"nacl.bindings.crypto_core",
"nacl.bindings.crypto_generichash",
"nacl.encoding",
"nacl.exceptions",
Expand Down Expand Up @@ -69,6 +70,7 @@ strict_equality = true
module = [
"nacl.encoding",
"nacl.exceptions",
"nacl.utils",
]
disallow_any_expr = true
warn_return_any = true
Expand Down
20 changes: 10 additions & 10 deletions src/nacl/bindings/crypto_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)


def crypto_core_ed25519_is_valid_point(p):
def crypto_core_ed25519_is_valid_point(p: bytes) -> bool:
"""
Check if ``p`` represents a point on the edwards25519 curve, in canonical
form, on the main subgroup, and that the point doesn't have a small order.
Expand Down Expand Up @@ -61,7 +61,7 @@ def crypto_core_ed25519_is_valid_point(p):
return rc == 1


def crypto_core_ed25519_add(p, q):
def crypto_core_ed25519_add(p: bytes, q: bytes) -> bytes:
"""
Add two points on the edwards25519 curve.
Expand Down Expand Up @@ -102,7 +102,7 @@ def crypto_core_ed25519_add(p, q):
return ffi.buffer(r, crypto_core_ed25519_BYTES)[:]


def crypto_core_ed25519_sub(p, q):
def crypto_core_ed25519_sub(p: bytes, q: bytes) -> bytes:
"""
Subtract a point from another on the edwards25519 curve.
Expand Down Expand Up @@ -143,7 +143,7 @@ def crypto_core_ed25519_sub(p, q):
return ffi.buffer(r, crypto_core_ed25519_BYTES)[:]


def crypto_core_ed25519_scalar_invert(s):
def crypto_core_ed25519_scalar_invert(s: bytes) -> bytes:
"""
Return the multiplicative inverse of integer ``s`` modulo ``L``,
i.e an integer ``i`` such that ``s * i = 1 (mod L)``, where ``L``
Expand Down Expand Up @@ -182,7 +182,7 @@ def crypto_core_ed25519_scalar_invert(s):
return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]


def crypto_core_ed25519_scalar_negate(s):
def crypto_core_ed25519_scalar_negate(s: bytes) -> bytes:
"""
Return the integer ``n`` such that ``s + n = 0 (mod L)``, where ``L``
is the order of the main subgroup.
Expand Down Expand Up @@ -217,7 +217,7 @@ def crypto_core_ed25519_scalar_negate(s):
return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]


def crypto_core_ed25519_scalar_complement(s):
def crypto_core_ed25519_scalar_complement(s: bytes) -> bytes:
"""
Return the complement of integer ``s`` modulo ``L``, i.e. an integer
``c`` such that ``s + c = 1 (mod L)``, where ``L`` is the order of
Expand Down Expand Up @@ -253,7 +253,7 @@ def crypto_core_ed25519_scalar_complement(s):
return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]


def crypto_core_ed25519_scalar_add(p, q):
def crypto_core_ed25519_scalar_add(p: bytes, q: bytes) -> bytes:
"""
Add integers ``p`` and ``q`` modulo ``L``, where ``L`` is the order of
the main subgroup.
Expand Down Expand Up @@ -294,7 +294,7 @@ def crypto_core_ed25519_scalar_add(p, q):
return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]


def crypto_core_ed25519_scalar_sub(p, q):
def crypto_core_ed25519_scalar_sub(p: bytes, q: bytes) -> bytes:
"""
Subtract integers ``p`` and ``q`` modulo ``L``, where ``L`` is the
order of the main subgroup.
Expand Down Expand Up @@ -335,7 +335,7 @@ def crypto_core_ed25519_scalar_sub(p, q):
return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]


def crypto_core_ed25519_scalar_mul(p, q):
def crypto_core_ed25519_scalar_mul(p: bytes, q: bytes) -> bytes:
"""
Multiply integers ``p`` and ``q`` modulo ``L``, where ``L`` is the
order of the main subgroup.
Expand Down Expand Up @@ -376,7 +376,7 @@ def crypto_core_ed25519_scalar_mul(p, q):
return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]


def crypto_core_ed25519_scalar_reduce(s):
def crypto_core_ed25519_scalar_reduce(s: bytes) -> bytes:
"""
Reduce integer ``s`` to ``s`` modulo ``L``, where ``L`` is the order
of the main subgroup.
Expand Down

0 comments on commit 7f4a039

Please sign in to comment.