Loading crypto/modes/gcm128.c +88 −0 Original line number Diff line number Diff line Loading @@ -847,7 +847,11 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len) GCM_MUL(ctx,Yi); if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; } Loading @@ -855,7 +859,11 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len) (*ctx->block)(ctx->Yi.c,ctx->EK0.c,ctx->key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; } Loading Loading @@ -950,7 +958,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading Loading @@ -984,7 +996,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1006,7 +1022,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1025,7 +1045,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1041,7 +1065,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading @@ -1059,7 +1087,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; } Loading Loading @@ -1103,7 +1135,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading Loading @@ -1140,7 +1176,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1160,7 +1200,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1178,7 +1222,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) { Loading @@ -1196,7 +1244,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading @@ -1217,7 +1269,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; } Loading Loading @@ -1262,7 +1318,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading @@ -1284,7 +1344,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c); ctr += GHASH_CHUNK/16; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; GHASH(ctx,out,GHASH_CHUNK); Loading @@ -1299,7 +1363,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,j,key,ctx->Yi.c); ctr += (unsigned int)j; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; in += i; Loading @@ -1319,7 +1387,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading Loading @@ -1361,7 +1433,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading @@ -1386,7 +1462,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c); ctr += GHASH_CHUNK/16; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; out += GHASH_CHUNK; Loading @@ -1412,7 +1492,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,j,key,ctx->Yi.c); ctr += (unsigned int)j; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; out += i; Loading @@ -1423,7 +1507,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading Loading
crypto/modes/gcm128.c +88 −0 Original line number Diff line number Diff line Loading @@ -847,7 +847,11 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len) GCM_MUL(ctx,Yi); if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; } Loading @@ -855,7 +859,11 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len) (*ctx->block)(ctx->Yi.c,ctx->EK0.c,ctx->key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; } Loading Loading @@ -950,7 +958,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading Loading @@ -984,7 +996,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1006,7 +1022,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1025,7 +1045,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1041,7 +1065,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading @@ -1059,7 +1087,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; } Loading Loading @@ -1103,7 +1135,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading Loading @@ -1140,7 +1176,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1160,7 +1200,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) Loading @@ -1178,7 +1222,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; for (i=0; i<16/sizeof(size_t); ++i) { Loading @@ -1196,7 +1244,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading @@ -1217,7 +1269,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; } Loading Loading @@ -1262,7 +1318,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading @@ -1284,7 +1344,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c); ctr += GHASH_CHUNK/16; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; GHASH(ctx,out,GHASH_CHUNK); Loading @@ -1299,7 +1363,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,j,key,ctx->Yi.c); ctr += (unsigned int)j; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; in += i; Loading @@ -1319,7 +1387,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading Loading @@ -1361,7 +1433,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, } if (is_endian.little) #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else ctr = GETU32(ctx->Yi.c+12); #endif else ctr = ctx->Yi.d[3]; Loading @@ -1386,7 +1462,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c); ctr += GHASH_CHUNK/16; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; out += GHASH_CHUNK; Loading @@ -1412,7 +1492,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, (*stream)(in,out,j,key,ctx->Yi.c); ctr += (unsigned int)j; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; out += i; Loading @@ -1423,7 +1507,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else PUTU32(ctx->Yi.c+12,ctr); #endif else ctx->Yi.d[3] = ctr; while (len--) { Loading