Browse Source

otp -> pad

Andrea Luzzardi 18 years ago
parent
commit
e032e85273
3 changed files with 13 additions and 13 deletions
  1. +1
    -1
      src/device.c
  2. +11
    -11
      src/otp.c
  3. +1
    -1
      src/otp.h

+ 1
- 1
src/device.c View File

@ -73,7 +73,7 @@ int pusb_device_check(t_pusb_options *opts)
if (opts->one_time_pad) if (opts->one_time_pad)
{ {
log_info("Performing one time pad verification...\n"); log_info("Performing one time pad verification...\n");
retval = pusb_otp_check(opts, ctx);
retval = pusb_pad_check(opts, ctx);
} }
else else
{ {


+ 11
- 11
src/otp.c View File

@ -28,7 +28,7 @@
#include "volume.h" #include "volume.h"
#include "otp.h" #include "otp.h"
static FILE *pusb_otp_open_device(t_pusb_options *opts,
static FILE *pusb_pad_open_device(t_pusb_options *opts,
LibHalVolume *volume, const char *mode) LibHalVolume *volume, const char *mode)
{ {
FILE *f; FILE *f;
@ -59,7 +59,7 @@ static FILE *pusb_otp_open_device(t_pusb_options *opts,
return (f); return (f);
} }
static FILE *pusb_otp_open_system(t_pusb_options *opts, const char *mode)
static FILE *pusb_pad_open_system(t_pusb_options *opts, const char *mode)
{ {
FILE *f; FILE *f;
char *path; char *path;
@ -85,7 +85,7 @@ static FILE *pusb_otp_open_system(t_pusb_options *opts, const char *mode)
return (f); return (f);
} }
static void pusb_otp_update(t_pusb_options *opts,
static void pusb_pad_update(t_pusb_options *opts,
LibHalVolume *volume) LibHalVolume *volume)
{ {
FILE *f_device = NULL; FILE *f_device = NULL;
@ -93,12 +93,12 @@ static void pusb_otp_update(t_pusb_options *opts,
int magic[1024]; int magic[1024];
int i; int i;
if (!(f_device = pusb_otp_open_device(opts, volume, "w+")))
if (!(f_device = pusb_pad_open_device(opts, volume, "w+")))
{ {
log_error("Unable to update pads.\n"); log_error("Unable to update pads.\n");
return ; return ;
} }
if (!(f_system = pusb_otp_open_system(opts, "w+")))
if (!(f_system = pusb_pad_open_system(opts, "w+")))
{ {
log_error("Unable to update pads.\n"); log_error("Unable to update pads.\n");
fclose(f_device); fclose(f_device);
@ -119,7 +119,7 @@ static void pusb_otp_update(t_pusb_options *opts,
log_debug("One time pads updated.\n"); log_debug("One time pads updated.\n");
} }
static int pusb_otp_compare(t_pusb_options *opts, LibHalVolume *volume)
static int pusb_pad_compare(t_pusb_options *opts, LibHalVolume *volume)
{ {
FILE *f_device = NULL; FILE *f_device = NULL;
FILE *f_system = NULL; FILE *f_system = NULL;
@ -127,9 +127,9 @@ static int pusb_otp_compare(t_pusb_options *opts, LibHalVolume *volume)
int magic_system[1024]; int magic_system[1024];
int retval; int retval;
if (!(f_system = pusb_otp_open_system(opts, "r")))
if (!(f_system = pusb_pad_open_system(opts, "r")))
return (1); return (1);
if (!(f_device = pusb_otp_open_device(opts, volume, "r")))
if (!(f_device = pusb_pad_open_device(opts, volume, "r")))
{ {
fclose(f_system); fclose(f_system);
return (0); return (0);
@ -146,7 +146,7 @@ static int pusb_otp_compare(t_pusb_options *opts, LibHalVolume *volume)
return (retval == 0); return (retval == 0);
} }
int pusb_otp_check(t_pusb_options *opts, LibHalContext *ctx)
int pusb_pad_check(t_pusb_options *opts, LibHalContext *ctx)
{ {
LibHalVolume *volume = NULL; LibHalVolume *volume = NULL;
int retval; int retval;
@ -154,11 +154,11 @@ int pusb_otp_check(t_pusb_options *opts, LibHalContext *ctx)
volume = pusb_volume_get(opts, ctx); volume = pusb_volume_get(opts, ctx);
if (!volume) if (!volume)
return (0); return (0);
retval = pusb_otp_compare(opts, volume);
retval = pusb_pad_compare(opts, volume);
if (retval) if (retval)
{ {
log_info("Verification match, updating one time pads...\n"); log_info("Verification match, updating one time pads...\n");
pusb_otp_update(opts, volume);
pusb_pad_update(opts, volume);
} }
else else
log_error("Pad checking failed !\n"); log_error("Pad checking failed !\n");


+ 1
- 1
src/otp.h View File

@ -18,6 +18,6 @@
#ifndef PUSB_OTP_H_ #ifndef PUSB_OTP_H_
# define PUSB_OTP_H_ # define PUSB_OTP_H_
int pusb_otp_check(t_pusb_options *opts, LibHalContext *ctx);
int pusb_pad_check(t_pusb_options *opts, LibHalContext *ctx);
#endif /* !PUSB_OTP_H_ */ #endif /* !PUSB_OTP_H_ */

Loading…
Cancel
Save