mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-13 20:06:24 +08:00
Update rand_bytes()
This commit is contained in:
@@ -20,12 +20,15 @@ int rand_bytes(uint8_t *buf, size_t len)
|
||||
{
|
||||
int errCode;
|
||||
if ((errCode = SecRandomCopyBytes(kSecRandomDefault, len, buf)) != errSecSuccess) {
|
||||
//CFStringRef errStr;
|
||||
//errStr = SecCopyErrorMessageString(errCode, NULL);
|
||||
//CFRelease(errStr);
|
||||
error_print();
|
||||
fprintf(stderr, "%s:%d: SecRandomCopyBytes() return OSStatus = %d\n", __FILE__, __LINE__, errCode);
|
||||
/*
|
||||
CFStringRef errStr;
|
||||
errStr = SecCopyErrorMessageString(errCode, NULL);
|
||||
fprintf(stderr, "error: %s\n", CFStringGetCStringPtr(errStr, kCFStringEncodingMacRoman));
|
||||
CFRelease(errStr); // -framework CoreFoundation
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user