You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "ThePassionate (via GitHub)" <gi...@apache.org> on 2023/08/18 01:55:35 UTC

[GitHub] [nuttx] ThePassionate opened a new pull request, #10260: crypto: update aes algorithm process

ThePassionate opened a new pull request, #10260:
URL: https://github.com/apache/nuttx/pull/10260

   (1)update iv in each encryption process
   (2)support aes-ofb/aes-cfb128/aes-cfb8
   Signed-off-by: makejian <ma...@xiaomi.com>
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #10260: crypto: update aes algorithm process

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #10260:
URL: https://github.com/apache/nuttx/pull/10260#discussion_r1299186728


##########
crypto/xform.c:
##########
@@ -638,6 +684,109 @@ int aes_xts_setkey(FAR void *sched, FAR uint8_t *key, int len)
   return 0;
 }
 
+void aes_ofb_encrypt(caddr_t key, FAR uint8_t *data)
+{
+  FAR struct aes_ofb_ctx *ctx;
+  int i;
+
+  ctx = (FAR struct aes_ofb_ctx *)key;
+
+  aes_encrypt(&ctx->ac_key, ctx->iv, ctx->iv);
+  for (i = 0; i < AESOFB_IVSIZE; i++)
+    {
+      data[i] ^= ctx->iv[i];
+    }
+}
+
+int aes_ofb_setkey(FAR void *sched, FAR uint8_t *key, int len)
+{
+  FAR struct aes_ctr_ctx *ctx;

Review Comment:
   ```suggestion
     FAR struct aes_ofb_ctx *ctx;
   ```



##########
crypto/xform.c:
##########
@@ -638,6 +684,109 @@ int aes_xts_setkey(FAR void *sched, FAR uint8_t *key, int len)
   return 0;
 }
 
+void aes_ofb_encrypt(caddr_t key, FAR uint8_t *data)
+{
+  FAR struct aes_ofb_ctx *ctx;
+  int i;
+
+  ctx = (FAR struct aes_ofb_ctx *)key;
+
+  aes_encrypt(&ctx->ac_key, ctx->iv, ctx->iv);
+  for (i = 0; i < AESOFB_IVSIZE; i++)
+    {
+      data[i] ^= ctx->iv[i];
+    }
+}
+
+int aes_ofb_setkey(FAR void *sched, FAR uint8_t *key, int len)
+{
+  FAR struct aes_ctr_ctx *ctx;
+
+  ctx = (FAR struct aes_ctr_ctx *)sched;

Review Comment:
   ```suggestion
     ctx = (FAR struct aes_ofb_ctx *)sched;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 merged pull request #10260: crypto: update aes algorithm process

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #10260:
URL: https://github.com/apache/nuttx/pull/10260


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org