projects
/
gssweb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add util_base64 and util_random
[gssweb.git]
/
json_gssapi
/
src
/
cache
/
GSSNameCache.cpp
diff --git
a/json_gssapi/src/cache/GSSNameCache.cpp
b/json_gssapi/src/cache/GSSNameCache.cpp
index
9d8ff86
..
59e65da
100644
(file)
--- a/
json_gssapi/src/cache/GSSNameCache.cpp
+++ b/
json_gssapi/src/cache/GSSNameCache.cpp
@@
-4,14
+4,10
@@
* For license details, see the LICENSE file in the root of this project.
*
*/
* For license details, see the LICENSE file in the root of this project.
*
*/
-
-// #include <glib.h>
#include <stdexcept>
#include <stdexcept>
-#include <openssl/err.h>
-#include <openssl/rand.h>
-
#include "GSSNameCache.h"
#include "GSSNameCache.h"
-#include "utils/base64.h"
+#include "util_base64.h"
+#include "util_random.h"
#define KEYLEN 128
#define KEYLEN 128
@@
-77,30
+73,16
@@
std::string GSSNameCache::store ( GSSName& data, std::string inKey )
bool GSSNameCache::generateKey(std::string &key)
{
/* Variables */
bool GSSNameCache::generateKey(std::string &key)
{
/* Variables */
- int osslReturn = 0;
unsigned char theKey[KEYLEN];
unsigned char theKey[KEYLEN];
- bool existingErrors = false;
-
- /* Error checking */
- // See if there are any queued OpenSSL errors already.
- existingErrors = ( 0 == ERR_peek_error() );
/* Setup */
/* Main */
// Generate random byte string
/* Setup */
/* Main */
// Generate random byte string
- osslReturn = RAND_pseudo_bytes(theKey, KEYLEN);
-
- // Discard the error message if there weren't any OpenSSL errors to begin with.
- if (osslReturn == 1 && !existingErrors)
- {
- while (0 != ERR_get_error() );
+ if (!randGenPseudoRandom(theKey, KEYLEN))
return(false);
return(false);
- }
// Encode the binary string
// Encode the binary string
- key = (char *)theKey;
- key = base64_encode(key);
-
+ base64EncodeStr(theKey, KEYLEN, key);
/* Cleanup */
/* Return */
return(true);
/* Cleanup */
/* Return */
return(true);