mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
core/crypto/_fiat/field_poly1305: Mark more functions contextless
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package field_poly1305
|
package field_poly1305
|
||||||
|
|
||||||
|
import "base:intrinsics"
|
||||||
import "core:encoding/endian"
|
import "core:encoding/endian"
|
||||||
import "core:mem"
|
import "core:mem"
|
||||||
|
|
||||||
@@ -15,7 +16,11 @@ fe_tighten_cast :: #force_inline proc "contextless" (
|
|||||||
return transmute(^Tight_Field_Element)(arg1)
|
return transmute(^Tight_Field_Element)(arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fe_from_bytes :: #force_inline proc(out1: ^Tight_Field_Element, arg1: []byte, arg2: byte) {
|
fe_from_bytes :: #force_inline proc "contextless" (
|
||||||
|
out1: ^Tight_Field_Element,
|
||||||
|
arg1: []byte,
|
||||||
|
arg2: byte,
|
||||||
|
) {
|
||||||
// fiat-crypto's deserialization routine effectively processes a
|
// fiat-crypto's deserialization routine effectively processes a
|
||||||
// single byte at a time, and wants 256-bits of input for a value
|
// single byte at a time, and wants 256-bits of input for a value
|
||||||
// that will be 128-bits or 129-bits.
|
// that will be 128-bits or 129-bits.
|
||||||
@@ -24,7 +29,9 @@ fe_from_bytes :: #force_inline proc(out1: ^Tight_Field_Element, arg1: []byte, ar
|
|||||||
// makes implementing the actual MAC block processing considerably
|
// makes implementing the actual MAC block processing considerably
|
||||||
// neater.
|
// neater.
|
||||||
|
|
||||||
assert(len(arg1) == 16)
|
if len(arg1) != 16 {
|
||||||
|
intrinsics.trap()
|
||||||
|
}
|
||||||
|
|
||||||
// While it may be unwise to do deserialization here on our
|
// While it may be unwise to do deserialization here on our
|
||||||
// own when fiat-crypto provides equivalent functionality,
|
// own when fiat-crypto provides equivalent functionality,
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ _subborrowx_u43 :: #force_inline proc "contextless" (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fe_carry_mul :: proc(out1: ^Tight_Field_Element, arg1, arg2: ^Loose_Field_Element) {
|
fe_carry_mul :: proc "contextless" (out1: ^Tight_Field_Element, arg1, arg2: ^Loose_Field_Element) {
|
||||||
x2, x1 := bits.mul_u64(arg1[2], (arg2[2] * 0x5))
|
x2, x1 := bits.mul_u64(arg1[2], (arg2[2] * 0x5))
|
||||||
x4, x3 := bits.mul_u64(arg1[2], (arg2[1] * 0xa))
|
x4, x3 := bits.mul_u64(arg1[2], (arg2[1] * 0xa))
|
||||||
x6, x5 := bits.mul_u64(arg1[1], (arg2[2] * 0xa))
|
x6, x5 := bits.mul_u64(arg1[1], (arg2[2] * 0xa))
|
||||||
@@ -144,7 +144,7 @@ fe_carry_mul :: proc(out1: ^Tight_Field_Element, arg1, arg2: ^Loose_Field_Elemen
|
|||||||
out1[2] = x62
|
out1[2] = x62
|
||||||
}
|
}
|
||||||
|
|
||||||
fe_carry_square :: proc(out1: ^Tight_Field_Element, arg1: ^Loose_Field_Element) {
|
fe_carry_square :: proc "contextless" (out1: ^Tight_Field_Element, arg1: ^Loose_Field_Element) {
|
||||||
x1 := (arg1[2] * 0x5)
|
x1 := (arg1[2] * 0x5)
|
||||||
x2 := (x1 * 0x2)
|
x2 := (x1 * 0x2)
|
||||||
x3 := (arg1[2] * 0x2)
|
x3 := (arg1[2] * 0x2)
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ reset :: proc(ctx: ^Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
_blocks :: proc(ctx: ^Context, msg: []byte, final := false) {
|
_blocks :: proc "contextless" (ctx: ^Context, msg: []byte, final := false) {
|
||||||
n: field.Tight_Field_Element = ---
|
n: field.Tight_Field_Element = ---
|
||||||
final_byte := byte(!final)
|
final_byte := byte(!final)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user