Sha256: b4f16d219099512545996f032c45621ef85981f535369dc309231138d20735d3

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

module EFIValidate
  class EFIValidator
    attr_reader :parser, :data, :errors

    def initialize(parser, data)
      @parser = parser
      @data = data
    end


    def validate!
      @errors = []

      @parser.rows.each do |row|
        next if row.is_privacy_row?

        @data.seek row.ealf_offset

        section_data = @data.read row.ealf_length

        calculated_hash = @parser.header.create_hash.hexdigest (section_data || '')

        @errors << EFIValidationError.new(row, section_data, calculated_hash) unless calculated_hash == row.hash
      end
    end

    def validate
      self.validate! unless @errors
    end

    def is_valid?
      self.validate

      self.errors.count == 0
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
efivalidate-1.1.0 lib/efivalidate/efi_validator.rb