projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve bulk performance by making better use of Montgomery
[u/mdw/catacomb]
/
passphrase.c
diff --git
a/passphrase.c
b/passphrase.c
index
ced4385
..
e19aed4
100644
(file)
--- a/
passphrase.c
+++ b/
passphrase.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: passphrase.c,v 1.
1 1999/12/22 15:58:20
mdw Exp $
+ * $Id: passphrase.c,v 1.
2 2000/06/17 11:49:37
mdw Exp $
*
* Reading of passphrases (Unix-specific)
*
*
* Reading of passphrases (Unix-specific)
*
@@
-30,6
+30,10
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: passphrase.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: passphrase.c,v $
+ * Revision 1.2 2000/06/17 11:49:37 mdw
+ * New pixie protocol allowing application to request passphrases and send
+ * them to the pixie.
+ *
* Revision 1.1 1999/12/22 15:58:20 mdw
* Portable interface to reading passphrases.
*
* Revision 1.1 1999/12/22 15:58:20 mdw
* Portable interface to reading passphrases.
*
@@
-99,21
+103,26
@@
static int pconn(void)
int passphrase_read(const char *tag, unsigned mode, char *buf, size_t sz)
{
dstr d = DSTR_INIT;
int passphrase_read(const char *tag, unsigned mode, char *buf, size_t sz)
{
dstr d = DSTR_INIT;
+ int rc = 1;
/* --- Try talking to the pixie --- */
if (!pconn()) {
/* --- Try talking to the pixie --- */
if (!pconn()) {
- if (pixie_read(fd, tag, mode, buf, sz)) {
+ rc = pixie_read(fd, tag, mode, buf, sz);
+ if (rc < 0) {
close(fd);
fd = -1;
return (-1);
}
close(fd);
fd = -1;
return (-1);
}
- return (0);
+ if (rc == 0)
+ return (0);
}
/* --- Read from the terminal --- */
}
/* --- Read from the terminal --- */
- dstr_putf(&d, "Passphrase %s: ", tag);
+ dstr_putf(&d, "%s %s: ",
+ mode == PMODE_READ ? "Passphrase" : "New passphrase",
+ tag);
if (pixie_getpass(d.buf, buf, sz))
goto fail;
if (mode == PMODE_VERIFY) {
if (pixie_getpass(d.buf, buf, sz))
goto fail;
if (mode == PMODE_VERIFY) {
@@
-127,6
+136,11
@@
int passphrase_read(const char *tag, unsigned mode, char *buf, size_t sz)
}
}
dstr_destroy(&d);
}
}
dstr_destroy(&d);
+
+ /* --- If the pixie is interested, tell it the new passphrase --- */
+
+ if (fd >= 0)
+ pixie_set(fd, tag, buf);
return (0);
/* --- Tidy up after a failure --- */
return (0);
/* --- Tidy up after a failure --- */