Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/fs/smb/common/   (Linux Kernel Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 1 kB image not shown  

Impressum cifs_arc4.c

  Sprache: C
 

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Cryptographic API
 *
 * ARC4 Cipher Algorithm
 *
 * Jon Oberheide <jon@oberheide.org>
 */


#include <linux/module.h>
#include "arc4.h"

MODULE_DESCRIPTION("ARC4 Cipher Algorithm");
MODULE_LICENSE("GPL");

int cifs_arc4_setkey(struct arc4_ctx *ctx, const u8 *in_key, unsigned int key_len)
{
 int i, j = 0, k = 0;

 ctx->x = 1;
 ctx->y = 0;

 for (i = 0; i < 256; i++)
  ctx->S[i] = i;

 for (i = 0; i < 256; i++) {
  u32 a = ctx->S[i];

  j = (j + in_key[k] + a) & 0xff;
  ctx->S[i] = ctx->S[j];
  ctx->S[j] = a;
  if (++k >= key_len)
   k = 0;
 }

 return 0;
}
EXPORT_SYMBOL_GPL(cifs_arc4_setkey);

void cifs_arc4_crypt(struct arc4_ctx *ctx, u8 *out, const u8 *in, unsigned int len)
{
 u32 *const S = ctx->S;
 u32 x, y, a, b;
 u32 ty, ta, tb;

 if (len == 0)
  return;

 x = ctx->x;
 y = ctx->y;

 a = S[x];
 y = (y + a) & 0xff;
 b = S[y];

 do {
  S[y] = a;
  a = (a + b) & 0xff;
  S[x] = b;
  x = (x + 1) & 0xff;
  ta = S[x];
  ty = (y + ta) & 0xff;
  tb = S[ty];
  *out++ = *in++ ^ S[a];
  if (--len == 0)
   break;
  y = ty;
  a = ta;
  b = tb;
 } while (true);

 ctx->x = x;
 ctx->y = y;
}
EXPORT_SYMBOL_GPL(cifs_arc4_crypt);

Messung V0.5 in Prozent
C=95 H=93 G=93

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:  (vorverarbeitet am  2026-06-08) ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.