Skip to content

chore(p256-m): add explicit uint16_t cast in u32_muladd64#2

Open
stgloorious wants to merge 1 commit intompg:masterfrom
stgloorious:chore/fix-uint16-cast
Open

chore(p256-m): add explicit uint16_t cast in u32_muladd64#2
stgloorious wants to merge 1 commit intompg:masterfrom
stgloorious:chore/fix-uint16-cast

Conversation

@stgloorious
Copy link

When splitting 32-bit x and y values into lower and higher 16-bit values, make sure to explicitly cast the higher part to uint16_t as well. This fixes the compiler warning:

src/common/crypto_p256.c: In function ‘u32_muladd64’: src/common/crypto_p256.c:264:29: warning: conversion from ‘uint32_t’ {aka ‘unsigned int’} to ‘uint16_t’ {aka ‘const short unsigned int’} may change value [-Wconversio]
  264 |         const uint16_t xh = x >> 16;
      |                             ^
src/common/crypto_p256.c:265:29: warning: conversion from ‘uint32_t’ {aka ‘unsigned int’} to ‘uint16_t’ {aka ‘const short unsigned int’} may change value [-Wconversio]
  265 |         const uint16_t yh = y >> 16;
      |                             ^

When splitting 32-bit x and y values into lower and higher
16-bit values, make sure to explicitly cast the higher
part to uint16_t as well. This fixes the compiler warning:

src/common/crypto_p256.c: In function ‘u32_muladd64’:
src/common/crypto_p256.c:264:29: warning: conversion from
‘uint32_t’ {aka ‘unsigned int’} to ‘uint16_t’ {aka ‘const
short unsigned int’} may change value [-Wconversio]
  264 |         const uint16_t xh = x >> 16;
      |                             ^

src/common/crypto_p256.c:265:29: warning: conversion from
‘uint32_t’ {aka ‘unsigned int’} to ‘uint16_t’ {aka ‘const
short unsigned int’} may change value [-Wconversio]
  265 |         const uint16_t yh = y >> 16;
      |                             ^

Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments