ARM is one of those awkward processors, the event counter isn't always directly readable from userspace, if it's not directly readable you get an illegal instruction trap. A syscall to access the event counters is only present in recent kernels. And even more fun, the event counter data is only readable from the thread that enabled the event counters.

The bad news is that without  the event counters, there are no good entropy sources - and dying with a segv is likely the best possible outcome.

Peter

This  code works (for a certain value of 'work') on recent kernels.

#elif defined(__ARMEL__) || defined(__ARMEB__)
/* ARM */
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/perf_event.h>
#include <asm/unistd.h>

static inline long long
armtick(void)
{
  int fddev = -1;
 long long result = 0;
 static struct perf_event_attr attr;
 attr.type = PERF_TYPE_HARDWARE;
 attr.config = PERF_COUNT_HW_CPU_CYCLES;
 fddev = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0);
 if (read(fddev, &result, sizeof(result)) < sizeof(result)) return 0;
 close(fddev);
 return result;
}

Not exactly efficient.

Peter

[email protected] wrote: -----
To: [email protected]
From: Andy Polyakov
Sent by: [email protected]
Date: 10/11/2014 01:17AM
Subject: Re: Error _armv7_tick openssl

> If I press ‘continue’, then also it give segmentation fault. It is not
> working normally, it exits with seg fault: saying illegal
> instruction.

??? Segmentation fault != illegal instruction. What does "exits with seg
fault saying illegal instruction" mean? Where is the segmentation fault?

> Could you suggest any other solution? The assembly
> instruction which I mentioned in my log was identified as illegal
> instruction.

https://www.openssl.org/support/faq.html#PROG17. There are two options
listed.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [email protected] Automated List Manager [email protected]

Reply via email to