@@ -354,6 +354,22 @@ int ECCX08Class::ecdh(int slot, byte mode, const byte pubKeyXandY[], byte output
354
354
return 1 ;
355
355
}
356
356
357
+ /* * \brief AES_GCM encryption function, see
358
+ * NIST Special Publication 800-38D
359
+ * 7.1, using TempKey.
360
+ *
361
+ * \param[out] IV Initialization vector
362
+ * (12 bytes)
363
+ * \param[in] ad Associated data
364
+ * \param[in] pt Plaintext
365
+ * \param[out] ct Ciphertext
366
+ * \param[out] tag Authentication tag
367
+ * (16 bytes)
368
+ * \param[in] adLength The length of ad
369
+ * \param[in] ptLength The length of pt
370
+ *
371
+ * \return 1 on success, otherwise 0.
372
+ */
357
373
int ECCX08Class::AESEncrypt (byte IV[], byte ad[], byte pt[], byte ct[], byte tag[], const uint64_t adLength, const uint64_t ptLength)
358
374
{
359
375
byte H[16 ] = {0x00 };
@@ -415,6 +431,22 @@ int ECCX08Class::AESEncrypt(byte IV[], byte ad[], byte pt[], byte ct[], byte tag
415
431
return 1 ;
416
432
}
417
433
434
+ /* * \brief AES_GCM decryption function, see
435
+ * NIST Special Publication 800-38D
436
+ * 7.2, using TempKey.
437
+ *
438
+ * \param[in] IV Initialization vector
439
+ * (12 bytes)
440
+ * \param[in] ad Associated data
441
+ * \param[out] pt Plaintext
442
+ * \param[in] ct Ciphertext
443
+ * \param[in] tag Authentication tag
444
+ * (16 bytes)
445
+ * \param[in] adLength The length of ad
446
+ * \param[in] ctLength The length of ct
447
+ *
448
+ * \return 1 on success, otherwise 0.
449
+ */
418
450
int ECCX08Class::AESDecrypt (byte IV[], byte ad[], byte pt[], byte ct[], byte tag[], const uint64_t adLength, const uint64_t ctLength)
419
451
{
420
452
uint64_t maxLength = 1ull << 36 ;
0 commit comments