Skip to content

Commit

Permalink
Use const for the cipher context
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeto committed Sep 23, 2017
1 parent bb9c730 commit d703205
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions blowfish.c
Expand Up @@ -270,7 +270,7 @@ static const uint32_t blowfish_s[] = {
};

static uint32_t
blowfish_f(uint32_t s[4][256], uint32_t x)
blowfish_f(const uint32_t s[4][256], uint32_t x)
{
/* big endian */
uint32_t b = 0xff;
Expand Down Expand Up @@ -299,7 +299,7 @@ blowfish_write(uint8_t *p, uint32_t v)
}

void
blowfish_encrypt(struct blowfish *ctx, uint32_t *bl, uint32_t *br)
blowfish_encrypt(const struct blowfish *ctx, uint32_t *bl, uint32_t *br)
{
uint32_t xl = *bl;
uint32_t xr = *br;
Expand All @@ -316,7 +316,7 @@ blowfish_encrypt(struct blowfish *ctx, uint32_t *bl, uint32_t *br)
}

void
blowfish_decrypt(struct blowfish *ctx, uint32_t *bl, uint32_t *br)
blowfish_decrypt(const struct blowfish *ctx, uint32_t *bl, uint32_t *br)
{
uint32_t xl = *bl;
uint32_t xr = *br;
Expand Down
4 changes: 2 additions & 2 deletions blowfish.h
Expand Up @@ -28,11 +28,11 @@ void blowfish_init(struct blowfish *, const void *key, int len);

/* Encrypt a pair of 32-bit integers using the given context.
*/
void blowfish_encrypt(struct blowfish *, uint32_t *, uint32_t *);
void blowfish_encrypt(const struct blowfish *, uint32_t *, uint32_t *);

/* Decrypt a pair of 32-bit integers using the given context.
*/
void blowfish_decrypt(struct blowfish *, uint32_t *, uint32_t *);
void blowfish_decrypt(const struct blowfish *, uint32_t *, uint32_t *);

/* Compute the bcrypt digest for a given password.
*
Expand Down

0 comments on commit d703205

Please sign in to comment.