Sha256: 9440c645762bc50066eebbae989191d51bcd78f19bfe49835524ec1b556002f9

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 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|
        @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.0.0 lib/efivalidate/efi_validator.rb