Created
July 30, 2012 14:11
-
-
Save anonymous/3207162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/libpiano/piano.c b/src/libpiano/piano.c | |
index 042121e..4ed92fc 100644 | |
--- a/src/libpiano/piano.c | |
+++ b/src/libpiano/piano.c | |
@@ -43,18 +43,26 @@ THE SOFTWARE. | |
void PianoInit (PianoHandle_t *ph, const char *partnerUser, | |
const char *partnerPassword, const char *device, const char *inkey, | |
const char *outkey) { | |
+ gcry_error_t gret; | |
+ | |
memset (ph, 0, sizeof (*ph)); | |
ph->partner.user = strdup (partnerUser); | |
ph->partner.password = strdup (partnerPassword); | |
ph->partner.device = strdup (device); | |
- gcry_cipher_open (&ph->partner.in, GCRY_CIPHER_BLOWFISH, | |
- GCRY_CIPHER_MODE_ECB, 0); | |
+ if ((gret = gcry_cipher_open (&ph->partner.in, GCRY_CIPHER_BLOWFISH, | |
+ GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) { | |
+ printf ("%s\n", gcry_strerror (gret)); | |
+ return; | |
+ } | |
gcry_cipher_setkey (ph->partner.in, (const unsigned char *) inkey, | |
strlen (inkey)); | |
- gcry_cipher_open (&ph->partner.out, GCRY_CIPHER_BLOWFISH, | |
- GCRY_CIPHER_MODE_ECB, 0); | |
+ if ((gret = gcry_cipher_open (&ph->partner.out, GCRY_CIPHER_BLOWFISH, | |
+ GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) { | |
+ printf ("%s\n", gcry_strerror (gret)); | |
+ return; | |
+ } | |
gcry_cipher_setkey (ph->partner.out, (const unsigned char *) outkey, | |
strlen (outkey)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment