@@ -8512,9 +8512,9 @@ int aes_setkey(aes_context *ctx, // AES context provided by our caller
8512
8512
}
8513
8513
8514
8514
#if AES_DECRYPTION
8515
- if (mode == DECRYPT ) // expand our key for encryption or decryption
8515
+ if (mode == MG_DECRYPT ) // expand our key for encryption or decryption
8516
8516
return (aes_set_decryption_key(ctx, key, keysize));
8517
- else /* ENCRYPT */
8517
+ else /* MG_ENCRYPT */
8518
8518
#endif /* AES_DECRYPTION */
8519
8519
return (aes_set_encryption_key(ctx, key, keysize));
8520
8520
}
@@ -8545,7 +8545,7 @@ int aes_cipher(aes_context *ctx, const uchar input[16], uchar output[16]) {
8545
8545
8546
8546
#if AES_DECRYPTION // whether AES decryption is supported
8547
8547
8548
- if (ctx->mode == DECRYPT ) {
8548
+ if (ctx->mode == MG_DECRYPT ) {
8549
8549
for (i = (ctx->rounds >> 1) - 1; i > 0; i--) {
8550
8550
AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3);
8551
8551
AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3);
@@ -8572,7 +8572,7 @@ int aes_cipher(aes_context *ctx, const uchar input[16], uchar output[16]) {
8572
8572
((uint32_t) RSb[(Y2 >> 8) & 0xFF] << 8) ^
8573
8573
((uint32_t) RSb[(Y1 >> 16) & 0xFF] << 16) ^
8574
8574
((uint32_t) RSb[(Y0 >> 24) & 0xFF] << 24);
8575
- } else /* ENCRYPT */
8575
+ } else /* MG_ENCRYPT */
8576
8576
{
8577
8577
#endif /* AES_DECRYPTION */
8578
8578
@@ -8799,7 +8799,7 @@ int gcm_setkey(gcm_context *ctx, // pointer to caller-provided gcm context
8799
8799
8800
8800
// encrypt the null 128-bit block to generate a key-based value
8801
8801
// which is then used to initialize our GHASH lookup tables
8802
- if ((ret = aes_setkey(&ctx->aes_ctx, ENCRYPT , key, keysize)) != 0)
8802
+ if ((ret = aes_setkey(&ctx->aes_ctx, MG_ENCRYPT , key, keysize)) != 0)
8803
8803
return (ret);
8804
8804
if ((ret = aes_cipher(&ctx->aes_ctx, h, h)) != 0) return (ret);
8805
8805
@@ -8877,7 +8877,7 @@ int gcm_start(gcm_context *ctx, // pointer to user-provided GCM context
8877
8877
ctx->add_len = 0;
8878
8878
8879
8879
ctx->mode = mode; // set the GCM encryption/decryption mode
8880
- ctx->aes_ctx.mode = ENCRYPT ; // GCM *always* runs AES in ENCRYPTION mode
8880
+ ctx->aes_ctx.mode = MG_ENCRYPT ; // GCM *always* runs AES in ENCRYPTION mode
8881
8881
8882
8882
if (iv_len == 12) { // GCM natively uses a 12-byte, 96-bit IV
8883
8883
memcpy(ctx->y, iv, iv_len); // copy the IV to the top of the 'y' buff
@@ -8948,7 +8948,7 @@ int gcm_update(gcm_context *ctx, // pointer to user-provided GCM context
8948
8948
if ((ret = aes_cipher(&ctx->aes_ctx, ctx->y, ectr)) != 0) return (ret);
8949
8949
8950
8950
// encrypt or decrypt the input to the output
8951
- if (ctx->mode == ENCRYPT ) {
8951
+ if (ctx->mode == MG_ENCRYPT ) {
8952
8952
for (i = 0; i < use_len; i++) {
8953
8953
// XOR the cipher's ouptut vector (ectr) with our input
8954
8954
output[i] = (uchar) (ectr[i] ^ input[i]);
@@ -9086,7 +9086,7 @@ int gcm_auth_decrypt(
9086
9086
(which is an identical XORing to reverse the previous one)
9087
9087
and also to re-generate the matching authentication tag
9088
9088
*/
9089
- gcm_crypt_and_tag(ctx, DECRYPT , iv, iv_len, add, add_len, input, output,
9089
+ gcm_crypt_and_tag(ctx, MG_DECRYPT , iv, iv_len, add, add_len, input, output,
9090
9090
length, check_tag, tag_len);
9091
9091
9092
9092
// now we verify the authentication tag in 'constant time'
@@ -9131,7 +9131,7 @@ int aes_gcm_encrypt(unsigned char *output, //
9131
9131
9132
9132
gcm_setkey(&ctx, key, (const uint) key_len);
9133
9133
9134
- ret = gcm_crypt_and_tag(&ctx, ENCRYPT , iv, iv_len, aead, aead_len, input, output,
9134
+ ret = gcm_crypt_and_tag(&ctx, MG_ENCRYPT , iv, iv_len, aead, aead_len, input, output,
9135
9135
input_length, tag, tag_len);
9136
9136
9137
9137
gcm_zero_ctx(&ctx);
@@ -9151,7 +9151,7 @@ int aes_gcm_decrypt(unsigned char *output, const unsigned char *input,
9151
9151
9152
9152
gcm_setkey(&ctx, key, (const uint) key_len);
9153
9153
9154
- ret = gcm_crypt_and_tag(&ctx, DECRYPT , iv, iv_len, NULL, 0, input, output,
9154
+ ret = gcm_crypt_and_tag(&ctx, MG_DECRYPT , iv, iv_len, NULL, 0, input, output,
9155
9155
input_length, tag_buf, tag_len);
9156
9156
9157
9157
gcm_zero_ctx(&ctx);
0 commit comments