Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .wolfssl_known_macro_extras
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ _ABI64
_ABIO64
_ARCH_PPC64
_ARCH_PWR8
_CALL_ELF
_COMPILER_VERSION
_INTPTR_T_DECLARED
_LINUX_REFCOUNT_H
Expand Down
12 changes: 7 additions & 5 deletions linuxkm/module_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,13 +1325,11 @@ size_t wc_linuxkm_malloc_usable_size(void *ptr)
#ifdef CONFIG_HAVE_KPROBES
static typeof(find_vm_area) *find_vm_area_ptr = NULL;
if (find_vm_area_ptr == NULL) {
if (! wc_linuxkm_can_block())
return 0;
find_vm_area_ptr = my_kallsyms_lookup_name("find_vm_area");
if (find_vm_area_ptr == NULL)
return 0;
}
if (find_vm_area_ptr == NULL)
return 0;
else if (ptr == NULL)
if (ptr == NULL)
return 0;
else {
struct vm_struct *vm = find_vm_area_ptr(ptr);
Expand Down Expand Up @@ -1950,6 +1948,10 @@ static WC_MAYBE_UNUSED void *my_kallsyms_lookup_name(const char *name) {

if (! kallsyms_lookup_name_ptr) {
int ret;

if (! wc_linuxkm_can_block())
return NULL;

kallsyms_lookup_name_kp.addr = NULL;
if ((ret = register_kprobe(&kallsyms_lookup_name_kp)) != 0) {
#ifdef WOLFSSL_LINUXKM_VERBOSE_DEBUG
Expand Down
43 changes: 39 additions & 4 deletions wolfcrypt/src/port/arm/armv8-32-curve25519.S
Original file line number Diff line number Diff line change
Expand Up @@ -3677,6 +3677,33 @@ L_curve25519_inv_8:
ldr r1, [sp, #160]
ldr r0, [sp, #160]
bl fe_mul_op
# Ensure result is less than modulus
ldr r0, [sp, #160]
ldm r0, {r4, r5, r6, r7, r8, r9, r10, r11}
adds r2, r4, #19
adcs r2, r5, #0
adcs r2, r6, #0
adcs r2, r7, #0
adcs r2, r8, #0
adcs r2, r9, #0
adcs r2, r10, #0
adc r2, r11, #0
asr r2, r2, #31
and r2, r2, #19
adds r4, r4, r2
adcs r5, r5, #0
adcs r6, r6, #0
adcs r7, r7, #0
adcs r8, r8, #0
adcs r9, r9, #0
adcs r10, r10, #0
adc r11, r11, #0
#if defined(WOLFSSL_ARM_ARCH) && (WOLFSSL_ARM_ARCH < 7)
bic r11, r11, #0x80000000
#else
bfc r11, #31, #1
#endif
stm r0, {r4, r5, r6, r7, r8, r9, r10, r11}
mov r0, #0
add sp, sp, #0xbc
pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}
Expand Down Expand Up @@ -3959,21 +3986,29 @@ L_curve25519_inv_8:
# Ensure result is less than modulus
ldr r0, [sp, #176]
ldm r0, {r4, r5, r6, r7, r8, r9, r10, r11}
mov r2, #19
and r2, r2, r11, asr #31
adds r2, r4, #19
adcs r2, r5, #0
adcs r2, r6, #0
adcs r2, r7, #0
adcs r2, r8, #0
adcs r2, r9, #0
adcs r2, r10, #0
adc r2, r11, #0
asr r2, r2, #31
and r2, r2, #19
adds r4, r4, r2
adcs r5, r5, #0
adcs r6, r6, #0
adcs r7, r7, #0
adcs r8, r8, #0
adcs r9, r9, #0
adcs r10, r10, #0
adc r11, r11, #0
#if defined(WOLFSSL_ARM_ARCH) && (WOLFSSL_ARM_ARCH < 7)
bic r11, r11, #0x80000000
#else
bfc r11, #31, #1
#endif
adcs r10, r10, #0
adc r11, r11, #0
stm r0, {r4, r5, r6, r7, r8, r9, r10, r11}
mov r0, #0
add sp, sp, #0xc0
Expand Down
43 changes: 39 additions & 4 deletions wolfcrypt/src/port/arm/armv8-32-curve25519_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -4082,6 +4082,33 @@ WC_OMIT_FRAME_POINTER int curve25519(byte* r, const byte* n, const byte* a)
"ldr r1, [sp, #160]\n\t"
"ldr r0, [sp, #160]\n\t"
"bl fe_mul_op\n\t"
/* Ensure result is less than modulus */
"ldr %[r], [sp, #160]\n\t"
"ldm %[r], {r4, r5, r6, r7, r8, r9, r10, r11}\n\t"
"adds %[a], r4, #19\n\t"
"adcs %[a], r5, #0\n\t"
"adcs %[a], r6, #0\n\t"
"adcs %[a], r7, #0\n\t"
"adcs %[a], r8, #0\n\t"
"adcs %[a], r9, #0\n\t"
"adcs %[a], r10, #0\n\t"
"adc %[a], r11, #0\n\t"
"asr %[a], %[a], #31\n\t"
"and %[a], %[a], #19\n\t"
"adds r4, r4, %[a]\n\t"
"adcs r5, r5, #0\n\t"
"adcs r6, r6, #0\n\t"
"adcs r7, r7, #0\n\t"
"adcs r8, r8, #0\n\t"
"adcs r9, r9, #0\n\t"
"adcs r10, r10, #0\n\t"
"adc r11, r11, #0\n\t"
#if defined(WOLFSSL_ARM_ARCH) && (WOLFSSL_ARM_ARCH < 7)
"bic r11, r11, #0x80000000\n\t"
#else
"bfc r11, #31, #1\n\t"
#endif
"stm %[r], {r4, r5, r6, r7, r8, r9, r10, r11}\n\t"
"mov r0, #0\n\t"
"add sp, sp, #0xbc\n\t"
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
Expand Down Expand Up @@ -4392,21 +4419,29 @@ WC_OMIT_FRAME_POINTER int curve25519(byte* r, const byte* n, const byte* a)
/* Ensure result is less than modulus */
"ldr %[r], [sp, #176]\n\t"
"ldm %[r], {r4, r5, r6, r7, r8, r9, r10, r11}\n\t"
"mov %[a], #19\n\t"
"and %[a], %[a], r11, asr #31\n\t"
"adds %[a], r4, #19\n\t"
"adcs %[a], r5, #0\n\t"
"adcs %[a], r6, #0\n\t"
"adcs %[a], r7, #0\n\t"
"adcs %[a], r8, #0\n\t"
"adcs %[a], r9, #0\n\t"
"adcs %[a], r10, #0\n\t"
"adc %[a], r11, #0\n\t"
"asr %[a], %[a], #31\n\t"
"and %[a], %[a], #19\n\t"
"adds r4, r4, %[a]\n\t"
"adcs r5, r5, #0\n\t"
"adcs r6, r6, #0\n\t"
"adcs r7, r7, #0\n\t"
"adcs r8, r8, #0\n\t"
"adcs r9, r9, #0\n\t"
"adcs r10, r10, #0\n\t"
"adc r11, r11, #0\n\t"
#if defined(WOLFSSL_ARM_ARCH) && (WOLFSSL_ARM_ARCH < 7)
"bic r11, r11, #0x80000000\n\t"
#else
"bfc r11, #31, #1\n\t"
#endif
"adcs r10, r10, #0\n\t"
"adc r11, r11, #0\n\t"
"stm %[r], {r4, r5, r6, r7, r8, r9, r10, r11}\n\t"
"mov r0, #0\n\t"
"add sp, sp, #0xc0\n\t"
Expand Down
Loading
Loading